all non-covered parts of the code are now covered. 100% coverage for a package, while not in itself a great thing, feels damn good

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@138010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2004-12-26 02:35:47 +00:00
parent 60666b2ae2
commit 2463fd3380
7 changed files with 57 additions and 7 deletions

View File

@ -23,7 +23,7 @@ import junit.textui.TestRunner;
/**
* JUnit tests.
*
* @version $Id: MutableByteTest.java,v 1.2 2004/07/07 23:50:28 scolebourne Exp $
* @version $Id: MutableByteTest.java,v 1.3 2004/12/26 02:35:47 bayard Exp $
* @see MutableByte
*/
public class MutableByteTest extends TestCase {
@ -128,6 +128,15 @@ public class MutableByteTest extends TestCase {
} catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
MutableByte mutNum = new MutableByte( (byte) 1 );
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
assertEquals( 1, mutNum.intValue() );
assertEquals( 1L, mutNum.longValue() );
}
public void testToString() {
assertEquals("0", new MutableByte((byte) 0).toString());
assertEquals("10", new MutableByte((byte) 10).toString());

View File

@ -23,7 +23,7 @@ import junit.textui.TestRunner;
/**
* JUnit tests.
*
* @version $Id: MutableDoubleTest.java,v 1.2 2004/07/07 23:50:28 scolebourne Exp $
* @version $Id: MutableDoubleTest.java,v 1.3 2004/12/26 02:35:47 bayard Exp $
* @see MutableDouble
*/
public class MutableDoubleTest extends TestCase {
@ -139,6 +139,14 @@ public class MutableDoubleTest extends TestCase {
} catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
MutableDouble mutNum = new MutableDouble(1.7);
assertEquals( 1.7F, mutNum.floatValue(), 0 );
assertEquals( 1, mutNum.intValue() );
assertEquals( 1L, mutNum.longValue() );
}
public void testToString() {
assertEquals("0.0", new MutableDouble(0d).toString());
assertEquals("10.0", new MutableDouble(10d).toString());

View File

@ -23,7 +23,7 @@ import junit.textui.TestRunner;
/**
* JUnit tests.
*
* @version $Id: MutableFloatTest.java,v 1.2 2004/07/07 23:50:28 scolebourne Exp $
* @version $Id: MutableFloatTest.java,v 1.3 2004/12/26 02:35:47 bayard Exp $
* @see MutableFloat
*/
public class MutableFloatTest extends TestCase {
@ -139,6 +139,14 @@ public class MutableFloatTest extends TestCase {
} catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
MutableFloat mutNum = new MutableFloat(1.7F);
assertEquals( 1, mutNum.intValue() );
assertEquals( 1.7, mutNum.doubleValue(), 0.00001 );
assertEquals( 1L, mutNum.longValue() );
}
public void testToString() {
assertEquals("0.0", new MutableFloat(0f).toString());
assertEquals("10.0", new MutableFloat(10f).toString());

View File

@ -23,7 +23,7 @@ import junit.textui.TestRunner;
/**
* JUnit tests.
*
* @version $Id: MutableIntTest.java,v 1.1 2004/07/07 23:50:28 scolebourne Exp $
* @version $Id: MutableIntTest.java,v 1.2 2004/12/26 02:35:47 bayard Exp $
* @see MutableInt
*/
public class MutableIntTest extends TestCase {
@ -128,6 +128,14 @@ public class MutableIntTest extends TestCase {
} catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
MutableInt mutNum = new MutableInt(1);
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
assertEquals( 1L, mutNum.longValue() );
}
public void testToString() {
assertEquals("0", new MutableInt(0).toString());
assertEquals("10", new MutableInt(10).toString());

View File

@ -23,7 +23,7 @@ import junit.textui.TestRunner;
/**
* JUnit tests.
*
* @version $Id: MutableLongTest.java,v 1.2 2004/07/07 23:50:28 scolebourne Exp $
* @version $Id: MutableLongTest.java,v 1.3 2004/12/26 02:35:47 bayard Exp $
* @see MutableLong
*/
public class MutableLongTest extends TestCase {
@ -128,6 +128,13 @@ public class MutableLongTest extends TestCase {
} catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
MutableLong mutNum = new MutableLong(1L);
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
}
public void testToString() {
assertEquals("0", new MutableLong(0).toString());
assertEquals("10", new MutableLong(10).toString());

View File

@ -23,7 +23,7 @@ import junit.textui.TestRunner;
/**
* JUnit tests.
*
* @version $Id: MutableObjectTest.java,v 1.1 2004/07/08 00:02:35 scolebourne Exp $
* @version $Id: MutableObjectTest.java,v 1.2 2004/12/26 02:35:47 bayard Exp $
* @see MutableShort
*/
public class MutableObjectTest extends TestCase {
@ -99,6 +99,7 @@ public class MutableObjectTest extends TestCase {
public void testToString() {
assertEquals("HI", new MutableObject("HI").toString());
assertEquals("10.0", new MutableObject(new Double(10)).toString());
assertEquals("null", new MutableObject(null).toString());
}
}

View File

@ -23,7 +23,7 @@ import junit.textui.TestRunner;
/**
* JUnit tests.
*
* @version $Id: MutableShortTest.java,v 1.2 2004/07/07 23:50:28 scolebourne Exp $
* @version $Id: MutableShortTest.java,v 1.3 2004/12/26 02:35:47 bayard Exp $
* @see MutableShort
*/
public class MutableShortTest extends TestCase {
@ -128,6 +128,15 @@ public class MutableShortTest extends TestCase {
} catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
MutableShort mutNum = new MutableShort( (short) 1 );
assertEquals( 1.0F, mutNum.floatValue(), 0 );
assertEquals( 1.0, mutNum.doubleValue(), 0 );
assertEquals( 1, mutNum.intValue() );
assertEquals( 1L, mutNum.longValue() );
}
public void testToString() {
assertEquals("0", new MutableShort((short) 0).toString());
assertEquals("10", new MutableShort((short) 10).toString());