@Test public void testGetTopologySummary() { ClusterSummary cs = mock(ClusterSummary.class); TopologySummary ts = mock(TopologySummary.class); String tsName = "benchmarks"; String fakeName = "fake"; when(cs.get_topologies()).thenReturn(Lists.newArrayList(ts)); when(ts.get_name()).thenReturn(tsName); assertThat(MetricsUtils.getTopologySummary(cs, tsName)).isEqualTo(ts); assertThat(MetricsUtils.getTopologySummary(cs, fakeName)).isNull(); }
@Test public void testAddLatency() { Map<String, List<Double>> stats = Maps.newHashMap(); String id = "spout"; double lat = 0.01; MetricsUtils.addLatency(stats, id, lat); assertThat(stats).containsKey(id); assertThat(stats.get(id)).isNotNull().contains(lat); }
@Probe private Map mapMethod() { return MetricsUtils.createMap(10); }