@Test
public void getMetricsWithStreamAggregation() throws Exception {

    stubMetricUrl();
    String topologyName = "testTopology";
    String componentId = "testComponent";
    // this is one of metric which needs stream aggregation
    String metricName = "__emit-count";
    TimeSeriesQuerier.AggregateFunction aggrFunction = TimeSeriesQuerier.AggregateFunction.SUM;
    long from = 1234L;
    long to = 5678L;
    Map<Long, Double> metrics = querier.getMetrics(topologyName, componentId, metricName, aggrFunction, from, to);
    assertResult(metrics, aggrFunction);
    verify(getRequestedFor(urlPathEqualTo(TEST_COLLECTOR_API_PATH))
            .withQueryParam("appId", equalTo(DEFAULT_APP_ID))
            .withQueryParam("hostname", equalTo(""))
            .withQueryParam("metricNames", equalTo("topology.testTopology.testComponent.%.--emit-count.%"))
            .withQueryParam("startTime", equalTo("1234"))
            .withQueryParam("endTime", equalTo("5678")));
}