@Test public void testSetNewNameNotinReg() { DeviceEntity entity = new DeviceEntity("Computer", DEVICE_NAME1, ID1); when(this.registry.findDeviceWithUri(ID1)).thenReturn(null); assertThat(this.deviceLogic.setNewDeviceName(ID1, DEVICE_NAME2), equalTo(null)); }
public DeviceEntity setNewDeviceName(String deviceUri, String newName) { DeviceEntity deviceToChange = this.deviceRegistry.findDeviceWithUri(deviceUri); if (deviceToChange != null) { deviceToChange.setName(newName); this.deviceRegistry.save(deviceToChange); return deviceToChange; } return null; }
DeviceLogic { public DeviceEntity setNewDeviceName(String deviceUri, String newName) { DeviceEntity deviceToChange = this.deviceRegistry.findDeviceWithUri(deviceUri); if (deviceToChange != null) { deviceToChange.setName(newName); this.deviceRegistry.save(deviceToChange); return deviceToChange; } return null; } }
DeviceLogic { public DeviceEntity setNewDeviceName(String deviceUri, String newName) { DeviceEntity deviceToChange = this.deviceRegistry.findDeviceWithUri(deviceUri); if (deviceToChange != null) { deviceToChange.setName(newName); this.deviceRegistry.save(deviceToChange); return deviceToChange; } return null; }  }
DeviceLogic { public DeviceEntity setNewDeviceName(String deviceUri, String newName) { DeviceEntity deviceToChange = this.deviceRegistry.findDeviceWithUri(deviceUri); if (deviceToChange != null) { deviceToChange.setName(newName); this.deviceRegistry.save(deviceToChange); return deviceToChange; } return null; }  List<DeviceEntity> getDevices(); String setDevice(int deviceNumber); boolean setDevice(String deviceUri); DeviceEntity setNewDeviceName(String deviceUri, String newName); }
DeviceLogic { public DeviceEntity setNewDeviceName(String deviceUri, String newName) { DeviceEntity deviceToChange = this.deviceRegistry.findDeviceWithUri(deviceUri); if (deviceToChange != null) { deviceToChange.setName(newName); this.deviceRegistry.save(deviceToChange); return deviceToChange; } return null; }  List<DeviceEntity> getDevices(); String setDevice(int deviceNumber); boolean setDevice(String deviceUri); DeviceEntity setNewDeviceName(String deviceUri, String newName);  }