### Question:
InitStat { public void recordInit(long initTime) { if (initTime >= 0) { initCount.increment(); totalInitTime.add(initTime); } } private  InitStat(); static InitStat create(); void recordInit(long initTime); long getInitCount(); long getTotalInitTime();  }### Answer:
@Test public void testRecordInit() throws Exception { InitStat stat = InitStat.create(); long a = 1000; long b = 500; stat.recordInit(a); assertThat(stat.getInitCount(), equalTo(1L)); assertThat(stat.getTotalInitTime(), equalTo(a)); stat.recordInit(b); assertThat(stat.getInitCount(), equalTo(2L)); assertThat(stat.getTotalInitTime(), equalTo(a + b)); }