commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r833343 - /commons/proper/lang/trunk/src/test/org/apache/commons/lang/RangeTest.java
Date Fri, 06 Nov 2009 11:11:38 GMT
Author: bayard
Date: Fri Nov  6 11:11:38 2009
New Revision: 833343

URL: http://svn.apache.org/viewvc?rev=833343&view=rev
Log:
containsRange test added - LANG-551

Modified:
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/RangeTest.java

Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/RangeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/RangeTest.java?rev=833343&r1=833342&r2=833343&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/RangeTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/RangeTest.java Fri Nov  6 11:11:38
2009
@@ -106,4 +106,36 @@
         assertFalse(intRange.contains(25));
     }
 
+    public void testContainsRange() {
+
+        // null handling
+        assertFalse(intRange.containsRange(null));
+
+        // easy inside range
+        assertTrue(intRange.containsRange(new Range(12, 18)));
+
+        // outside range on each side
+        assertFalse(intRange.containsRange(new Range(32, 45)));
+        assertFalse(intRange.containsRange(new Range(2, 8)));
+
+        // equals range
+        assertTrue(intRange.containsRange(new Range(10, 20)));
+
+        // overlaps
+        assertFalse(intRange.containsRange(new Range(9, 14)));
+        assertFalse(intRange.containsRange(new Range(16, 21)));
+
+        // touches lower boundary
+        assertTrue(intRange.containsRange(new Range(10, 19)));
+        assertFalse(intRange.containsRange(new Range(10, 21)));
+
+        // touches upper boundary
+        assertTrue(intRange.containsRange(new Range(11, 20)));
+        assertFalse(intRange.containsRange(new Range(9, 20)));
+        
+        // negative
+        assertFalse(intRange.containsRange(new Range(-11, -18)));
+
+    }
+
 }



Mime
View raw message