@Test void testGetDevices() { DeviceEntity deviceEntity = new DeviceEntity(); deviceEntity.setName("test"); List<DeviceEntity> list = new ArrayList<>(); list.add(deviceEntity); when(this.deviceLogic.getDevices()).thenReturn(list); assertThat(this.speech.getDevices(new HashMap<>()), equalTo("Following Devices are online: \n0. test\n")); when(this.deviceLogic.getDevices()).thenReturn(new ArrayList<>()); assertThat(this.speech.getDevices(new HashMap<>()), equalTo("No devices are online")); }
@Intent() public String getDevices(Map<String, EntityData> entites) { List<DeviceEntity> devices = this.deviceLogic.getDevices(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < devices.size(); i++) { builder = builder.append(String.valueOf(i)).append(". ").append(devices.get(i).getName().concat("\n")); } if (builder.length() > 0) { builder.insert(0, "Following Devices are online: \n"); } else { builder.append("No devices are online"); } return builder.toString(); }
SpotifySpeech { @Intent() public String getDevices(Map<String, EntityData> entites) { List<DeviceEntity> devices = this.deviceLogic.getDevices(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < devices.size(); i++) { builder = builder.append(String.valueOf(i)).append(". ").append(devices.get(i).getName().concat("\n")); } if (builder.length() > 0) { builder.insert(0, "Following Devices are online: \n"); } else { builder.append("No devices are online"); } return builder.toString(); } }
SpotifySpeech { @Intent() public String getDevices(Map<String, EntityData> entites) { List<DeviceEntity> devices = this.deviceLogic.getDevices(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < devices.size(); i++) { builder = builder.append(String.valueOf(i)).append(". ").append(devices.get(i).getName().concat("\n")); } if (builder.length() > 0) { builder.insert(0, "Following Devices are online: \n"); } else { builder.append("No devices are online"); } return builder.toString(); }  }
SpotifySpeech { @Intent() public String getDevices(Map<String, EntityData> entites) { List<DeviceEntity> devices = this.deviceLogic.getDevices(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < devices.size(); i++) { builder = builder.append(String.valueOf(i)).append(". ").append(devices.get(i).getName().concat("\n")); } if (builder.length() > 0) { builder.insert(0, "Following Devices are online: \n"); } else { builder.append("No devices are online"); } return builder.toString(); }  @Intent() String getDevices(Map<String, EntityData> entites); @Intent() Response getCurrentSong(Map<String, EntityData> entites); @Intent() String getPlaylists(Map<String, EntityData> entites); @Intent() String playSomething(Map<String, EntityData> entites); @Intent() String control(Map<String, EntityData> entites); @Intent() String volume(Map<String, EntityData> entites); @Intent() String volumePercent(Map<String, EntityData> entites); @Intent() String setDeviceId(Map<String, EntityData> entites); @Intent() String setDeviceName(Map<String, EntityData> entites); @Intent() String playPlaylistId(Map<String, EntityData> entites); @Intent() Response searchASong(Map<String, EntityData> entites); @EntityProvider("devicename") List<String> getDeviceNames(); }
SpotifySpeech { @Intent() public String getDevices(Map<String, EntityData> entites) { List<DeviceEntity> devices = this.deviceLogic.getDevices(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < devices.size(); i++) { builder = builder.append(String.valueOf(i)).append(". ").append(devices.get(i).getName().concat("\n")); } if (builder.length() > 0) { builder.insert(0, "Following Devices are online: \n"); } else { builder.append("No devices are online"); } return builder.toString(); }  @Intent() String getDevices(Map<String, EntityData> entites); @Intent() Response getCurrentSong(Map<String, EntityData> entites); @Intent() String getPlaylists(Map<String, EntityData> entites); @Intent() String playSomething(Map<String, EntityData> entites); @Intent() String control(Map<String, EntityData> entites); @Intent() String volume(Map<String, EntityData> entites); @Intent() String volumePercent(Map<String, EntityData> entites); @Intent() String setDeviceId(Map<String, EntityData> entites); @Intent() String setDeviceName(Map<String, EntityData> entites); @Intent() String playPlaylistId(Map<String, EntityData> entites); @Intent() Response searchASong(Map<String, EntityData> entites); @EntityProvider("devicename") List<String> getDeviceNames();  }