@Test void playPlaylist() { when(this.search.getFeaturedPlaylists()).thenReturn(this.playlistList); assertThat(this.playerLogic.playPlaylist(0, SearchTypes.FEATURED_PLAYLISTS), equalTo(this.playlistList.get(0))); assertThat(this.playerLogic.playPlaylist(1, SearchTypes.FEATURED_PLAYLISTS), equalTo(null)); }
public PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type) { PlaylistEntity selectedPlaylist = null; if (type.equals(SearchTypes.FEATURED_PLAYLISTS) && this.search.getFeaturedPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getFeaturedPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.USER_PLAYLISTS) && this.search.getOwnPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getOwnPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.SEARCH_PLAYLISTS) && this.search.getPlaylistSearchResults().size() > playlistNumber) { selectedPlaylist = this.search.getPlaylistSearchResults().get(playlistNumber); } if (selectedPlaylist != null) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = selectedPlaylist.getUri(); } else { this.spotifyAPICalls.playListFromUri(selectedPlaylist.getUri()); } return selectedPlaylist; } this.logger.warn(ITME_NOT_FOUND); return null; }
PlayerLogic { public PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type) { PlaylistEntity selectedPlaylist = null; if (type.equals(SearchTypes.FEATURED_PLAYLISTS) && this.search.getFeaturedPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getFeaturedPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.USER_PLAYLISTS) && this.search.getOwnPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getOwnPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.SEARCH_PLAYLISTS) && this.search.getPlaylistSearchResults().size() > playlistNumber) { selectedPlaylist = this.search.getPlaylistSearchResults().get(playlistNumber); } if (selectedPlaylist != null) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = selectedPlaylist.getUri(); } else { this.spotifyAPICalls.playListFromUri(selectedPlaylist.getUri()); } return selectedPlaylist; } this.logger.warn(ITME_NOT_FOUND); return null; } }
PlayerLogic { public PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type) { PlaylistEntity selectedPlaylist = null; if (type.equals(SearchTypes.FEATURED_PLAYLISTS) && this.search.getFeaturedPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getFeaturedPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.USER_PLAYLISTS) && this.search.getOwnPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getOwnPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.SEARCH_PLAYLISTS) && this.search.getPlaylistSearchResults().size() > playlistNumber) { selectedPlaylist = this.search.getPlaylistSearchResults().get(playlistNumber); } if (selectedPlaylist != null) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = selectedPlaylist.getUri(); } else { this.spotifyAPICalls.playListFromUri(selectedPlaylist.getUri()); } return selectedPlaylist; } this.logger.warn(ITME_NOT_FOUND); return null; }  }
PlayerLogic { public PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type) { PlaylistEntity selectedPlaylist = null; if (type.equals(SearchTypes.FEATURED_PLAYLISTS) && this.search.getFeaturedPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getFeaturedPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.USER_PLAYLISTS) && this.search.getOwnPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getOwnPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.SEARCH_PLAYLISTS) && this.search.getPlaylistSearchResults().size() > playlistNumber) { selectedPlaylist = this.search.getPlaylistSearchResults().get(playlistNumber); } if (selectedPlaylist != null) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = selectedPlaylist.getUri(); } else { this.spotifyAPICalls.playListFromUri(selectedPlaylist.getUri()); } return selectedPlaylist; } this.logger.warn(ITME_NOT_FOUND); return null; }  URI firstTimeInit(String clientID, String clientSecret); URI firstTimeInit(); void inputAuthCode(String authCode); PlaylistEntity play(); PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type); TrackEntity playTrack(int trackNumber); AlbumEntity playAlbum(int albumNumber); ArtistEntity playArtist(int artistNumber); boolean resume(); boolean pause(); boolean skip(); boolean back(); TrackEntity getCurrentSong(); int setVolume(String volumeString); int setVolume(int volume); int getVolume(); }
PlayerLogic { public PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type) { PlaylistEntity selectedPlaylist = null; if (type.equals(SearchTypes.FEATURED_PLAYLISTS) && this.search.getFeaturedPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getFeaturedPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.USER_PLAYLISTS) && this.search.getOwnPlaylists().size() > playlistNumber) { selectedPlaylist = this.search.getOwnPlaylists().get(playlistNumber); } else if (type.equals(SearchTypes.SEARCH_PLAYLISTS) && this.search.getPlaylistSearchResults().size() > playlistNumber) { selectedPlaylist = this.search.getPlaylistSearchResults().get(playlistNumber); } if (selectedPlaylist != null) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = selectedPlaylist.getUri(); } else { this.spotifyAPICalls.playListFromUri(selectedPlaylist.getUri()); } return selectedPlaylist; } this.logger.warn(ITME_NOT_FOUND); return null; }  URI firstTimeInit(String clientID, String clientSecret); URI firstTimeInit(); void inputAuthCode(String authCode); PlaylistEntity play(); PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type); TrackEntity playTrack(int trackNumber); AlbumEntity playAlbum(int albumNumber); ArtistEntity playArtist(int artistNumber); boolean resume(); boolean pause(); boolean skip(); boolean back(); TrackEntity getCurrentSong(); int setVolume(String volumeString); int setVolume(int volume); int getVolume();  }