@Test public void doFilterWithEmptyChain() { when(detectorContainer.getDetector()).thenReturn(detector); when(detectorRequest.getMetricData()).thenReturn(metricData); chainUnderTest = new DetectionFilterChain(detectorContainer); chainUnderTest.doFilter(detectorRequest, detectorResponse); }
public void doFilter(@NonNull DetectorRequest request, @NonNull DetectorResponse response) { if (!filtersIterator.hasNext()) { val result = detector.detect(request.getMetricData()); response.setDetectorResult(result); } else { DetectionFilter f = filtersIterator.next(); f.doFilter(request, response, this); } }
DetectionFilterChain { public void doFilter(@NonNull DetectorRequest request, @NonNull DetectorResponse response) { if (!filtersIterator.hasNext()) { val result = detector.detect(request.getMetricData()); response.setDetectorResult(result); } else { DetectionFilter f = filtersIterator.next(); f.doFilter(request, response, this); } } }
DetectionFilterChain { public void doFilter(@NonNull DetectorRequest request, @NonNull DetectorResponse response) { if (!filtersIterator.hasNext()) { val result = detector.detect(request.getMetricData()); response.setDetectorResult(result); } else { DetectionFilter f = filtersIterator.next(); f.doFilter(request, response, this); } } DetectionFilterChain(DetectorContainer detectorContainer); }
DetectionFilterChain { public void doFilter(@NonNull DetectorRequest request, @NonNull DetectorResponse response) { if (!filtersIterator.hasNext()) { val result = detector.detect(request.getMetricData()); response.setDetectorResult(result); } else { DetectionFilter f = filtersIterator.next(); f.doFilter(request, response, this); } } DetectionFilterChain(DetectorContainer detectorContainer); void doFilter(@NonNull DetectorRequest request, @NonNull DetectorResponse response); }
DetectionFilterChain { public void doFilter(@NonNull DetectorRequest request, @NonNull DetectorResponse response) { if (!filtersIterator.hasNext()) { val result = detector.detect(request.getMetricData()); response.setDetectorResult(result); } else { DetectionFilter f = filtersIterator.next(); f.doFilter(request, response, this); } } DetectionFilterChain(DetectorContainer detectorContainer); void doFilter(@NonNull DetectorRequest request, @NonNull DetectorResponse response);  }