commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject [lang] Should IntRangeTest use variables fiveL, tenL?
Date Wed, 03 Sep 2003 22:42:46 GMT
In IntRangeTest fiveL and tenL are assigned but not used. Should the
code read:

        // test non Integer, for full coverage
        Long fiveL = new Long(5L);
        Long tenL = new Long(10L);
        assertEquals(fiveL, nr.getMinimumNumber());
        assertEquals(tenL, nr.getMaximumNumber());

This is the current version of the method in question:

    public void testConstructor2b() {
        IntRange nr = new IntRange(five, ten);
        assertSame(five, nr.getMinimumNumber());
        assertSame(ten, nr.getMaximumNumber());
        
        nr = new IntRange(ten, five);
        assertSame(five, nr.getMinimumNumber());
        assertSame(ten, nr.getMaximumNumber());
        
        nr = new IntRange(five, long10);
        assertSame(five, nr.getMinimumNumber());
        assertEquals(ten, nr.getMaximumNumber());
        
        // test non Integer, for full coverage
        Long fiveL = new Long(5L);
        Long tenL = new Long(10L);
        assertEquals(five, nr.getMinimumNumber());
        assertEquals(ten, nr.getMaximumNumber());
        
        // not null
        try {
            new IntRange(five, null);
            fail();
        } catch (IllegalArgumentException ex) {}
        try {
            new IntRange(null, five);
            fail();
        } catch (IllegalArgumentException ex) {}
        try {
            new IntRange(null, null);
            fail();
        } catch (IllegalArgumentException ex) {}
    }

-Janek


Mime
View raw message