@Test public void doDetectionWithFiltering() { when(detectorContainer.getFilters()).thenReturn(ImmutableList.of(detectionFilter)); val filterChain = new DetectionFilterChain(detectorContainer); doAnswer(invocation -> { DetectorResponse response = invocation.getArgument(1); response.setDetectorResult(detectorResult); return null; }).when(detectionFilter).doFilter(any(DetectorRequest.class), any(DetectorResponse.class), any(DetectionFilterChain.class)); DetectorResult actualResult = executorUnderTest.doDetection(detectorContainer, metricData); assertSame(detectorResult, actualResult); }
@Override public DetectorResult doDetection(DetectorContainer detectorContainer, @NonNull MetricData metricData) { val detectionFilterChain = new DetectionFilterChain(detectorContainer); val request = new DetectorRequest(metricData); val response = new DetectorResponse(); detectionFilterChain.doFilter(request, response); return response.getDetectorResult(); }
DetectorExecutorImpl implements DetectorExecutor { @Override public DetectorResult doDetection(DetectorContainer detectorContainer, @NonNull MetricData metricData) { val detectionFilterChain = new DetectionFilterChain(detectorContainer); val request = new DetectorRequest(metricData); val response = new DetectorResponse(); detectionFilterChain.doFilter(request, response); return response.getDetectorResult(); } }
DetectorExecutorImpl implements DetectorExecutor { @Override public DetectorResult doDetection(DetectorContainer detectorContainer, @NonNull MetricData metricData) { val detectionFilterChain = new DetectionFilterChain(detectorContainer); val request = new DetectorRequest(metricData); val response = new DetectorResponse(); detectionFilterChain.doFilter(request, response); return response.getDetectorResult(); }  }
DetectorExecutorImpl implements DetectorExecutor { @Override public DetectorResult doDetection(DetectorContainer detectorContainer, @NonNull MetricData metricData) { val detectionFilterChain = new DetectionFilterChain(detectorContainer); val request = new DetectorRequest(metricData); val response = new DetectorResponse(); detectionFilterChain.doFilter(request, response); return response.getDetectorResult(); }  @Override DetectorResult doDetection(DetectorContainer detectorContainer, @NonNull MetricData metricData); }
DetectorExecutorImpl implements DetectorExecutor { @Override public DetectorResult doDetection(DetectorContainer detectorContainer, @NonNull MetricData metricData) { val detectionFilterChain = new DetectionFilterChain(detectorContainer); val request = new DetectorRequest(metricData); val response = new DetectorResponse(); detectionFilterChain.doFilter(request, response); return response.getDetectorResult(); }  @Override DetectorResult doDetection(DetectorContainer detectorContainer, @NonNull MetricData metricData);  }