// create a HTTP client that always returns sampled scrobbled tracks from last.fm
HttpClient httpClient = mock(HttpClient.class);
ClientConnectionManager connectionManager = mock(ClientConnectionManager.class);
when(httpClient.getConnectionManager()).thenReturn(connectionManager);
String httpResponse = new ResourceUtil(SCROBBLED_TRACKS).getContent();
when(httpClient.execute(Mockito.any(HttpUriRequest.class),
Mockito.any(ResponseHandler.class))).thenReturn(httpResponse);
// create a client out of the components above
ScrobbledTracksClient stClient = new ScrobbledTracksClient();
stClient.setWebserviceHistoryService(historyService);