Search in sources :

Example 1 with LastFmDao

use of com.github.hakko.musiccabinet.dao.LastFmDao in project musiccabinet by hakko.

the class UserRecommendedArtistsClientTest method validateParameters.

@Test
public void validateParameters() throws ApplicationException {
    final String method = UserRecommendedArtistsClient.METHOD;
    final String lastFmUser = "arnathalon";
    final String sessionKey = "sessionkey";
    UserRecommendedArtistsClient client = new UserRecommendedArtistsClient() {

        @Override
        protected WSResponse executeWSRequest(WebserviceInvocation wi, List<NameValuePair> params) throws ApplicationException {
            Assert.assertEquals(Calltype.USER_GET_RECOMMENDED_ARTISTS, wi.getCallType());
            assertHasParameter(params, PARAM_METHOD, method);
            assertHasParameter(params, PARAM_LIMIT, "100");
            assertHasParameter(params, PARAM_SK, sessionKey);
            return null;
        }
    };
    client.setWebserviceHistoryService(Mockito.mock(WebserviceHistoryService.class));
    LastFmDao dao = Mockito.mock(LastFmDao.class);
    Mockito.when(dao.getLastFmUser(Mockito.anyString())).thenReturn(new LastFmUser(lastFmUser, sessionKey));
    client.setLastFmDao(dao);
    client.getUserRecommendedArtists(lastFmUser);
}
Also used : WebserviceHistoryService(com.github.hakko.musiccabinet.service.lastfm.WebserviceHistoryService) LastFmUser(com.github.hakko.musiccabinet.domain.model.library.LastFmUser) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation) List(java.util.List) LastFmDao(com.github.hakko.musiccabinet.dao.LastFmDao) Test(org.junit.Test)

Aggregations

LastFmDao (com.github.hakko.musiccabinet.dao.LastFmDao)1 LastFmUser (com.github.hakko.musiccabinet.domain.model.library.LastFmUser)1 WebserviceInvocation (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)1 WebserviceHistoryService (com.github.hakko.musiccabinet.service.lastfm.WebserviceHistoryService)1 List (java.util.List)1 Test (org.junit.Test)1