ConstantThresholdDetector extends AbstractOutlierDetector { @Override public DetectorResult detect(@NonNull MetricData metricData) { val thresholds = params.getThresholds(); val trusted = isTrusted(); val level = classifier.classify(thresholds, metricData.getValue()); return new OutlierDetectorResult() .setAnomalyLevel(level) .setThresholds(thresholds) .setTrusted(trusted); } ConstantThresholdDetector(@NonNull UUID uuid, @NonNull ConstantThresholdDetectorParams params, boolean trusted); @Override DetectorResult detect(@NonNull MetricData metricData); @Override String getName();  }
@Test(expected = NullPointerException.class) public void testMetricCantBeNull() { val detector = detector(detectorUuid, thresholds, AnomalyType.LEFT_TAILED, trusted); detector.detect(null); }