### Question:
HotParameterLeapArray extends LeapArray<ParamMapBucket> { public long getRollingSum(RollingParamEvent event, Object value) { currentWindow(); long sum = 0; List<ParamMapBucket> buckets = this.values(); for (ParamMapBucket b : buckets) { sum += b.get(event, value); } return sum; } 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 testGetRollingSum() { HotParameterLeapArray leapArray = mock(HotParameterLeapArray.class); String v1 = "a", v2 = "B", v3 = "Cc"; int p1a = 19, p1b = 3; int p2a = 6, p2c = 17; RollingParamEvent passEvent = RollingParamEvent.REQUEST_PASSED; final ParamMapBucket b1 = new ParamMapBucket() .add(passEvent, p1a, v1) .add(passEvent, p1b, v2); final ParamMapBucket b2 = new ParamMapBucket() .add(passEvent, p2a, v1) .add(passEvent, p2c, v3); List<ParamMapBucket> buckets = new ArrayList<ParamMapBucket>() {{ add(b1); add(b2); }}; when(leapArray.values()).thenReturn(buckets); when(leapArray.getRollingSum(any(RollingParamEvent.class), any(Object.class))).thenCallRealMethod(); assertEquals(p1a + p2a, leapArray.getRollingSum(passEvent, v1)); assertEquals(p1b, leapArray.getRollingSum(passEvent, v2)); assertEquals(p2c, leapArray.getRollingSum(passEvent, v3)); }