@Test
public void testGetMetrics() throws IOException {

	MetricQuery metricQuery = new MetricQuery("scope1", "metric1", null, 1557809359L, 1557809599L);
	metricQuery.setTag("topic", "topic");
	metricQuery.setDownsampler(MetricQuery.Aggregator.MAX);
	metricQuery.setDownsamplingPeriod(5 * 60 * 1000L);
	List<MetricQuery> queries = new ArrayList<>();
	queries.add(metricQuery);
	ElasticSearchConsumerOffsetMetricsService spyService = _initializeSpyService(esConsumerOffsetMetricsService, getReply, false);
	Map<MetricQuery, List<Metric>> metricsResult = spyService.getMetrics(queries);
	String expectedMetric =
			"[namespace=>null, scope=>ajna.consumer, metric=>metric.consumer.lag, tags=>{topic=mytopic1.name}, datapoints=>{1560902400000=21455.0, 1561075200000=21981.0, 1561248000000=22461.0}, " +
			"namespace=>null, scope=>ajna.consumer, metric=>metric.consumer.lag, tags=>{topic=mytopic2.name}, datapoints=>{1560902400000=19676.0, 1561075200000=21635.0, 1561248000000=22659.0}]";
	assertEquals(expectedMetric, metricsResult.get(metricQuery).toString());
	ArgumentCaptor<Request> requestCaptor = ArgumentCaptor.forClass(Request.class);
	verify(restClient, times(1)).performRequest(requestCaptor.capture());
	Request capturedRequest = requestCaptor.getValue();
	String queryJson = convertToPrettyJson(EntityUtils.toString(capturedRequest.getEntity()));
	assertEquals(queryMustTermRange, queryJson);
	String expectedURL = "/argus-akc-consumer-offset-*/_search";
	assertEquals(expectedURL, capturedRequest.getEndpoint());
}