CounterStatistic extends Counter { public void performAction(int action) { if (action==HasStatistics.STATISTICS_ACTION_FULL || action==HasStatistics.STATISTICS_ACTION_SUMMARY) { return; } if (action==HasStatistics.STATISTICS_ACTION_RESET) { clear(); } if (action==HasStatistics.STATISTICS_ACTION_MARK_FULL || action==HasStatistics.STATISTICS_ACTION_MARK_MAIN) { synchronized (this) { mark=getValue(); } } } CounterStatistic(int startValue); void performAction(int action); synchronized long getIntervalValue(); synchronized void clear();  }
@Test public void testPerformActionSummaryOrFull() throws Exception { CounterStatistic cs = new CounterStatistic(10); cs.performAction(HasStatistics.STATISTICS_ACTION_SUMMARY); assertEquals(10, cs.getValue()); }
@Test public void testPerformActionReset() throws Exception { CounterStatistic cs = new CounterStatistic(10); cs.performAction(HasStatistics.STATISTICS_ACTION_RESET); assertEquals(0, cs.getValue()); }
@Test public void testPerformActionMarkMain() throws Exception { CounterStatistic cs = new CounterStatistic(10); cs.performAction(HasStatistics.STATISTICS_ACTION_MARK_MAIN); assertEquals( 10, cs.getValue()); }
@Test public void testPerformActionMarkFull() throws Exception { CounterStatistic cs = new CounterStatistic(10); cs.performAction(HasStatistics.STATISTICS_ACTION_MARK_FULL); assertEquals( 10, cs.getValue()); }