### Question:
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);  }### Answer:
@Test public void testSetDevice() { when(this.spotifyAPICalls.getDevices()).thenReturn(null); assertThat(this.deviceLogic.setDevice(0), equalTo("No device found")); when(this.spotifyAPICalls.getDevices()).thenReturn(devices); assertThat(this.deviceLogic.setDevice(0), equalTo(DEVICE_NAME1)); }
@Test public void testSetDeviceWithId() { assertThat(this.deviceLogic.setDevice("1"), equalTo(false)); verify(this.spotifyAPICalls).setCurrentDevice("1"); }