@Test
public void testSetThresholds(){

    try {
        // To retrieve classes...
        getCategorize();
        // -INF -> class1
        // t3 (50)  -> class4
        // t1 (100) -> class2
        // t2 (200) -> class3
        categorize.setThreshold(2, t4);
        //We have replaced t1 with t4 and now have
        // -INF -> class1
        // t3 (50)  -> class4
        // t4 (75)  -> class2
        // t2 (200) -> class3
        assertTrue(categorize.getNumClasses() == 4);
        assertTrue(categorize.get(0).getColor(null, -1) == class1.getColor(null, -1));
        assertTrue(categorize.get(1).getColor(null, -1) == class4.getColor(null, -1));
        assertTrue(categorize.get(2).getColor(null, -1) == class2.getColor(null, -1));
        assertTrue(categorize.get(3).getColor(null, -1) == class3.getColor(null, -1));
        // Thresholds
        double first = categorize.getThreshold(0).getValue(null, -1);
        assertTrue(Double.isInfinite(first) && first < 0);
        assertEquals(categorize.getThreshold(1).getValue(null, -1), t3.getValue(null, -1));
        assertEquals(categorize.getThreshold(2).getValue(null, -1), t4.getValue(null, -1));
        assertEquals(categorize.getThreshold(3).getValue(null, -1), t2.getValue(null, -1));
        // Thresholds : 75, 100, 200, 500
        categorize.setThreshold(0, t5);
        //t5 is 500. We should obtain
        // t3 (50)  -> class4
        // t4 (75)  -> class2
        // t2 (200) -> class3
        // t5 (500) -> class1
        //but the first threshold must be -INF so we expect
        // -INF     -> class4
        // t4 (75)  -> class2
        // t2 (200) -> class3
        // t5 (500) -> class1
        assertTrue(categorize.getNumClasses() == 4);
        assertTrue(categorize.get(0).getColor(null, -1) == class4.getColor(null, -1));
        assertTrue(categorize.get(1).getColor(null, -1) == class2.getColor(null, -1));
        assertTrue(categorize.get(2).getColor(null, -1) == class3.getColor(null, -1));
        assertTrue(categorize.get(3).getColor(null, -1) == class1.getColor(null, -1));
        first = categorize.getThreshold(0).getValue(null, -1);
        assertTrue(Double.isInfinite(first) && first < 0);
        assertEquals(categorize.getThreshold(1).getValue(null, -1), t4.getValue(null, -1));
        assertEquals(categorize.getThreshold(2).getValue(null, -1), t2.getValue(null, -1));
        assertEquals(categorize.getThreshold(3).getValue(null, -1), t5.getValue(null, -1));
    } catch (ParameterException ex) {
        Logger.getLogger(Categorize2ColorTest.class.getName()).log(Level.SEVERE, null, ex);
    }
}