@Test public void testCopyMissingValuesFromOldPeer() { PeerProperties pp1 = new PeerProperties(TEST_MAC); PeerProperties pp2 = new PeerProperties(TEST_MAC); assertThat(PeerProperties.copyMissingValuesFromOldPeer(pp1, pp2), is(false)); assertThat(pp2.hasMoreInformation(pp1), is(false)); pp1 = new PeerProperties("type1", "deviceName1", "address1"); assertThat(PeerProperties.copyMissingValuesFromOldPeer(pp1, pp2), is(true)); assertThat(pp1.hasMoreInformation(pp2), is(false)); }
public static boolean copyMissingValuesFromOldPeer( PeerProperties oldPeerProperties, PeerProperties newPeerProperties) { boolean dataWasCopied = false; if (oldPeerProperties != null && newPeerProperties != null) { if (!isNullOrEmpty(oldPeerProperties.mBluetoothMacAddress) && isNullOrEmpty(newPeerProperties.mBluetoothMacAddress)) { newPeerProperties.mBluetoothMacAddress = oldPeerProperties.mBluetoothMacAddress; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mServiceType) && isNullOrEmpty(newPeerProperties.mServiceType)) { newPeerProperties.mServiceType = oldPeerProperties.mServiceType; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceName) && isNullOrEmpty(newPeerProperties.mDeviceName)) { newPeerProperties.mDeviceName = oldPeerProperties.mDeviceName; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceAddress) && isNullOrEmpty(newPeerProperties.mDeviceAddress)) { newPeerProperties.mDeviceAddress = oldPeerProperties.mDeviceAddress; dataWasCopied = true; } } return dataWasCopied; }
PeerProperties { public static boolean copyMissingValuesFromOldPeer( PeerProperties oldPeerProperties, PeerProperties newPeerProperties) { boolean dataWasCopied = false; if (oldPeerProperties != null && newPeerProperties != null) { if (!isNullOrEmpty(oldPeerProperties.mBluetoothMacAddress) && isNullOrEmpty(newPeerProperties.mBluetoothMacAddress)) { newPeerProperties.mBluetoothMacAddress = oldPeerProperties.mBluetoothMacAddress; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mServiceType) && isNullOrEmpty(newPeerProperties.mServiceType)) { newPeerProperties.mServiceType = oldPeerProperties.mServiceType; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceName) && isNullOrEmpty(newPeerProperties.mDeviceName)) { newPeerProperties.mDeviceName = oldPeerProperties.mDeviceName; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceAddress) && isNullOrEmpty(newPeerProperties.mDeviceAddress)) { newPeerProperties.mDeviceAddress = oldPeerProperties.mDeviceAddress; dataWasCopied = true; } } return dataWasCopied; } }
PeerProperties { public static boolean copyMissingValuesFromOldPeer( PeerProperties oldPeerProperties, PeerProperties newPeerProperties) { boolean dataWasCopied = false; if (oldPeerProperties != null && newPeerProperties != null) { if (!isNullOrEmpty(oldPeerProperties.mBluetoothMacAddress) && isNullOrEmpty(newPeerProperties.mBluetoothMacAddress)) { newPeerProperties.mBluetoothMacAddress = oldPeerProperties.mBluetoothMacAddress; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mServiceType) && isNullOrEmpty(newPeerProperties.mServiceType)) { newPeerProperties.mServiceType = oldPeerProperties.mServiceType; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceName) && isNullOrEmpty(newPeerProperties.mDeviceName)) { newPeerProperties.mDeviceName = oldPeerProperties.mDeviceName; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceAddress) && isNullOrEmpty(newPeerProperties.mDeviceAddress)) { newPeerProperties.mDeviceAddress = oldPeerProperties.mDeviceAddress; dataWasCopied = true; } } return dataWasCopied; } PeerProperties(String bluetoothMacAddress);  PeerProperties(String serviceType, String deviceName, String deviceAddress);  PeerProperties(String bluetoothMacAddress, int extraInformation); }
PeerProperties { public static boolean copyMissingValuesFromOldPeer( PeerProperties oldPeerProperties, PeerProperties newPeerProperties) { boolean dataWasCopied = false; if (oldPeerProperties != null && newPeerProperties != null) { if (!isNullOrEmpty(oldPeerProperties.mBluetoothMacAddress) && isNullOrEmpty(newPeerProperties.mBluetoothMacAddress)) { newPeerProperties.mBluetoothMacAddress = oldPeerProperties.mBluetoothMacAddress; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mServiceType) && isNullOrEmpty(newPeerProperties.mServiceType)) { newPeerProperties.mServiceType = oldPeerProperties.mServiceType; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceName) && isNullOrEmpty(newPeerProperties.mDeviceName)) { newPeerProperties.mDeviceName = oldPeerProperties.mDeviceName; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceAddress) && isNullOrEmpty(newPeerProperties.mDeviceAddress)) { newPeerProperties.mDeviceAddress = oldPeerProperties.mDeviceAddress; dataWasCopied = true; } } return dataWasCopied; } PeerProperties(String bluetoothMacAddress);  PeerProperties(String serviceType, String deviceName, String deviceAddress);  PeerProperties(String bluetoothMacAddress, int extraInformation); String getId(); String getBluetoothMacAddress(); String getDeviceName(); String getDeviceAddress(); int getExtraInformation(); void copyFrom(PeerProperties sourcePeerProperties); boolean isValid(); boolean hasMoreInformation(PeerProperties otherPeerProperties); static boolean copyMissingValuesFromOldPeer(
            PeerProperties oldPeerProperties, PeerProperties newPeerProperties); @Override boolean equals(Object otherPeerProperties); @Override String toString(); }
PeerProperties { public static boolean copyMissingValuesFromOldPeer( PeerProperties oldPeerProperties, PeerProperties newPeerProperties) { boolean dataWasCopied = false; if (oldPeerProperties != null && newPeerProperties != null) { if (!isNullOrEmpty(oldPeerProperties.mBluetoothMacAddress) && isNullOrEmpty(newPeerProperties.mBluetoothMacAddress)) { newPeerProperties.mBluetoothMacAddress = oldPeerProperties.mBluetoothMacAddress; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mServiceType) && isNullOrEmpty(newPeerProperties.mServiceType)) { newPeerProperties.mServiceType = oldPeerProperties.mServiceType; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceName) && isNullOrEmpty(newPeerProperties.mDeviceName)) { newPeerProperties.mDeviceName = oldPeerProperties.mDeviceName; dataWasCopied = true; } if (!isNullOrEmpty(oldPeerProperties.mDeviceAddress) && isNullOrEmpty(newPeerProperties.mDeviceAddress)) { newPeerProperties.mDeviceAddress = oldPeerProperties.mDeviceAddress; dataWasCopied = true; } } return dataWasCopied; } PeerProperties(String bluetoothMacAddress);  PeerProperties(String serviceType, String deviceName, String deviceAddress);  PeerProperties(String bluetoothMacAddress, int extraInformation); String getId(); String getBluetoothMacAddress(); String getDeviceName(); String getDeviceAddress(); int getExtraInformation(); void copyFrom(PeerProperties sourcePeerProperties); boolean isValid(); boolean hasMoreInformation(PeerProperties otherPeerProperties); static boolean copyMissingValuesFromOldPeer(
            PeerProperties oldPeerProperties, PeerProperties newPeerProperties); @Override boolean equals(Object otherPeerProperties); @Override String toString(); static final String BLUETOOTH_MAC_ADDRESS_UNKNOWN; static final int NO_EXTRA_INFORMATION; }