@Test void playAlbumSearch() { List<AlbumEntity> albumList = new ArrayList<>(); albumList.add(new AlbumEntity()); when(this.search.getAlbumSearchResults()).thenReturn(albumList); assertThat(this.playerLogic.playAlbum(0), equalTo(albumList.get(0))); assertThat(this.playerLogic.playAlbum(1), equalTo(null)); }
public AlbumEntity playAlbum(int albumNumber) { if (this.search.getAlbumSearchResults().size() > albumNumber) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = this.search.getAlbumSearchResults().get(albumNumber).getUri(); } else { this.spotifyAPICalls.playListFromUri(this.search.getAlbumSearchResults().get(albumNumber).getUri()); } return this.search.getAlbumSearchResults().get(albumNumber); } this.logger.warn(ITME_NOT_FOUND); return null; }
PlayerLogic { public AlbumEntity playAlbum(int albumNumber) { if (this.search.getAlbumSearchResults().size() > albumNumber) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = this.search.getAlbumSearchResults().get(albumNumber).getUri(); } else { this.spotifyAPICalls.playListFromUri(this.search.getAlbumSearchResults().get(albumNumber).getUri()); } return this.search.getAlbumSearchResults().get(albumNumber); } this.logger.warn(ITME_NOT_FOUND); return null; } }
PlayerLogic { public AlbumEntity playAlbum(int albumNumber) { if (this.search.getAlbumSearchResults().size() > albumNumber) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = this.search.getAlbumSearchResults().get(albumNumber).getUri(); } else { this.spotifyAPICalls.playListFromUri(this.search.getAlbumSearchResults().get(albumNumber).getUri()); } return this.search.getAlbumSearchResults().get(albumNumber); } this.logger.warn(ITME_NOT_FOUND); return null; }  }
PlayerLogic { public AlbumEntity playAlbum(int albumNumber) { if (this.search.getAlbumSearchResults().size() > albumNumber) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = this.search.getAlbumSearchResults().get(albumNumber).getUri(); } else { this.spotifyAPICalls.playListFromUri(this.search.getAlbumSearchResults().get(albumNumber).getUri()); } return this.search.getAlbumSearchResults().get(albumNumber); } 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 AlbumEntity playAlbum(int albumNumber) { if (this.search.getAlbumSearchResults().size() > albumNumber) { if (this.suppressed) { this.postSuppressionAction = PostSuppressionAction.PLAY_COLLECTION; this.collectionUriToPlay = this.search.getAlbumSearchResults().get(albumNumber).getUri(); } else { this.spotifyAPICalls.playListFromUri(this.search.getAlbumSearchResults().get(albumNumber).getUri()); } return this.search.getAlbumSearchResults().get(albumNumber); } 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();  }