@Test void testSearchTrack() { when(this.spotifyAPICalls.searchInSpotify(SONG_NAME1, "track", 2)).thenReturn(this.tracks); List<TrackEntity> trackEntities = this.search.searchforTracks(SONG_NAME1, 2); TrackEntity trackEntity1 = trackEntities.get(0); TrackEntity TrackEntity2 = trackEntities.get(1); assertThat(trackEntity1.getName(), equalTo(SONG_NAME1)); assertThat(TrackEntity2.getName(), equalTo(SONG_NAME2)); assertThat(trackEntity1.getArtists()[0], equalTo(ARTIST_NAME1)); assertThat(TrackEntity2.getArtists()[0], equalTo(ARTIST_NAME2)); assertThat(trackEntity1.getUri(), equalTo(ID1)); assertThat(TrackEntity2.getUri(), equalTo(ID2)); assertThat(trackEntity1.getDurationInMs(), equalTo(DURATION1)); assertThat(TrackEntity2.getDurationInMs(), equalTo(DURATION2)); }
public List<TrackEntity> searchforTracks(String searchItem, int limit) { SearchResult searchResult = this.spotifyAPICalls.searchInSpotify(searchItem, "track", limit); if (searchResult != null) { this.trackSearchResults = createTrackData(searchResult.getTracks()); } else { this.trackSearchResults = new ArrayList<>(); } return this.trackSearchResults; }
Search { public List<TrackEntity> searchforTracks(String searchItem, int limit) { SearchResult searchResult = this.spotifyAPICalls.searchInSpotify(searchItem, "track", limit); if (searchResult != null) { this.trackSearchResults = createTrackData(searchResult.getTracks()); } else { this.trackSearchResults = new ArrayList<>(); } return this.trackSearchResults; } }
Search { public List<TrackEntity> searchforTracks(String searchItem, int limit) { SearchResult searchResult = this.spotifyAPICalls.searchInSpotify(searchItem, "track", limit); if (searchResult != null) { this.trackSearchResults = createTrackData(searchResult.getTracks()); } else { this.trackSearchResults = new ArrayList<>(); } return this.trackSearchResults; }  }
Search { public List<TrackEntity> searchforTracks(String searchItem, int limit) { SearchResult searchResult = this.spotifyAPICalls.searchInSpotify(searchItem, "track", limit); if (searchResult != null) { this.trackSearchResults = createTrackData(searchResult.getTracks()); } else { this.trackSearchResults = new ArrayList<>(); } return this.trackSearchResults; }  List<TrackEntity> searchforTracks(String searchItem, int limit); List<PlaylistEntity> searchforPlaylists(String searchItem, int limit); List<AlbumEntity> searchforAlbums(String searchItem, int limit); List<ArtistEntity> searchforArtists(String searchItem, int limit); List<TrackEntity> createTrackData(Paging<Track> searchResult); List<PlaylistEntity> searchOwnPlaylists(int limit); List<PlaylistEntity> searchFeaturedPlaylists(int limit); List<TrackEntity> getTrackSearchResults(); List<AlbumEntity> getAlbumSearchResults(); List<ArtistEntity> getArtistSearchResults(); List<PlaylistEntity> getPlaylistSearchResults(); List<PlaylistEntity> getFeaturedPlaylists(); List<PlaylistEntity> getOwnPlaylists(); }
Search { public List<TrackEntity> searchforTracks(String searchItem, int limit) { SearchResult searchResult = this.spotifyAPICalls.searchInSpotify(searchItem, "track", limit); if (searchResult != null) { this.trackSearchResults = createTrackData(searchResult.getTracks()); } else { this.trackSearchResults = new ArrayList<>(); } return this.trackSearchResults; }  List<TrackEntity> searchforTracks(String searchItem, int limit); List<PlaylistEntity> searchforPlaylists(String searchItem, int limit); List<AlbumEntity> searchforAlbums(String searchItem, int limit); List<ArtistEntity> searchforArtists(String searchItem, int limit); List<TrackEntity> createTrackData(Paging<Track> searchResult); List<PlaylistEntity> searchOwnPlaylists(int limit); List<PlaylistEntity> searchFeaturedPlaylists(int limit); List<TrackEntity> getTrackSearchResults(); List<AlbumEntity> getAlbumSearchResults(); List<ArtistEntity> getArtistSearchResults(); List<PlaylistEntity> getPlaylistSearchResults(); List<PlaylistEntity> getFeaturedPlaylists(); List<PlaylistEntity> getOwnPlaylists(); static final int SEARCH_LIMIT; }