src/test/java/org/thegalactic/context/constraint/categorical/CategoricalModelTest.java
@Test
    public void testIndexOf() {
        CategoricalModel model = CategoricalModel.create();
        CategoricalAttribute attribute1 = model.addAttribute();
        CategoricalValue value1 = attribute1.addValue("Test1");
        CategoricalValue value2 = attribute1.addValue("Test2");
        CategoricalAttribute attribute2 = model.addAttribute();
        CategoricalValue value3 = attribute2.addValue("Test3");
        assertEquals(0, model.indexOf(value1));
        assertEquals(1, model.indexOf(value2));
        assertEquals(2, model.indexOf(value3));
        try {
            model = CategoricalModel.create();
            model.indexOf(value1);
            fail("An IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
            assertEquals("The CategoricalValue is not in this model", e.getMessage());
        }
    }
/**
     * Test of indexOf method, of class CategoricalModel.
     */
Test of indexOf method, of class CategoricalModel.
Test of indexOf method of class CategoricalModel .
@Test
    public void testIndexOf() {
        CategoricalModel model = CategoricalModel.create();
        CategoricalAttribute attribute1 = model.addAttribute();
        CategoricalValue value1 = attribute1.addValue("Test1");
        CategoricalValue value2 = attribute1.addValue("Test2");
        CategoricalAttribute attribute2 = model.addAttribute();
        CategoricalValue value3 = attribute2.addValue("Test3");
        assertEquals(0, model.indexOf(value1));
        assertEquals(1, model.indexOf(value2));
        assertEquals(2, model.indexOf(value3));
        try {
            model = CategoricalModel.create();
            model.indexOf(value1);
            fail("An IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
            assertEquals("The CategoricalValue is not in this model", e.getMessage());
        }
    }
@ Test public void testIndexOf ( ) { CategoricalModel model = CategoricalModel . create ( ) ; CategoricalAttribute attribute1 = model . addAttribute ( ) ; CategoricalValue value1 = attribute1 . addValue ( "Test1" ) ; CategoricalValue value2 = attribute1 . addValue ( "Test2" ) ; CategoricalAttribute attribute2 = model . addAttribute ( ) ; CategoricalValue value3 = attribute2 . addValue ( "Test3" ) ; assertEquals ( 0 , model . indexOf ( value1 ) ) ; assertEquals ( 1 , model . indexOf ( value2 ) ) ; assertEquals ( 2 , model . indexOf ( value3 ) ) ; try { model = CategoricalModel . create ( ) ; model . indexOf ( value1 ) ; fail ( "An IllegalArgumentException must be thrown" ) ; } catch ( IllegalArgumentException e ) { assertEquals ( "The CategoricalValue is not in this model" , e . getMessage ( ) ) ; } }
Test of indexOf method, of class CategoricalModel.
Test of indexOf method of class CategoricalModel .