RouterMetrics { public void succeededAppsCreated(long duration) { totalSucceededAppsCreated.add(duration); getNewApplicationLatency.add(duration); } private  RouterMetrics(); static RouterMetrics getMetrics(); @VisibleForTesting long getNumSucceededAppsCreated(); @VisibleForTesting long getNumSucceededAppsSubmitted(); @VisibleForTesting long getNumSucceededAppsKilled(); @VisibleForTesting long getNumSucceededAppsRetrieved(); @VisibleForTesting long getNumSucceededMultipleAppsRetrieved(); @VisibleForTesting double getLatencySucceededAppsCreated(); @VisibleForTesting double getLatencySucceededAppsSubmitted(); @VisibleForTesting double getLatencySucceededAppsKilled(); @VisibleForTesting double getLatencySucceededGetAppReport(); @VisibleForTesting double getLatencySucceededMultipleGetAppReport(); @VisibleForTesting int getAppsFailedCreated(); @VisibleForTesting int getAppsFailedSubmitted(); @VisibleForTesting int getAppsFailedKilled(); @VisibleForTesting int getAppsFailedRetrieved(); @VisibleForTesting int getMultipleAppsFailedRetrieved(); void succeededAppsCreated(long duration); void succeededAppsSubmitted(long duration); void succeededAppsKilled(long duration); void succeededAppsRetrieved(long duration); void succeededMultipleAppsRetrieved(long duration); void incrAppsFailedCreated(); void incrAppsFailedSubmitted(); void incrAppsFailedKilled(); void incrAppsFailedRetrieved(); void incrMultipleAppsFailedRetrieved();  }
@Test public void testSucceededAppsCreated() { long totalGoodBefore = metrics.getNumSucceededAppsCreated(); goodSubCluster.getNewApplication(100); Assert.assertEquals(totalGoodBefore + 1, metrics.getNumSucceededAppsCreated()); Assert.assertEquals(100, metrics.getLatencySucceededAppsCreated(), 0); goodSubCluster.getNewApplication(200); Assert.assertEquals(totalGoodBefore + 2, metrics.getNumSucceededAppsCreated()); Assert.assertEquals(150, metrics.getLatencySucceededAppsCreated(), 0); }