use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class AlbumInfoClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = AlbumInfoClient.METHOD;
final String artistName = "The Beatles";
final String albumName = "Sergeant Pepper's Lonely Hearts Club Band";
new AlbumInfoClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
Assert.assertEquals(Calltype.ALBUM_GET_INFO, wi.getCallType());
Assert.assertTrue(albumName.equals(wi.getAlbum().getName()));
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_ARTIST, artistName);
assertHasParameter(params, PARAM_ALBUM, albumName);
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getAlbumInfo(new Album(artistName, albumName));
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class ArtistSimilarityClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = ArtistSimilarityClient.METHOD;
final String artistName = "madonna";
new ArtistSimilarityClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
Assert.assertEquals(Calltype.ARTIST_GET_SIMILAR, wi.getCallType());
Assert.assertTrue(artistName.equals(wi.getArtist().getName()));
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_ARTIST, artistName);
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getArtistSimilarity(new Artist(artistName));
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class ArtistTopTracksClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = ArtistTopTracksClient.METHOD;
final String artistName = "madonna";
new ArtistTopTracksClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
Assert.assertEquals(Calltype.ARTIST_GET_TOP_TRACKS, wi.getCallType());
Assert.assertTrue(artistName.equals(wi.getArtist().getName()));
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_ARTIST, artistName);
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getTopTracks(new Artist(artistName));
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class TagTopArtistsClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = TagTopArtistsClient.METHOD;
final Tag tag = new Tag(0, "sludge");
new TagTopArtistsClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
Assert.assertEquals(Calltype.TAG_GET_TOP_ARTISTS, wi.getCallType());
Assert.assertEquals(tag, wi.getTag());
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_TAG, tag.getName());
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getTopArtists(tag);
}
use of com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation in project musiccabinet by hakko.
the class TrackSimilarityClientTest method validateParameters.
@Test
public void validateParameters() throws ApplicationException {
final String method = TrackSimilarityClient.METHOD;
final String artistName = "madonna";
final String trackName = "ray of light";
new TrackSimilarityClient() {
@Override
protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
assertEquals(Calltype.TRACK_GET_SIMILAR, wi.getCallType());
assertTrue(trackName.equals(wi.getTrack().getName()));
assertTrue(artistName.equals(wi.getTrack().getArtist().getName()));
assertHasParameter(params, PARAM_METHOD, method);
assertHasParameter(params, PARAM_ARTIST, artistName);
assertHasParameter(params, PARAM_TRACK, trackName);
return null;
}
@Override
protected WebserviceHistoryService getHistoryService() {
return Mockito.mock(WebserviceHistoryService.class);
}
}.getTrackSimilarity(new Track(new Artist(artistName), trackName));
}
Aggregations