You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by su...@apache.org on 2002/10/08 21:14:20 UTC
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang NumberRangeTest.java
sullis 2002/10/08 12:14:20
Modified: lang/src/test/org/apache/commons/lang NumberRangeTest.java
Log:
added tests for NullPointerException
Revision Changes Path
1.2 +40 -1 jakarta-commons/lang/src/test/org/apache/commons/lang/NumberRangeTest.java
Index: NumberRangeTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/NumberRangeTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NumberRangeTest.java 19 Jul 2002 03:35:55 -0000 1.1
+++ NumberRangeTest.java 8 Oct 2002 19:14:20 -0000 1.2
@@ -175,6 +175,45 @@
assertEquals(expected, result);
}
+ public void testConstructorNullParameters()
+ {
+ try
+ {
+ NumberRange nr = new NumberRange(null);
+ fail("NumberRange(null) did not throw an exception.");
+ }
+ catch (Exception e)
+ {
+ assertTrue(
+ "NumberRange(null)",
+ e instanceof NullPointerException);
+ }
+
+ try
+ {
+ NumberRange nr = new NumberRange(five, null);
+ fail("NumberRange(five, null) did not throw an exception.");
+ }
+ catch (Exception e)
+ {
+ assertTrue(
+ "NumberRange(five, null)",
+ e instanceof NullPointerException);
+ }
+
+ try
+ {
+ NumberRange nr = new NumberRange(null, five);
+ fail("NumberRange(null, five) did not throw an exception.");
+ }
+ catch (Exception e)
+ {
+ assertTrue(
+ "NumberRange(null, five)",
+ e instanceof NullPointerException);
+ }
+
+ }
public void testToString() {
String expected = "10-20";
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>