@Test void playTrackSearch() { List<TrackEntity> trackList = new ArrayList<>(); trackList.add(new TrackEntity()); when(this.search.getTrackSearchResults()).thenReturn(trackList); assertThat(this.playerLogic.playTrack(0), equalTo(trackList.get(0))); assertThat(this.playerLogic.playTrack(1), equalTo(null)); }
public TrackEntity playTrack(int trackNumber) { if (this.search.getTrackSearchResults().size() > trackNumber) { if (this.suppressed) { this.trackUriToPlay = this.search.getTrackSearchResults().get(trackNumber).getUri(); this.postSuppressionAction = PostSuppressionAction.PLAY_TRACK; } else { this.spotifyAPICalls.playSongFromUri(this.search.getTrackSearchResults().get(trackNumber).getUri()); } return this.search.getTrackSearchResults().get(trackNumber); } this.logger.warn(ITME_NOT_FOUND); return null; }
PlayerLogic { public TrackEntity playTrack(int trackNumber) { if (this.search.getTrackSearchResults().size() > trackNumber) { if (this.suppressed) { this.trackUriToPlay = this.search.getTrackSearchResults().get(trackNumber).getUri(); this.postSuppressionAction = PostSuppressionAction.PLAY_TRACK; } else { this.spotifyAPICalls.playSongFromUri(this.search.getTrackSearchResults().get(trackNumber).getUri()); } return this.search.getTrackSearchResults().get(trackNumber); } this.logger.warn(ITME_NOT_FOUND); return null; } }
PlayerLogic { public TrackEntity playTrack(int trackNumber) { if (this.search.getTrackSearchResults().size() > trackNumber) { if (this.suppressed) { this.trackUriToPlay = this.search.getTrackSearchResults().get(trackNumber).getUri(); this.postSuppressionAction = PostSuppressionAction.PLAY_TRACK; } else { this.spotifyAPICalls.playSongFromUri(this.search.getTrackSearchResults().get(trackNumber).getUri()); } return this.search.getTrackSearchResults().get(trackNumber); } this.logger.warn(ITME_NOT_FOUND); return null; }  }
PlayerLogic { public TrackEntity playTrack(int trackNumber) { if (this.search.getTrackSearchResults().size() > trackNumber) { if (this.suppressed) { this.trackUriToPlay = this.search.getTrackSearchResults().get(trackNumber).getUri(); this.postSuppressionAction = PostSuppressionAction.PLAY_TRACK; } else { this.spotifyAPICalls.playSongFromUri(this.search.getTrackSearchResults().get(trackNumber).getUri()); } return this.search.getTrackSearchResults().get(trackNumber); } 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 TrackEntity playTrack(int trackNumber) { if (this.search.getTrackSearchResults().size() > trackNumber) { if (this.suppressed) { this.trackUriToPlay = this.search.getTrackSearchResults().get(trackNumber).getUri(); this.postSuppressionAction = PostSuppressionAction.PLAY_TRACK; } else { this.spotifyAPICalls.playSongFromUri(this.search.getTrackSearchResults().get(trackNumber).getUri()); } return this.search.getTrackSearchResults().get(trackNumber); } 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();  }