1313import spotify .api .enums .AlbumType ;
1414import spotify .exceptions .HttpRequestFailedException ;
1515import spotify .exceptions .SpotifyActionFailedException ;
16+ import spotify .models .albums .AlbumSimplified ;
1617import spotify .models .artists .ArtistFull ;
1718import spotify .models .artists .ArtistFullCollection ;
18- import spotify .models .artists .ArtistSimplified ;
1919import spotify .models .paging .Paging ;
2020import spotify .models .tracks .TrackFullCollection ;
2121import spotify .retrofit .services .ArtistService ;
@@ -50,7 +50,7 @@ public class ArtistApiRetrofitTest extends AbstractApiRetrofitTest {
5050 @ Mock
5151 private Call <ArtistFullCollection > mockedArtistFullCollectionCall ;
5252 @ Mock
53- private Call <Paging <ArtistSimplified >> mockedPagingArtistSimplifiedCall ;
53+ private Call <Paging <AlbumSimplified >> mockedPagingAlbumSimplifiedCall ;
5454 @ Mock
5555 private Call <TrackFullCollection > mockedTrackFullCollectionCall ;
5656
@@ -61,14 +61,14 @@ void setup() {
6161 sut = new ArtistApiRetrofit (fakeAccessToken , mockedArtistService );
6262
6363 when (mockedArtistService .getArtist (fakeAccessTokenWithBearer , fakeArtistId )).thenReturn (mockedArtistFullCall );
64- when (mockedArtistService .getArtistAlbums (fakeAccessTokenWithBearer , fakeArtistId , fakeOptionalParameters )).thenReturn (mockedPagingArtistSimplifiedCall );
64+ when (mockedArtistService .getArtistAlbums (fakeAccessTokenWithBearer , fakeArtistId , fakeOptionalParameters )).thenReturn (mockedPagingAlbumSimplifiedCall );
6565 when (mockedArtistService .getArtistTopTracks (fakeAccessTokenWithBearer , fakeArtistId , fakeOptionalParameters )).thenReturn (mockedTrackFullCollectionCall );
6666 when (mockedArtistService .getRelatedArtists (fakeAccessTokenWithBearer , fakeArtistId )).thenReturn (mockedArtistFullCollectionCall );
6767 when (mockedArtistService .getArtists (fakeAccessTokenWithBearer , fakeArtistIds )).thenReturn (mockedArtistFullCollectionCall );
6868
6969 when (mockedArtistFullCall .request ()).thenReturn (new Request .Builder ().url (fakeUrl ).build ());
7070 when (mockedArtistFullCollectionCall .request ()).thenReturn (new Request .Builder ().url (fakeUrl ).build ());
71- when (mockedPagingArtistSimplifiedCall .request ()).thenReturn (new Request .Builder ().url (fakeUrl ).build ());
71+ when (mockedPagingAlbumSimplifiedCall .request ()).thenReturn (new Request .Builder ().url (fakeUrl ).build ());
7272 when (mockedTrackFullCollectionCall .request ()).thenReturn (new Request .Builder ().url (fakeUrl ).build ());
7373 }
7474
@@ -118,8 +118,8 @@ void getArtistReturnsArtistFullWhenSuccessful() throws IOException {
118118
119119 @ Test
120120 void getArtistAlbumsUsesCorrectValuesToCreateHttpCall () throws IOException {
121- when (mockedArtistService .getArtistAlbums (fakeAccessTokenWithBearer , fakeArtistId , fakeOptionalParameterWithAlbumTypes )).thenReturn (mockedPagingArtistSimplifiedCall );
122- when (mockedPagingArtistSimplifiedCall .execute ()).thenReturn (Response .success (new Paging <>()));
121+ when (mockedArtistService .getArtistAlbums (fakeAccessTokenWithBearer , fakeArtistId , fakeOptionalParameterWithAlbumTypes )).thenReturn (mockedPagingAlbumSimplifiedCall );
122+ when (mockedPagingAlbumSimplifiedCall .execute ()).thenReturn (Response .success (new Paging <>()));
123123
124124 sut .getArtistAlbums (fakeArtistId , listOfFakeAlbumType , null );
125125
@@ -128,15 +128,15 @@ void getArtistAlbumsUsesCorrectValuesToCreateHttpCall() throws IOException {
128128
129129 @ Test
130130 void getArtistAlbumsExecutesHttpCall () throws IOException {
131- when (mockedPagingArtistSimplifiedCall .execute ()).thenReturn (Response .success (new Paging <>()));
131+ when (mockedPagingAlbumSimplifiedCall .execute ()).thenReturn (Response .success (new Paging <>()));
132132
133133 sut .getArtistAlbums (fakeArtistId , listOfFakeAlbumType , fakeOptionalParameters );
134- verify (mockedPagingArtistSimplifiedCall ).execute ();
134+ verify (mockedPagingAlbumSimplifiedCall ).execute ();
135135 }
136136
137137 @ Test
138138 void getArtistAlbumsThrowsSpotifyActionFailedExceptionWhenError () throws IOException {
139- when (mockedPagingArtistSimplifiedCall .execute ())
139+ when (mockedPagingAlbumSimplifiedCall .execute ())
140140 .thenReturn (
141141 Response .error (
142142 400 ,
@@ -149,14 +149,14 @@ void getArtistAlbumsThrowsSpotifyActionFailedExceptionWhenError() throws IOExcep
149149
150150 @ Test
151151 void getArtistAlbumsThrowsHttpRequestFailedWhenHttpFails () throws IOException {
152- when (mockedPagingArtistSimplifiedCall .execute ()).thenThrow (IOException .class );
152+ when (mockedPagingAlbumSimplifiedCall .execute ()).thenThrow (IOException .class );
153153
154154 Assertions .assertThrows (HttpRequestFailedException .class , () -> sut .getArtistAlbums (fakeArtistId , listOfFakeAlbumType , fakeOptionalParameters ));
155155 }
156156
157157 @ Test
158- void getArtistAlbumsReturnsPagingArtistSimplifiedWhenSuccessful () throws IOException {
159- when (mockedPagingArtistSimplifiedCall .execute ()).thenReturn (Response .success (new Paging <>()));
158+ void getArtistAlbumsReturnsPagingAlbumSimplifiedWhenSuccessful () throws IOException {
159+ when (mockedPagingAlbumSimplifiedCall .execute ()).thenReturn (Response .success (new Paging <>()));
160160
161161 Assertions .assertNotNull (sut .getArtistAlbums (fakeArtistId , listOfFakeAlbumType , fakeOptionalParameters ));
162162 }
0 commit comments