Code example for ArrayList

Methods: add, clear

0
     */ 
    public final void testFactory() { 
 
        OctSingleCharacterOperator.Factory factory = new OctSingleCharacterOperator.Factory();
        assertNotNull(factory);
        List<String> list = new ArrayList<String>();
        assertNotNull(list);
        list.add("141");
        OctSingleCharacterOperator operator =
                (OctSingleCharacterOperator) factory.doCreateOperator(list);
        assertNotNull(operator);
        assertEquals(1, factory.numberOfParams());
        assertEquals(141, operator.getOctValue());
        assertFalse(142 == operator.getOctValue());
        assertEquals('a', operator.getCharacter());
        assertFalse(operator.getCharacter() == 'Z');
        assertEquals("a".charAt(0), operator.getCharacter());
        list.clear();
        list.add("132");
        operator = (OctSingleCharacterOperator) factory.createOperator(list);
        assertNotNull(operator);
        assertEquals(1, factory.numberOfParams());
        assertEquals(132, operator.getOctValue());
        assertFalse(142 == operator.getOctValue());
        assertEquals('Z', operator.getCharacter());
        assertFalse(operator.getCharacter() == 'a');
        assertEquals("Z".charAt(0), operator.getCharacter());
        list.clear();
        list.add("999");
        operator = (OctSingleCharacterOperator) factory.createOperator(list);
        assertNull(operator);
    } 
}