@Test void testGetPlaylist() { Map<String, EntityData> map = new HashMap<>(); List<PlaylistEntity> list = new ArrayList<>(); when(this.playlist.toString()).thenReturn("test"); list.add(this.playlist); when(this.entityData.getString()).thenReturn("featured"); when(this.searchLogic.searchFeaturedPlaylists(5)).thenReturn(list); map.put("type", this.entityData); this.speech.getPlaylists(map); when(this.entityData.getString()).thenReturn("own"); when(this.searchLogic.searchOwnPlaylists(5)).thenReturn(list); this.speech.getPlaylists(map); when(this.entityData.getString()).thenReturn("test"); this.speech.getPlaylists(map); }
@Intent() public String getPlaylists(Map<String, EntityData> entites) { StringBuilder builder = new StringBuilder(); int amount = LIMIT_FOR_SEARCH; if (entites.get("number") != null) { amount = entites.get("number").getNumber(); } if (entites.get("type").getString() != null) { switch (entites.get("type").getString()) { case "featured": for (PlaylistEntity playlist : this.search.searchFeaturedPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; case "own": case "on": for (PlaylistEntity playlist : this.search.searchOwnPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; default: break; } } if (builder.length() > 0) { builder.insert(0, "Following Playlists found: \n"); } else { builder.append("No playlists found"); } return builder.toString(); }
SpotifySpeech { @Intent() public String getPlaylists(Map<String, EntityData> entites) { StringBuilder builder = new StringBuilder(); int amount = LIMIT_FOR_SEARCH; if (entites.get("number") != null) { amount = entites.get("number").getNumber(); } if (entites.get("type").getString() != null) { switch (entites.get("type").getString()) { case "featured": for (PlaylistEntity playlist : this.search.searchFeaturedPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; case "own": case "on": for (PlaylistEntity playlist : this.search.searchOwnPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; default: break; } } if (builder.length() > 0) { builder.insert(0, "Following Playlists found: \n"); } else { builder.append("No playlists found"); } return builder.toString(); } }
SpotifySpeech { @Intent() public String getPlaylists(Map<String, EntityData> entites) { StringBuilder builder = new StringBuilder(); int amount = LIMIT_FOR_SEARCH; if (entites.get("number") != null) { amount = entites.get("number").getNumber(); } if (entites.get("type").getString() != null) { switch (entites.get("type").getString()) { case "featured": for (PlaylistEntity playlist : this.search.searchFeaturedPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; case "own": case "on": for (PlaylistEntity playlist : this.search.searchOwnPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; default: break; } } if (builder.length() > 0) { builder.insert(0, "Following Playlists found: \n"); } else { builder.append("No playlists found"); } return builder.toString(); }  }
SpotifySpeech { @Intent() public String getPlaylists(Map<String, EntityData> entites) { StringBuilder builder = new StringBuilder(); int amount = LIMIT_FOR_SEARCH; if (entites.get("number") != null) { amount = entites.get("number").getNumber(); } if (entites.get("type").getString() != null) { switch (entites.get("type").getString()) { case "featured": for (PlaylistEntity playlist : this.search.searchFeaturedPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; case "own": case "on": for (PlaylistEntity playlist : this.search.searchOwnPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; default: break; } } if (builder.length() > 0) { builder.insert(0, "Following Playlists found: \n"); } else { builder.append("No playlists found"); } 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 getPlaylists(Map<String, EntityData> entites) { StringBuilder builder = new StringBuilder(); int amount = LIMIT_FOR_SEARCH; if (entites.get("number") != null) { amount = entites.get("number").getNumber(); } if (entites.get("type").getString() != null) { switch (entites.get("type").getString()) { case "featured": for (PlaylistEntity playlist : this.search.searchFeaturedPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; case "own": case "on": for (PlaylistEntity playlist : this.search.searchOwnPlaylists(amount)) { builder = builder.append(playlist.toString()).append("\n"); } break; default: break; } } if (builder.length() > 0) { builder.insert(0, "Following Playlists found: \n"); } else { builder.append("No playlists found"); } 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();  }