use of com.github.hakko.musiccabinet.ws.lastfm.TagUpdateClient in project musiccabinet by hakko.
the class TagUpdateServiceTest method updatesWithinThresholdsAreIgnored.
@Test
public void updatesWithinThresholdsAreIgnored() throws ApplicationException {
ArtistTopTagsDao artistTopTagsDao = mock(ArtistTopTagsDao.class);
tagUpdateService.setArtistTopTagsDao(artistTopTagsDao);
setClientResponse(responseOK);
TagUpdateClient tagUpdateClient = tagUpdateService.tagUpdateClient;
WebserviceHistoryService historyService = mock(WebserviceHistoryService.class);
tagUpdateService.setWebserviceHistoryService(historyService);
tagUpdateService.register(artist1Addition);
tagUpdateService.register(artist2Removal);
tagUpdateService.register(artist3Addition);
tagUpdateService.updateTags();
verify(tagUpdateClient, times(1)).updateTag(artist1Addition);
verify(tagUpdateClient, times(1)).updateTag(artist2Removal);
verify(tagUpdateClient, times(0)).updateTag(artist3Addition);
}
use of com.github.hakko.musiccabinet.ws.lastfm.TagUpdateClient in project musiccabinet by hakko.
the class TagUpdateServiceTest method setClientResponse.
private void setClientResponse(WSResponse response) throws ApplicationException {
TagUpdateClient tagUpdateClient = mock(TagUpdateClient.class);
when(tagUpdateClient.updateTag(any(ArtistUserTag.class))).thenReturn(response);
tagUpdateService.setTagUpdateClient(tagUpdateClient);
}
Aggregations