    @Test
    public void testSketchyMovingMAD() throws IOException {

        Random r = new Random(0);
        List<DataPoint> points = new ArrayList<>();
        DescriptiveStatistics stats = new DescriptiveStatistics();
        DescriptiveStatistics medianStats = new DescriptiveStatistics();
        OutlierConfig config = JSONUtil.INSTANCE.load(madConfig, OutlierConfig.class);
        SketchyMovingMAD madAlgo = ((SketchyMovingMAD)config.getSketchyOutlierAlgorithm()).withConfig(config);
        int i = 0;
        for(i = 0; i < 10000;++i) {
            double val = r.nextDouble() * 1000 - 10000;
            stats.addValue(val);
            DataPoint dp = (new DataPoint(i, val, null, "foo"));
            madAlgo.analyze(dp);
            points.add(dp);
        }
        for(DataPoint dp : points) {
            medianStats.addValue(Math.abs(dp.getValue() - stats.getPercentile(50)));
        }
        double mad = medianStats.getPercentile(50);
        double median = stats.getPercentile(50);
        {
            double val = getValAtModifiedZScore(3.6, mad, median);
            System.out.println("MODERATE => " + val);
            DataPoint dp = (new DataPoint(i++, val, null, "foo"));
            Severity s = madAlgo.analyze(dp).getSeverity();
            Assert.assertTrue(s == Severity.MODERATE_OUTLIER );
        }
        {
            double val = getValAtModifiedZScore(6, mad, median);
            System.out.println("SEVERE => " + val);
            DataPoint dp = (new DataPoint(i++, val, null, "foo"));
            Severity s = madAlgo.analyze(dp).getSeverity();
            Assert.assertTrue(s == Severity.SEVERE_OUTLIER );
        }

        Assert.assertTrue(madAlgo.getMedianDistributions().get("foo").getAmount() <= 110);
        Assert.assertTrue(madAlgo.getMedianDistributions().get("foo").getChunks().size() <= 12);
    }