### Question:
ActivityClient { public List<Query> retrieveQueries() { HttpGet get = new HttpGet(queryUrl); try { CloseableHttpResponse response = httpClient.execute(get); String body = EntityUtils.toString(response.getEntity()); LOGGER.debug("Received response {}", body); Query[] queries = (Query[]) gson.fromJson(body, (Class) Query[].class); LOGGER.debug("Parsed queries {}", Arrays.toString(queries)); return Arrays.asList(queries); } catch (IOException e) { LOGGER.info(REQUEST_FOR_QUERIES_FAILED, e); throw new ActivityRequestFailed(REQUEST_FOR_QUERIES_FAILED, e); } } private  ActivityClient(String host, int port, int socketTimeout); static ActivityClientBuilder builder(); List<Query> retrieveQueries(); List<Connection> retrieveConnections(); void clearConnections(); void clearQueries(); void clearPreparedStatementPreparations(); List<PreparedStatementPreparation> retrievePreparedStatementPreparations(); void clearPreparedStatementExecutions(); void clearAllRecordedActivity(); List<PreparedStatementExecution> retrievePreparedStatementExecutions(); List<BatchExecution> retrieveBatches(); void clearBatchExecutions();  }### Answer:
@Test public void testRetrievalOfZeroQueries() { stubFor(get(urlEqualTo(queryUrl)).willReturn(aResponse().withBody("[]"))); List<Query> queries = underTest.retrieveQueries(); assertEquals(0, queries.size()); }
@Test public void testRetrievalOfASingleQuery() { stubFor(get(urlEqualTo(queryUrl)).willReturn(aResponse().withBody("[{\"query\":\"select * from people\",\"consistency\":\"TWO\"}]"))); List<Query> queries = underTest.retrieveQueries(); assertEquals(1, queries.size()); assertEquals("select * from people", queries.get(0).getQuery()); assertEquals("TWO", queries.get(0).getConsistency()); assertEquals(null, queries.get(0).getSerialConsistency()); assertEquals(null, queries.get(0).getTimestamp()); }
@Test public void testRetrievalOfASingleQueryWithSerialCLAndTimestamp() { stubFor(get(urlEqualTo(queryUrl)).willReturn(aResponse().withBody("[{\"query\":\"select * from people\",\"consistency\":\"TWO\", \"serialConsistency\":\"LOCAL_SERIAL\", \"timestamp\": 8675309}]"))); List<Query> queries = underTest.retrieveQueries(); assertEquals(1, queries.size()); assertEquals("select * from people", queries.get(0).getQuery()); assertEquals("TWO", queries.get(0).getConsistency()); assertEquals("LOCAL_SERIAL", queries.get(0).getSerialConsistency()); assertEquals(new Long(8675309), queries.get(0).getTimestamp()); }
@Test(expected = ActivityRequestFailed.class) public void testErrorDuringQueryRetrieval() { stubFor(get(urlEqualTo(queryUrl)) .willReturn(aResponse().withFault(Fault.RANDOM_DATA_THEN_CLOSE))); underTest.retrieveQueries(); }