### Question:
StatServiceImpl implements QueueCallBackHandler, ServiceChangedEventChannel { public long lastFiveSecondCount(String name) { return oneMinuteOfStats(name).countLastFiveSeconds(now); } StatServiceImpl(final StatRecorder recorder,
                           final StatReplicator replica,
                           final Timer timer,
                           final ServiceDiscovery serviceDiscovery,
                           final String serviceId,
                           final int numStats,
                           final long timeToLiveCheckInterval); void recordCount(String name, long count); void recordLevel(String name, long count); void recordTiming(String name, long duration); void increment(String name); void incrementAll(final String... names); Stats statsForLastSeconds(String name, int secondCount); long averageLastLevel(String name, int secondCount); long currentMinuteCount(String name); long lastTenSecondCount(String name); long lastFiveSecondCount(String name); long lastNSecondsCount(String name, int secondCount); long lastNSecondsCountExact(String name, int secondCount); long lastTenSecondCountExact(String name); long lastFiveSecondCountExact(String name); long currentSecondCount(String name); long lastSecondCount(String name); void recordCountWithTime(String name, long count, long now); void recordTimingWithTime(String name, long duration, long now); void recordLevelWithTime(String name, long level, long now); void replicateCount(String name, long count, long time); void replicateLevel(String name, long level, long time); void recordAll(final long timestamp,
                          final String[] names,
                          final long[] counts); void recordAllWithTimes(
            final String[] names,
            final long[] counts,
            final long[] times); void queueLimit(); void queueEmpty(); void tick(); long lastMinuteCount(String name); @Override void servicePoolChanged(String serviceName);  }### Answer:
@Test public void lastFiveSecondCountTest() throws Exception { for (int index = 0; index < 20; index++) { statServiceImpl.recordCount("mystat", 1); statServiceImpl.tick(); testTimer.seconds(1); } testTimer.seconds(-2); statServiceImpl.tick(); long count = statServiceImpl.lastFiveSecondCount("mystat"); assertEquals(5, count); }