Revision 2650 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToIntTest.java

View differences:

CoerceToIntTest.java
37 37
    public void testCoerce() throws Exception {
38 38
        CoerceToInt coerce = new CoerceToInt();
39 39

  
40
        Integer integer12 = new Integer(12);
40
        Integer integer12 = 12;
41 41

  
42
        assertCoercion(coerce, new Integer(12), integer12);
43
        assertCoercion(coerce, new Long(12l), integer12);
44
        assertCoercion(coerce, new Float(12.0f), integer12);
45
        assertCoercion(coerce, new Double(12.0d), integer12);
42
        assertCoercion(coerce, (int) 12, integer12);
43
        assertCoercion(coerce, 12l, integer12);
44
        assertCoercion(coerce, 12.0f, integer12);
45
        assertCoercion(coerce, 12.0d, integer12);
46 46
        assertCoercion(coerce, "12", integer12);
47 47
        assertCoercion(coerce, "0x0C", integer12);
48
        assertCoercion(coerce, "t", 1);
49
        assertCoercion(coerce, "f", 0);
50
        assertCoercion(coerce, "true", 1);
48 51
    }
49 52

  
50 53
    private void assertCoercion(CoerceToInt coerce, Object value,

Also available in: Unified diff