### Question:
HotParameterLeapArray extends LeapArray<ParamMapBucket> { public double getRollingAvg(RollingParamEvent event, Object value) { return ((double) getRollingSum(event, value)) / getIntervalInSecond(); } HotParameterLeapArray(int sampleCount, int intervalInMs); @Override ParamMapBucket newEmptyBucket(long timeMillis); void addValue(RollingParamEvent event, int count, Object value); Map<Object, Double> getTopValues(RollingParamEvent event, int number); long getRollingSum(RollingParamEvent event, Object value); double getRollingAvg(RollingParamEvent event, Object value);  }### Answer:
@Test public void testGetRollingAvg() { HotParameterLeapArray leapArray = mock(HotParameterLeapArray.class); when(leapArray.getRollingSum(any(RollingParamEvent.class), any(Object.class))).thenReturn(15L); when(leapArray.getIntervalInSecond()).thenReturn(1d) .thenReturn(2d); when(leapArray.getRollingAvg(any(RollingParamEvent.class), any(Object.class))).thenCallRealMethod(); assertEquals(15.0d, leapArray.getRollingAvg(RollingParamEvent.REQUEST_PASSED, "abc"), 0.001); assertEquals(15.0d / 2, leapArray.getRollingAvg(RollingParamEvent.REQUEST_PASSED, "abc"), 0.001); }