@Test public void shouldReportDurationOnFaultCatchFailures() throws Exception { when(mockTimer.stop()).thenReturn(32D); when(mockResult.isFault()).thenReturn(true); observer = new PerformanceMonitoringExecutionObserver(mockObserver, mockMonitor, mockTimer, true, "name", "operation"); observer.onResult(mockResult); verify(mockObserver).onResult(mockResult); verify(mockMonitor).addEvent("name", "operation", 32D, false); }
@Override public void onResult(ExecutionResult executionResult) { double duration = timer.stop(); if (catchFailures) { monitor.addEvent(name, operation, duration, !executionResult.isFault()); } else { monitor.addEvent(name, operation, duration); } delegate.onResult(executionResult); }
PerformanceMonitoringExecutionObserver implements ExecutionObserver { @Override public void onResult(ExecutionResult executionResult) { double duration = timer.stop(); if (catchFailures) { monitor.addEvent(name, operation, duration, !executionResult.isFault()); } else { monitor.addEvent(name, operation, duration); } delegate.onResult(executionResult); } }
PerformanceMonitoringExecutionObserver implements ExecutionObserver { @Override public void onResult(ExecutionResult executionResult) { double duration = timer.stop(); if (catchFailures) { monitor.addEvent(name, operation, duration, !executionResult.isFault()); } else { monitor.addEvent(name, operation, duration); } delegate.onResult(executionResult); } PerformanceMonitoringExecutionObserver(ExecutionObserver delegate, KPIMonitor monitor, KPITimer timer,
                                                  boolean catchFailures, String name, String operation); }
PerformanceMonitoringExecutionObserver implements ExecutionObserver { @Override public void onResult(ExecutionResult executionResult) { double duration = timer.stop(); if (catchFailures) { monitor.addEvent(name, operation, duration, !executionResult.isFault()); } else { monitor.addEvent(name, operation, duration); } delegate.onResult(executionResult); } PerformanceMonitoringExecutionObserver(ExecutionObserver delegate, KPIMonitor monitor, KPITimer timer,
                                                  boolean catchFailures, String name, String operation); @Override void onResult(ExecutionResult executionResult); }
PerformanceMonitoringExecutionObserver implements ExecutionObserver { @Override public void onResult(ExecutionResult executionResult) { double duration = timer.stop(); if (catchFailures) { monitor.addEvent(name, operation, duration, !executionResult.isFault()); } else { monitor.addEvent(name, operation, duration); } delegate.onResult(executionResult); } PerformanceMonitoringExecutionObserver(ExecutionObserver delegate, KPIMonitor monitor, KPITimer timer,
                                                  boolean catchFailures, String name, String operation); @Override void onResult(ExecutionResult executionResult);  }