CheckpointStatsCounts implements Serializable { CheckpointStatsCounts createSnapshot() { return new CheckpointStatsCounts( numRestoredCheckpoints, numTotalCheckpoints, numInProgressCheckpoints, numCompletedCheckpoints, numFailedCheckpoints); } CheckpointStatsCounts(); private  CheckpointStatsCounts(
			long numRestoredCheckpoints,
			long numTotalCheckpoints,
			int numInProgressCheckpoints,
			long numCompletedCheckpoints,
			long numFailedCheckpoints); long getNumberOfRestoredCheckpoints(); long getTotalNumberOfCheckpoints(); int getNumberOfInProgressCheckpoints(); long getNumberOfCompletedCheckpoints(); long getNumberOfFailedCheckpoints();  }
@Test public void testCreateSnapshot() throws Exception { CheckpointStatsCounts counts = new CheckpointStatsCounts(); counts.incrementRestoredCheckpoints(); counts.incrementRestoredCheckpoints(); counts.incrementRestoredCheckpoints(); counts.incrementInProgressCheckpoints(); counts.incrementCompletedCheckpoints(); counts.incrementInProgressCheckpoints(); counts.incrementCompletedCheckpoints(); counts.incrementInProgressCheckpoints(); counts.incrementCompletedCheckpoints(); counts.incrementInProgressCheckpoints(); counts.incrementCompletedCheckpoints(); counts.incrementInProgressCheckpoints(); counts.incrementFailedCheckpoints(); long restored = counts.getNumberOfRestoredCheckpoints(); long total = counts.getTotalNumberOfCheckpoints(); long inProgress = counts.getNumberOfInProgressCheckpoints(); long completed = counts.getNumberOfCompletedCheckpoints(); long failed = counts.getNumberOfFailedCheckpoints(); CheckpointStatsCounts snapshot = counts.createSnapshot(); assertEquals(restored, snapshot.getNumberOfRestoredCheckpoints()); assertEquals(total, snapshot.getTotalNumberOfCheckpoints()); assertEquals(inProgress, snapshot.getNumberOfInProgressCheckpoints()); assertEquals(completed, snapshot.getNumberOfCompletedCheckpoints()); assertEquals(failed, snapshot.getNumberOfFailedCheckpoints()); counts.incrementRestoredCheckpoints(); counts.incrementRestoredCheckpoints(); counts.incrementInProgressCheckpoints(); counts.incrementCompletedCheckpoints(); counts.incrementInProgressCheckpoints(); counts.incrementFailedCheckpoints(); assertEquals(restored, snapshot.getNumberOfRestoredCheckpoints()); assertEquals(total, snapshot.getTotalNumberOfCheckpoints()); assertEquals(inProgress, snapshot.getNumberOfInProgressCheckpoints()); assertEquals(completed, snapshot.getNumberOfCompletedCheckpoints()); assertEquals(failed, snapshot.getNumberOfFailedCheckpoints()); }