Repository: commons-lang Updated Branches: refs/heads/master 3f796bf74 -> c158713b6
Add tests with a better comparator from #132. Fix formating. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c158713b Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c158713b Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c158713b Branch: refs/heads/master Commit: c158713b66856745427f793f14a5dd1fcaf941ee Parents: 3f796bf Author: ggregory <ggreg...@apache.org> Authored: Tue Apr 19 17:55:42 2016 -0700 Committer: ggregory <ggreg...@apache.org> Committed: Tue Apr 19 17:55:42 2016 -0700 ---------------------------------------------------------------------- .../org/apache/commons/lang3/RangeTest.java | 50 ++++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c158713b/src/test/java/org/apache/commons/lang3/RangeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/RangeTest.java b/src/test/java/org/apache/commons/lang3/RangeTest.java index 2163347..202bd8d 100644 --- a/src/test/java/org/apache/commons/lang3/RangeTest.java +++ b/src/test/java/org/apache/commons/lang3/RangeTest.java @@ -95,43 +95,43 @@ public class RangeTest { } @Test - public void testBetweenWithCompare(){ - final Comparator<Integer> c = new Comparator<Integer>(){ + public void testBetweenWithCompare() { + final Comparator<Integer> c = new Comparator<Integer>() { @Override public int compare(final Integer o1, final Integer o2) { return 0; // all integers are equal } }; - final Comparator<String> lengthComp = new Comparator<String>(){ + final Comparator<String> lengthComp = new Comparator<String>() { @Override public int compare(final String str1, final String str2) { return str1.length() - str2.length(); } }; - Range<Integer> rb = Range.between(-10,20); - assertFalse("should not contain null",rb.contains(null)); - assertTrue("should contain 10",rb.contains(10)); - assertTrue("should contain -10",rb.contains(-10)); - assertFalse("should not contain 21",rb.contains(21)); - assertFalse("should not contain -11",rb.contains(-11)); - rb = Range.between(-10,20,c); - assertFalse("should not contain null",rb.contains(null)); - assertTrue("should contain 10",rb.contains(10)); - assertTrue("should contain -10",rb.contains(-10)); - assertTrue("should contain 21",rb.contains(21)); - assertTrue("should contain -11",rb.contains(-11)); + Range<Integer> rb = Range.between(-10, 20); + assertFalse("should not contain null", rb.contains(null)); + assertTrue("should contain 10", rb.contains(10)); + assertTrue("should contain -10", rb.contains(-10)); + assertFalse("should not contain 21", rb.contains(21)); + assertFalse("should not contain -11", rb.contains(-11)); + rb = Range.between(-10, 20, c); + assertFalse("should not contain null", rb.contains(null)); + assertTrue("should contain 10", rb.contains(10)); + assertTrue("should contain -10", rb.contains(-10)); + assertTrue("should contain 21", rb.contains(21)); + assertTrue("should contain -11", rb.contains(-11)); Range<String> rbstr = Range.between("house", "i"); - assertFalse("should not contain null",rbstr.contains(null)); - assertTrue("should contain house",rbstr.contains("house")); - assertTrue("should contain i",rbstr.contains("i")); - assertFalse("should not contain hose",rbstr.contains("hose")); - assertFalse("should not contain ice",rbstr.contains("ice")); + assertFalse("should not contain null", rbstr.contains(null)); + assertTrue("should contain house", rbstr.contains("house")); + assertTrue("should contain i", rbstr.contains("i")); + assertFalse("should not contain hose", rbstr.contains("hose")); + assertFalse("should not contain ice", rbstr.contains("ice")); rbstr = Range.between("house", "i", lengthComp); - assertFalse("should not contain null",rbstr.contains(null)); - assertTrue("should contain house",rbstr.contains("house")); - assertTrue("should contain i",rbstr.contains("i")); - assertFalse("should not contain houses",rbstr.contains("houses")); - assertFalse("should not contain ''",rbstr.contains("")); + assertFalse("should not contain null", rbstr.contains(null)); + assertTrue("should contain house", rbstr.contains("house")); + assertTrue("should contain i", rbstr.contains("i")); + assertFalse("should not contain houses", rbstr.contains("houses")); + assertFalse("should not contain ''", rbstr.contains("")); } //-----------------------------------------------------------------------