@Test void testPlayPlaylist() { Map<String, EntityData> map = new HashMap<>(); when(this.entityData.getString()).thenReturn("own"); map.put("type", this.entityData); when(this.songId.getNumber()).thenReturn(1); map.put("songid", this.songId); assertThat(this.speech.playPlaylistId(map), equalTo("Element is not available")); verify(this.playerlogic).playPlaylist(1, SearchTypes.USER_PLAYLISTS); when(this.playlist.toString()).thenReturn("test"); List<PlaylistEntity> list = new ArrayList<>(); list.add(this.playlist); when(this.playerlogic.playPlaylist(1, SearchTypes.FEATURED_PLAYLISTS)).thenReturn(this.playlist); when(this.entityData.getString()).thenReturn("featured"); assertThat(this.speech.playPlaylistId(map), equalTo("test")); }
@Intent() public String playPlaylistId(Map<String, EntityData> entites) { PlaylistEntity playlist = null; switch (entites.get("type").getString()) { case "own": case "on": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.USER_PLAYLISTS); break; case "featured": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.FEATURED_PLAYLISTS); break; default: break; } return (playlist != null) ? playlist.toString() : ERROR_MESSAGE_ELEMENT; }
SpotifySpeech { @Intent() public String playPlaylistId(Map<String, EntityData> entites) { PlaylistEntity playlist = null; switch (entites.get("type").getString()) { case "own": case "on": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.USER_PLAYLISTS); break; case "featured": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.FEATURED_PLAYLISTS); break; default: break; } return (playlist != null) ? playlist.toString() : ERROR_MESSAGE_ELEMENT; } }
SpotifySpeech { @Intent() public String playPlaylistId(Map<String, EntityData> entites) { PlaylistEntity playlist = null; switch (entites.get("type").getString()) { case "own": case "on": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.USER_PLAYLISTS); break; case "featured": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.FEATURED_PLAYLISTS); break; default: break; } return (playlist != null) ? playlist.toString() : ERROR_MESSAGE_ELEMENT; }  }
SpotifySpeech { @Intent() public String playPlaylistId(Map<String, EntityData> entites) { PlaylistEntity playlist = null; switch (entites.get("type").getString()) { case "own": case "on": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.USER_PLAYLISTS); break; case "featured": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.FEATURED_PLAYLISTS); break; default: break; } return (playlist != null) ? playlist.toString() : ERROR_MESSAGE_ELEMENT; }  @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 playPlaylistId(Map<String, EntityData> entites) { PlaylistEntity playlist = null; switch (entites.get("type").getString()) { case "own": case "on": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.USER_PLAYLISTS); break; case "featured": playlist = this.playerLogic.playPlaylist(entites.get("songid").getNumber(), SearchTypes.FEATURED_PLAYLISTS); break; default: break; } return (playlist != null) ? playlist.toString() : ERROR_MESSAGE_ELEMENT; }  @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();  }