@Test public void testSetDeviceWithId() { assertThat(this.deviceLogic.setDevice("1"), equalTo(false)); verify(this.spotifyAPICalls).setCurrentDevice("1"); }
public String setDevice(int deviceNumber) { List<DeviceEntity> devices = getDevices(); if (devices.size() > deviceNumber) { this.spotifyAPICalls.setCurrentDevice(devices.get(deviceNumber).getID()); return devices.get(deviceNumber).getName(); } this.logger.warn("No device with this number was found"); return "No device found"; }
DeviceLogic { public String setDevice(int deviceNumber) { List<DeviceEntity> devices = getDevices(); if (devices.size() > deviceNumber) { this.spotifyAPICalls.setCurrentDevice(devices.get(deviceNumber).getID()); return devices.get(deviceNumber).getName(); } this.logger.warn("No device with this number was found"); return "No device found"; } }
DeviceLogic { public String setDevice(int deviceNumber) { List<DeviceEntity> devices = getDevices(); if (devices.size() > deviceNumber) { this.spotifyAPICalls.setCurrentDevice(devices.get(deviceNumber).getID()); return devices.get(deviceNumber).getName(); } this.logger.warn("No device with this number was found"); return "No device found"; }  }
DeviceLogic { public String setDevice(int deviceNumber) { List<DeviceEntity> devices = getDevices(); if (devices.size() > deviceNumber) { this.spotifyAPICalls.setCurrentDevice(devices.get(deviceNumber).getID()); return devices.get(deviceNumber).getName(); } this.logger.warn("No device with this number was found"); return "No device found"; }  List<DeviceEntity> getDevices(); String setDevice(int deviceNumber); boolean setDevice(String deviceUri); DeviceEntity setNewDeviceName(String deviceUri, String newName); }
DeviceLogic { public String setDevice(int deviceNumber) { List<DeviceEntity> devices = getDevices(); if (devices.size() > deviceNumber) { this.spotifyAPICalls.setCurrentDevice(devices.get(deviceNumber).getID()); return devices.get(deviceNumber).getName(); } this.logger.warn("No device with this number was found"); return "No device found"; }  List<DeviceEntity> getDevices(); String setDevice(int deviceNumber); boolean setDevice(String deviceUri); DeviceEntity setNewDeviceName(String deviceUri, String newName);  }