@Test void testCurrentSong() { when(this.spotifyAPICalls.getCurrentPlayingContext()).thenReturn(this.currentlyPlayingContext); when(this.search.createTrackData(any())).thenCallRealMethod(); TrackEntity track = this.playerLogic.getCurrentSong(); assertThat(track.getUri(), equalTo(ID1)); }
public TrackEntity getCurrentSong() { CurrentlyPlayingContext currentlyPlayingContext = this.spotifyAPICalls.getCurrentPlayingContext(); if (currentlyPlayingContext != null && currentlyPlayingContext.getItem() != null) { Track[] track = { currentlyPlayingContext.getItem() }; return this.search.createTrackData(new Paging.Builder<Track>().setItems(track).build()).get(0); } return null; }
PlayerLogic { public TrackEntity getCurrentSong() { CurrentlyPlayingContext currentlyPlayingContext = this.spotifyAPICalls.getCurrentPlayingContext(); if (currentlyPlayingContext != null && currentlyPlayingContext.getItem() != null) { Track[] track = { currentlyPlayingContext.getItem() }; return this.search.createTrackData(new Paging.Builder<Track>().setItems(track).build()).get(0); } return null; } }
PlayerLogic { public TrackEntity getCurrentSong() { CurrentlyPlayingContext currentlyPlayingContext = this.spotifyAPICalls.getCurrentPlayingContext(); if (currentlyPlayingContext != null && currentlyPlayingContext.getItem() != null) { Track[] track = { currentlyPlayingContext.getItem() }; return this.search.createTrackData(new Paging.Builder<Track>().setItems(track).build()).get(0); } return null; }  }
PlayerLogic { public TrackEntity getCurrentSong() { CurrentlyPlayingContext currentlyPlayingContext = this.spotifyAPICalls.getCurrentPlayingContext(); if (currentlyPlayingContext != null && currentlyPlayingContext.getItem() != null) { Track[] track = { currentlyPlayingContext.getItem() }; return this.search.createTrackData(new Paging.Builder<Track>().setItems(track).build()).get(0); } 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 getCurrentSong() { CurrentlyPlayingContext currentlyPlayingContext = this.spotifyAPICalls.getCurrentPlayingContext(); if (currentlyPlayingContext != null && currentlyPlayingContext.getItem() != null) { Track[] track = { currentlyPlayingContext.getItem() }; return this.search.createTrackData(new Paging.Builder<Track>().setItems(track).build()).get(0); } 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();  }