### Question:
OperationStore { double getAverageRate(CTSOperation operation) { final OperationMonitor monitor = operationRate.get(operation); return monitor == null ? 0.0 : monitor.getAverageRate(); } OperationStore();   OperationStore(final OperationRateFactory operationRateFactory,
            final Map<CTSOperation, OperationMonitor> operationRate);   }### Answer:
@Test public void shouldGetAverageRate() { CTSOperation operation = CTSOperation.CREATE; OperationMonitor opRate = mock(OperationMonitor.class); operationRate.put(operation, opRate); given(opRate.getAverageRate()).willReturn(1D); double result = operationStore.getAverageRate(operation); assertEquals(result, 1D); }
@Test public void getAverageRateShouldReturnZeroIfOperationNotSet() { CTSOperation operation = CTSOperation.CREATE; double result = operationStore.getAverageRate(operation); assertEquals(result, 0D); }