@Test
public void testEvaluate() {

    val testRows = data.listIterator();
    val testRow0 = testRows.next();
    val observed0 = testRow0.getObserved();
    val params = buildParams(observed0);
    val detector = buildDetector(params);
    assertEquals(detectorUuid, detector.getUuid());
    assertEquals(trusted, detector.isTrusted());
    assertSame(params, detector.getParams());
    int noOfDataPoints = 1;
    while (testRows.hasNext()) {
        val testRow = testRows.next();
        val observed = testRow.getObserved();
        val metricData = new MetricData(metricDef, observed, epochSecond);
        val result = (OutlierDetectorResult) detector.detect(metricData);
        val level = result.getAnomalyLevel();
        if (noOfDataPoints < WARMUP_PERIOD) {
            TestCase.assertEquals(AnomalyLevel.MODEL_WARMUP, level);
        } else {
            assertEquals(testRow.getUpperControlLimit_R(), detector.getUpperControlLimit_R(), TOLERANCE);
            assertEquals(testRow.getLowerControlLimit_X(), detector.getLowerControlLimit_X(), TOLERANCE);
            assertEquals(testRow.getUpperControlLimit_X(), detector.getUpperControlLimit_X(), TOLERANCE);
            assertEquals(AnomalyLevel.valueOf(testRow.getAnomalyLevel()), level);
        }
        noOfDataPoints += 1;
    }
}