@Test
public void getMetricsWithStreamAggregation() throws Exception {

    stubMetricUrl();
    String topologyName = "testTopology";
    String componentId = "testComponent";
    // this is one of metric which needs stream aggregation
    String metricName = "__complete-latency";
    TimeSeriesQuerier.AggregateFunction aggrFunction = TimeSeriesQuerier.AggregateFunction.AVG;
    long from = 1234000L;
    long to = 5678000L;
    Map<Long, Double> metrics = querier.getMetrics(topologyName, componentId, metricName, aggrFunction, from, to);
    assertResult(metrics);
    verify(getRequestedFor(urlPathEqualTo(TEST_RENDER_API_PATH))
            .withQueryParam("target", equalTo("averageSeries(storm.testTopology.testComponent.*.*.*.*.*.*.__complete-latency.*)"))
            .withQueryParam("format", equalTo("json"))
            .withQueryParam("from", equalTo("1234"))
            .withQueryParam("until", equalTo("5678")));
}