ApdexMetrics extends Metrics implements IntValueHolder { @Entrance public final void combine(@SourceFrom int value, @Arg String name, @Arg boolean status) { int t = DICT.lookup(name).intValue(); int t4 = t * 4; totalNum++; if (!status || value >= t4) { return; } if (value >= t) { tNum++; } else { sNum++; } }  @Entrance final void combine(@SourceFrom int value, @Arg String name, @Arg boolean status); @Override final void combine(Metrics metrics); @Override void calculate(); @Override int getValue();  }
@Test public void testCombine() { ApdexMetrics apdex1 = new ApdexMetricsImpl(); apdex1.combine(200, "foo", true); apdex1.combine(300, "bar", true); apdex1.combine(200, "foo", true); apdex1.combine(1500, "bar", true); ApdexMetrics apdex2 = new ApdexMetricsImpl(); apdex2.combine(200, "foo", true); apdex2.combine(300, "bar", false); apdex2.combine(200, "foo", true); apdex2.combine(1500, "bar", false); apdex2.combine(200, "foo", true); apdex2.combine(5000, "bar", true); apdex1.combine(apdex2); apdex1.calculate(); assertThat(apdex1.getValue(), is(6500)); }