From 93e3168da1aba3523c1a1006cc8715f81881dd90 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Mon, 4 Aug 2003 01:14:02 +0000 Subject: [PATCH] Rename includeXxx() to containsXxx() for consistency with rest of [lang] and Java git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137566 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/commons/lang/math/DoubleRange.java | 20 +- .../apache/commons/lang/math/FloatRange.java | 20 +- .../apache/commons/lang/math/IntRange.java | 20 +- .../apache/commons/lang/math/LongRange.java | 20 +- .../apache/commons/lang/math/NumberRange.java | 4 +- .../org/apache/commons/lang/math/Range.java | 54 ++-- .../commons/lang/math/AbstractRangeTest.java | 270 +++++++++--------- .../commons/lang/math/DoubleRangeTest.java | 48 ++-- .../commons/lang/math/FloatRangeTest.java | 48 ++-- .../commons/lang/math/IntRangeTest.java | 54 ++-- .../commons/lang/math/LongRangeTest.java | 54 ++-- .../commons/lang/math/NumberRangeTest.java | 24 +- 12 files changed, 318 insertions(+), 318 deletions(-) diff --git a/src/java/org/apache/commons/lang/math/DoubleRange.java b/src/java/org/apache/commons/lang/math/DoubleRange.java index efead45fd..0e7045d59 100644 --- a/src/java/org/apache/commons/lang/math/DoubleRange.java +++ b/src/java/org/apache/commons/lang/math/DoubleRange.java @@ -60,7 +60,7 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: DoubleRange.java,v 1.3 2003/07/14 22:25:04 bayard Exp $ + * @version $Id: DoubleRange.java,v 1.4 2003/08/04 01:14:02 scolebourne Exp $ */ public final class DoubleRange extends Range implements Serializable { @@ -324,11 +324,11 @@ public float getMaximumFloat() { * @param number the number to test, may be null * @return true if the specified number occurs within this range */ - public boolean includesNumber(Number number) { + public boolean containsNumber(Number number) { if (number == null) { return false; } - return includesDouble(number.doubleValue()); + return containsDouble(number.doubleValue()); } /** @@ -342,7 +342,7 @@ public boolean includesNumber(Number number) { * @return true if the specified number occurs within this * range by double comparison */ - public boolean includesDouble(double value) { + public boolean containsDouble(double value) { return (value >= min && value <= max); } @@ -359,12 +359,12 @@ public boolean includesDouble(double value) { * @return true if the specified range occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ - public boolean includesRange(Range range) { + public boolean containsRange(Range range) { if (range == null) { return false; } - return includesDouble(range.getMinimumDouble()) && - includesDouble(range.getMaximumDouble()); + return containsDouble(range.getMinimumDouble()) + && containsDouble(range.getMaximumDouble()); } /** @@ -380,9 +380,9 @@ public boolean overlapsRange(Range range) { if (range == null) { return false; } - return range.includesDouble(min) || - range.includesDouble(max) || - includesDouble(range.getMinimumDouble()); + return range.containsDouble(min) + || range.containsDouble(max) + || containsDouble(range.getMinimumDouble()); } // Basics diff --git a/src/java/org/apache/commons/lang/math/FloatRange.java b/src/java/org/apache/commons/lang/math/FloatRange.java index 1967ee34a..ab44c963c 100644 --- a/src/java/org/apache/commons/lang/math/FloatRange.java +++ b/src/java/org/apache/commons/lang/math/FloatRange.java @@ -60,7 +60,7 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: FloatRange.java,v 1.3 2003/07/14 22:25:04 bayard Exp $ + * @version $Id: FloatRange.java,v 1.4 2003/08/04 01:14:01 scolebourne Exp $ */ public final class FloatRange extends Range implements Serializable { @@ -320,11 +320,11 @@ public float getMaximumFloat() { * @param number the number to test, may be null * @return true if the specified number occurs within this range */ - public boolean includesNumber(Number number) { + public boolean containsNumber(Number number) { if (number == null) { return false; } - return includesFloat(number.floatValue()); + return containsFloat(number.floatValue()); } /** @@ -338,7 +338,7 @@ public boolean includesNumber(Number number) { * @return true if the specified number occurs within this * range by float comparison */ - public boolean includesFloat(float value) { + public boolean containsFloat(float value) { return (value >= min && value <= max); } @@ -355,12 +355,12 @@ public boolean includesFloat(float value) { * @return true if the specified range occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ - public boolean includesRange(Range range) { + public boolean containsRange(Range range) { if (range == null) { return false; } - return includesFloat(range.getMinimumFloat()) && - includesFloat(range.getMaximumFloat()); + return containsFloat(range.getMinimumFloat()) && + containsFloat(range.getMaximumFloat()); } /** @@ -376,9 +376,9 @@ public boolean overlapsRange(Range range) { if (range == null) { return false; } - return range.includesFloat(min) || - range.includesFloat(max) || - includesFloat(range.getMinimumFloat()); + return range.containsFloat(min) || + range.containsFloat(max) || + containsFloat(range.getMinimumFloat()); } // Basics diff --git a/src/java/org/apache/commons/lang/math/IntRange.java b/src/java/org/apache/commons/lang/math/IntRange.java index 6fbbcc315..850fcf364 100644 --- a/src/java/org/apache/commons/lang/math/IntRange.java +++ b/src/java/org/apache/commons/lang/math/IntRange.java @@ -60,7 +60,7 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: IntRange.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ + * @version $Id: IntRange.java,v 1.4 2003/08/04 01:14:01 scolebourne Exp $ */ public final class IntRange extends Range implements Serializable { @@ -295,11 +295,11 @@ public float getMaximumFloat() { * @param number the number to test, may be null * @return true if the specified number occurs within this range */ - public boolean includesNumber(Number number) { + public boolean containsNumber(Number number) { if (number == null) { return false; } - return includesInteger(number.intValue()); + return containsInteger(number.intValue()); } /** @@ -313,7 +313,7 @@ public boolean includesNumber(Number number) { * @return true if the specified number occurs within this * range by int comparison */ - public boolean includesInteger(int value) { + public boolean containsInteger(int value) { return (value >= min && value <= max); } @@ -330,12 +330,12 @@ public boolean includesInteger(int value) { * @return true if the specified range occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ - public boolean includesRange(Range range) { + public boolean containsRange(Range range) { if (range == null) { return false; } - return includesInteger(range.getMinimumInteger()) && - includesInteger(range.getMaximumInteger()); + return containsInteger(range.getMinimumInteger()) && + containsInteger(range.getMaximumInteger()); } /** @@ -351,9 +351,9 @@ public boolean overlapsRange(Range range) { if (range == null) { return false; } - return range.includesInteger(min) || - range.includesInteger(max) || - includesInteger(range.getMinimumInteger()); + return range.containsInteger(min) || + range.containsInteger(max) || + containsInteger(range.getMinimumInteger()); } // Basics diff --git a/src/java/org/apache/commons/lang/math/LongRange.java b/src/java/org/apache/commons/lang/math/LongRange.java index dbfda47b3..51f3facce 100644 --- a/src/java/org/apache/commons/lang/math/LongRange.java +++ b/src/java/org/apache/commons/lang/math/LongRange.java @@ -60,7 +60,7 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: LongRange.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ + * @version $Id: LongRange.java,v 1.4 2003/08/04 01:14:02 scolebourne Exp $ */ public final class LongRange extends Range implements Serializable { @@ -302,11 +302,11 @@ public float getMaximumFloat() { * @param number the number to test, may be null * @return true if the specified number occurs within this range */ - public boolean includesNumber(Number number) { + public boolean containsNumber(Number number) { if (number == null) { return false; } - return includesLong(number.longValue()); + return containsLong(number.longValue()); } /** @@ -320,7 +320,7 @@ public boolean includesNumber(Number number) { * @return true if the specified number occurs within this * range by long comparison */ - public boolean includesLong(long value) { + public boolean containsLong(long value) { return (value >= min && value <= max); } @@ -337,12 +337,12 @@ public boolean includesLong(long value) { * @return true if the specified range occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ - public boolean includesRange(Range range) { + public boolean containsRange(Range range) { if (range == null) { return false; } - return includesLong(range.getMinimumLong()) && - includesLong(range.getMaximumLong()); + return containsLong(range.getMinimumLong()) && + containsLong(range.getMaximumLong()); } /** @@ -358,9 +358,9 @@ public boolean overlapsRange(Range range) { if (range == null) { return false; } - return range.includesLong(min) || - range.includesLong(max) || - includesLong(range.getMinimumLong()); + return range.containsLong(min) || + range.containsLong(max) || + containsLong(range.getMinimumLong()); } // Basics diff --git a/src/java/org/apache/commons/lang/math/NumberRange.java b/src/java/org/apache/commons/lang/math/NumberRange.java index 3d3897200..6092e4113 100644 --- a/src/java/org/apache/commons/lang/math/NumberRange.java +++ b/src/java/org/apache/commons/lang/math/NumberRange.java @@ -62,7 +62,7 @@ * @author Christopher Elkins * @author Stephen Colebourne * @since 2.0 (previously in org.apache.commons.lang) - * @version $Id: NumberRange.java,v 1.4 2003/07/14 22:25:05 bayard Exp $ + * @version $Id: NumberRange.java,v 1.5 2003/08/04 01:14:01 scolebourne Exp $ */ public final class NumberRange extends Range implements Serializable { @@ -198,7 +198,7 @@ public Number getMaximumNumber() { * @return true if the specified number occurs within this range * @throws IllegalArgumentException if the number is of a different type to the range */ - public boolean includesNumber(Number number) { + public boolean containsNumber(Number number) { if (number == null) { return false; } diff --git a/src/java/org/apache/commons/lang/math/Range.java b/src/java/org/apache/commons/lang/math/Range.java index ea1e7226e..9f7501503 100644 --- a/src/java/org/apache/commons/lang/math/Range.java +++ b/src/java/org/apache/commons/lang/math/Range.java @@ -62,7 +62,7 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: Range.java,v 1.3 2003/06/24 21:14:50 scolebourne Exp $ + * @version $Id: Range.java,v 1.4 2003/08/04 01:14:01 scolebourne Exp $ */ public abstract class Range { @@ -203,7 +203,7 @@ public float getMaximumFloat() { * @return true if the specified number occurs within this range * @throws IllegalArgumentException if the Number cannot be compared */ - public abstract boolean includesNumber(Number number); + public abstract boolean containsNumber(Number number); /** *

Tests whether the specified Number occurs within @@ -211,17 +211,17 @@ public float getMaximumFloat() { * *

null is handled and returns false.

* - *

This implementation forwards to the {@link #includesLong(long)} method.

+ *

This implementation forwards to the {@link #containsLong(long)} method.

* * @param value the long to test, may be null * @return true if the specified number occurs within this * range by long comparison */ - public boolean includesLong(Number value) { + public boolean containsLong(Number value) { if (value == null) { return false; } - return includesLong(value.longValue()); + return containsLong(value.longValue()); } /** @@ -235,7 +235,7 @@ public boolean includesLong(Number value) { * @return true if the specified number occurs within this * range by long comparison */ - public boolean includesLong(long value) { + public boolean containsLong(long value) { return (value >= getMinimumLong() && value <= getMaximumLong()); } @@ -245,17 +245,17 @@ public boolean includesLong(long value) { * *

null is handled and returns false.

* - *

This implementation forwards to the {@link #includesInteger(int)} method.

+ *

This implementation forwards to the {@link #containsInteger(int)} method.

* * @param value the integer to test, may be null * @return true if the specified number occurs within this * range by int comparison */ - public boolean includesInteger(Number value) { + public boolean containsInteger(Number value) { if (value == null) { return false; } - return includesInteger(value.intValue()); + return containsInteger(value.intValue()); } /** @@ -269,7 +269,7 @@ public boolean includesInteger(Number value) { * @return true if the specified number occurs within this * range by int comparison */ - public boolean includesInteger(int value) { + public boolean containsInteger(int value) { return (value >= getMinimumInteger() && value <= getMaximumInteger()); } @@ -279,17 +279,17 @@ public boolean includesInteger(int value) { * *

null is handled and returns false.

* - *

This implementation forwards to the {@link #includesDouble(double)} method.

+ *

This implementation forwards to the {@link #containsDouble(double)} method.

* * @param value the double to test, may be null * @return true if the specified number occurs within this * range by double comparison */ - public boolean includesDouble(Number value) { + public boolean containsDouble(Number value) { if (value == null) { return false; } - return includesDouble(value.doubleValue()); + return containsDouble(value.doubleValue()); } /** @@ -303,7 +303,7 @@ public boolean includesDouble(Number value) { * @return true if the specified number occurs within this * range by double comparison */ - public boolean includesDouble(double value) { + public boolean containsDouble(double value) { int compareMin = NumberUtils.compare(getMinimumDouble(), value); int compareMax = NumberUtils.compare(getMaximumDouble(), value); return (compareMin <= 0 && compareMax >= 0); @@ -315,17 +315,17 @@ public boolean includesDouble(double value) { * *

null is handled and returns false.

* - *

This implementation forwards to the {@link #includesFloat(float)} method.

+ *

This implementation forwards to the {@link #containsFloat(float)} method.

* * @param value the float to test, may be null * @return true if the specified number occurs within this * range by float comparison */ - public boolean includesFloat(Number value) { + public boolean containsFloat(Number value) { if (value == null) { return false; } - return includesFloat(value.floatValue()); + return containsFloat(value.floatValue()); } /** @@ -339,7 +339,7 @@ public boolean includesFloat(Number value) { * @return true if the specified number occurs within this * range by float comparison */ - public boolean includesFloat(float value) { + public boolean containsFloat(float value) { int compareMin = NumberUtils.compare(getMinimumFloat(), value); int compareMax = NumberUtils.compare(getMaximumFloat(), value); return (compareMin <= 0 && compareMax >= 0); @@ -357,7 +357,7 @@ public boolean includesFloat(float value) { * *

null is handled and returns false.

* - *

This implementation uses the {@link #includesNumber(Number)} method. + *

This implementation uses the {@link #containsNumber(Number)} method. * Subclasses may be able to optimise this.

* * @param range the range to test, may be null @@ -365,12 +365,12 @@ public boolean includesFloat(float value) { * this range; otherwise, false * @throws IllegalArgumentException if the Range cannot be compared */ - public boolean includesRange(Range range) { + public boolean containsRange(Range range) { if (range == null) { return false; } - return includesNumber(range.getMinimumNumber()) && - includesNumber(range.getMaximumNumber()); + return containsNumber(range.getMinimumNumber()) + && containsNumber(range.getMaximumNumber()); } /** @@ -382,8 +382,8 @@ public boolean includesRange(Range range) { * *

null is handled and returns false.

* - *

This implementation uses the {@link #includesNumber(Number)} and - * {@link #includesRange(Range)} methods. + *

This implementation uses the {@link #containsNumber(Number)} and + * {@link #containsRange(Range)} methods. * Subclasses may be able to optimise this.

* * @param range the range to test, may be null @@ -395,9 +395,9 @@ public boolean overlapsRange(Range range) { if (range == null) { return false; } - return range.includesNumber(getMinimumNumber()) || - range.includesNumber(getMaximumNumber()) || - includesNumber(range.getMinimumNumber()); + return range.containsNumber(getMinimumNumber()) + || range.containsNumber(getMaximumNumber()) + || containsNumber(range.getMinimumNumber()); } // Basics diff --git a/src/test/org/apache/commons/lang/math/AbstractRangeTest.java b/src/test/org/apache/commons/lang/math/AbstractRangeTest.java index 49a587d0d..cd027868a 100644 --- a/src/test/org/apache/commons/lang/math/AbstractRangeTest.java +++ b/src/test/org/apache/commons/lang/math/AbstractRangeTest.java @@ -59,7 +59,7 @@ * Test cases for the {@link Range} classes. * * @author Stephen Colebourne - * @version $Id: AbstractRangeTest.java,v 1.2 2003/06/08 14:19:43 scolebourne Exp $ + * @version $Id: AbstractRangeTest.java,v 1.3 2003/08/04 01:14:02 scolebourne Exp $ */ public abstract class AbstractRangeTest extends TestCase { @@ -153,175 +153,175 @@ public void testGetMaximum() { //-------------------------------------------------------------------------- - public void testIncludesLong() { - assertEquals(false, tenToTwenty.includesLong(null)); - assertEquals(true, tenToTwenty.includesLong(nonComparable)); + public void testContainsLong() { + assertEquals(false, tenToTwenty.containsLong(null)); + assertEquals(true, tenToTwenty.containsLong(nonComparable)); - assertEquals(false, tenToTwenty.includesLong(five)); - assertEquals(true, tenToTwenty.includesLong(ten)); - assertEquals(true, tenToTwenty.includesLong(fifteen)); - assertEquals(true, tenToTwenty.includesLong(twenty)); - assertEquals(false, tenToTwenty.includesLong(twentyFive)); + assertEquals(false, tenToTwenty.containsLong(five)); + assertEquals(true, tenToTwenty.containsLong(ten)); + assertEquals(true, tenToTwenty.containsLong(fifteen)); + assertEquals(true, tenToTwenty.containsLong(twenty)); + assertEquals(false, tenToTwenty.containsLong(twentyFive)); - assertEquals(false, tenToTwenty.includesLong(long8)); - assertEquals(true, tenToTwenty.includesLong(long10)); - assertEquals(true, tenToTwenty.includesLong(long12)); - assertEquals(true, tenToTwenty.includesLong(long20)); - assertEquals(false, tenToTwenty.includesLong(long21)); + assertEquals(false, tenToTwenty.containsLong(long8)); + assertEquals(true, tenToTwenty.containsLong(long10)); + assertEquals(true, tenToTwenty.containsLong(long12)); + assertEquals(true, tenToTwenty.containsLong(long20)); + assertEquals(false, tenToTwenty.containsLong(long21)); - assertEquals(false, tenToTwenty.includesLong(double8)); - assertEquals(true, tenToTwenty.includesLong(double10)); - assertEquals(true, tenToTwenty.includesLong(double12)); - assertEquals(true, tenToTwenty.includesLong(double20)); - assertEquals(false, tenToTwenty.includesLong(double21)); + assertEquals(false, tenToTwenty.containsLong(double8)); + assertEquals(true, tenToTwenty.containsLong(double10)); + assertEquals(true, tenToTwenty.containsLong(double12)); + assertEquals(true, tenToTwenty.containsLong(double20)); + assertEquals(false, tenToTwenty.containsLong(double21)); - assertEquals(false, tenToTwenty.includesLong(float8)); - assertEquals(true, tenToTwenty.includesLong(float10)); - assertEquals(true, tenToTwenty.includesLong(float12)); - assertEquals(true, tenToTwenty.includesLong(float20)); - assertEquals(false, tenToTwenty.includesLong(float21)); + assertEquals(false, tenToTwenty.containsLong(float8)); + assertEquals(true, tenToTwenty.containsLong(float10)); + assertEquals(true, tenToTwenty.containsLong(float12)); + assertEquals(true, tenToTwenty.containsLong(float20)); + assertEquals(false, tenToTwenty.containsLong(float21)); - assertEquals(false, tenToTwenty.includesLong(9L)); - assertEquals(true, tenToTwenty.includesLong(10L)); - assertEquals(true, tenToTwenty.includesLong(15L)); - assertEquals(true, tenToTwenty.includesLong(20L)); - assertEquals(false, tenToTwenty.includesLong(21L)); + assertEquals(false, tenToTwenty.containsLong(9L)); + assertEquals(true, tenToTwenty.containsLong(10L)); + assertEquals(true, tenToTwenty.containsLong(15L)); + assertEquals(true, tenToTwenty.containsLong(20L)); + assertEquals(false, tenToTwenty.containsLong(21L)); } - public void testIncludesInteger() { - assertEquals(false, tenToTwenty.includesInteger(null)); - assertEquals(true, tenToTwenty.includesInteger(nonComparable)); + public void testContainsInteger() { + assertEquals(false, tenToTwenty.containsInteger(null)); + assertEquals(true, tenToTwenty.containsInteger(nonComparable)); - assertEquals(false, tenToTwenty.includesInteger(five)); - assertEquals(true, tenToTwenty.includesInteger(ten)); - assertEquals(true, tenToTwenty.includesInteger(fifteen)); - assertEquals(true, tenToTwenty.includesInteger(twenty)); - assertEquals(false, tenToTwenty.includesInteger(twentyFive)); + assertEquals(false, tenToTwenty.containsInteger(five)); + assertEquals(true, tenToTwenty.containsInteger(ten)); + assertEquals(true, tenToTwenty.containsInteger(fifteen)); + assertEquals(true, tenToTwenty.containsInteger(twenty)); + assertEquals(false, tenToTwenty.containsInteger(twentyFive)); - assertEquals(false, tenToTwenty.includesInteger(long8)); - assertEquals(true, tenToTwenty.includesInteger(long10)); - assertEquals(true, tenToTwenty.includesInteger(long12)); - assertEquals(true, tenToTwenty.includesInteger(long20)); - assertEquals(false, tenToTwenty.includesInteger(long21)); + assertEquals(false, tenToTwenty.containsInteger(long8)); + assertEquals(true, tenToTwenty.containsInteger(long10)); + assertEquals(true, tenToTwenty.containsInteger(long12)); + assertEquals(true, tenToTwenty.containsInteger(long20)); + assertEquals(false, tenToTwenty.containsInteger(long21)); - assertEquals(false, tenToTwenty.includesInteger(double8)); - assertEquals(true, tenToTwenty.includesInteger(double10)); - assertEquals(true, tenToTwenty.includesInteger(double12)); - assertEquals(true, tenToTwenty.includesInteger(double20)); - assertEquals(false, tenToTwenty.includesInteger(double21)); + assertEquals(false, tenToTwenty.containsInteger(double8)); + assertEquals(true, tenToTwenty.containsInteger(double10)); + assertEquals(true, tenToTwenty.containsInteger(double12)); + assertEquals(true, tenToTwenty.containsInteger(double20)); + assertEquals(false, tenToTwenty.containsInteger(double21)); - assertEquals(false, tenToTwenty.includesInteger(float8)); - assertEquals(true, tenToTwenty.includesInteger(float10)); - assertEquals(true, tenToTwenty.includesInteger(float12)); - assertEquals(true, tenToTwenty.includesInteger(float20)); - assertEquals(false, tenToTwenty.includesInteger(float21)); + assertEquals(false, tenToTwenty.containsInteger(float8)); + assertEquals(true, tenToTwenty.containsInteger(float10)); + assertEquals(true, tenToTwenty.containsInteger(float12)); + assertEquals(true, tenToTwenty.containsInteger(float20)); + assertEquals(false, tenToTwenty.containsInteger(float21)); - assertEquals(false, tenToTwenty.includesInteger(9)); - assertEquals(true, tenToTwenty.includesInteger(10)); - assertEquals(true, tenToTwenty.includesInteger(15)); - assertEquals(true, tenToTwenty.includesInteger(20)); - assertEquals(false, tenToTwenty.includesInteger(21)); + assertEquals(false, tenToTwenty.containsInteger(9)); + assertEquals(true, tenToTwenty.containsInteger(10)); + assertEquals(true, tenToTwenty.containsInteger(15)); + assertEquals(true, tenToTwenty.containsInteger(20)); + assertEquals(false, tenToTwenty.containsInteger(21)); } - public void testIncludesDouble() { - assertEquals(false, tenToTwenty.includesDouble(null)); - assertEquals(true, tenToTwenty.includesDouble(nonComparable)); + public void testContainsDouble() { + assertEquals(false, tenToTwenty.containsDouble(null)); + assertEquals(true, tenToTwenty.containsDouble(nonComparable)); - assertEquals(false, tenToTwenty.includesDouble(five)); - assertEquals(true, tenToTwenty.includesDouble(ten)); - assertEquals(true, tenToTwenty.includesDouble(fifteen)); - assertEquals(true, tenToTwenty.includesDouble(twenty)); - assertEquals(false, tenToTwenty.includesDouble(twentyFive)); + assertEquals(false, tenToTwenty.containsDouble(five)); + assertEquals(true, tenToTwenty.containsDouble(ten)); + assertEquals(true, tenToTwenty.containsDouble(fifteen)); + assertEquals(true, tenToTwenty.containsDouble(twenty)); + assertEquals(false, tenToTwenty.containsDouble(twentyFive)); - assertEquals(false, tenToTwenty.includesDouble(long8)); - assertEquals(true, tenToTwenty.includesDouble(long10)); - assertEquals(true, tenToTwenty.includesDouble(long12)); - assertEquals(true, tenToTwenty.includesDouble(long20)); - assertEquals(false, tenToTwenty.includesDouble(long21)); + assertEquals(false, tenToTwenty.containsDouble(long8)); + assertEquals(true, tenToTwenty.containsDouble(long10)); + assertEquals(true, tenToTwenty.containsDouble(long12)); + assertEquals(true, tenToTwenty.containsDouble(long20)); + assertEquals(false, tenToTwenty.containsDouble(long21)); - assertEquals(false, tenToTwenty.includesDouble(double8)); - assertEquals(true, tenToTwenty.includesDouble(double10)); - assertEquals(true, tenToTwenty.includesDouble(double12)); - assertEquals(true, tenToTwenty.includesDouble(double20)); - assertEquals(false, tenToTwenty.includesDouble(double21)); + assertEquals(false, tenToTwenty.containsDouble(double8)); + assertEquals(true, tenToTwenty.containsDouble(double10)); + assertEquals(true, tenToTwenty.containsDouble(double12)); + assertEquals(true, tenToTwenty.containsDouble(double20)); + assertEquals(false, tenToTwenty.containsDouble(double21)); - assertEquals(false, tenToTwenty.includesDouble(float8)); - assertEquals(true, tenToTwenty.includesDouble(float10)); - assertEquals(true, tenToTwenty.includesDouble(float12)); - assertEquals(true, tenToTwenty.includesDouble(float20)); - assertEquals(false, tenToTwenty.includesDouble(float21)); + assertEquals(false, tenToTwenty.containsDouble(float8)); + assertEquals(true, tenToTwenty.containsDouble(float10)); + assertEquals(true, tenToTwenty.containsDouble(float12)); + assertEquals(true, tenToTwenty.containsDouble(float20)); + assertEquals(false, tenToTwenty.containsDouble(float21)); - assertEquals(false, tenToTwenty.includesDouble(9d)); - assertEquals(true, tenToTwenty.includesDouble(10d)); - assertEquals(true, tenToTwenty.includesDouble(15d)); - assertEquals(true, tenToTwenty.includesDouble(20d)); - assertEquals(false, tenToTwenty.includesDouble(21d)); + assertEquals(false, tenToTwenty.containsDouble(9d)); + assertEquals(true, tenToTwenty.containsDouble(10d)); + assertEquals(true, tenToTwenty.containsDouble(15d)); + assertEquals(true, tenToTwenty.containsDouble(20d)); + assertEquals(false, tenToTwenty.containsDouble(21d)); } - public void testIncludesFloat() { - assertEquals(false, tenToTwenty.includesFloat(null)); - assertEquals(true, tenToTwenty.includesFloat(nonComparable)); + public void testContainsFloat() { + assertEquals(false, tenToTwenty.containsFloat(null)); + assertEquals(true, tenToTwenty.containsFloat(nonComparable)); - assertEquals(false, tenToTwenty.includesFloat(five)); - assertEquals(true, tenToTwenty.includesFloat(ten)); - assertEquals(true, tenToTwenty.includesFloat(fifteen)); - assertEquals(true, tenToTwenty.includesFloat(twenty)); - assertEquals(false, tenToTwenty.includesFloat(twentyFive)); + assertEquals(false, tenToTwenty.containsFloat(five)); + assertEquals(true, tenToTwenty.containsFloat(ten)); + assertEquals(true, tenToTwenty.containsFloat(fifteen)); + assertEquals(true, tenToTwenty.containsFloat(twenty)); + assertEquals(false, tenToTwenty.containsFloat(twentyFive)); - assertEquals(false, tenToTwenty.includesFloat(long8)); - assertEquals(true, tenToTwenty.includesFloat(long10)); - assertEquals(true, tenToTwenty.includesFloat(long12)); - assertEquals(true, tenToTwenty.includesFloat(long20)); - assertEquals(false, tenToTwenty.includesFloat(long21)); + assertEquals(false, tenToTwenty.containsFloat(long8)); + assertEquals(true, tenToTwenty.containsFloat(long10)); + assertEquals(true, tenToTwenty.containsFloat(long12)); + assertEquals(true, tenToTwenty.containsFloat(long20)); + assertEquals(false, tenToTwenty.containsFloat(long21)); - assertEquals(false, tenToTwenty.includesFloat(double8)); - assertEquals(true, tenToTwenty.includesFloat(double10)); - assertEquals(true, tenToTwenty.includesFloat(double12)); - assertEquals(true, tenToTwenty.includesFloat(double20)); - assertEquals(false, tenToTwenty.includesFloat(double21)); + assertEquals(false, tenToTwenty.containsFloat(double8)); + assertEquals(true, tenToTwenty.containsFloat(double10)); + assertEquals(true, tenToTwenty.containsFloat(double12)); + assertEquals(true, tenToTwenty.containsFloat(double20)); + assertEquals(false, tenToTwenty.containsFloat(double21)); - assertEquals(false, tenToTwenty.includesFloat(float8)); - assertEquals(true, tenToTwenty.includesFloat(float10)); - assertEquals(true, tenToTwenty.includesFloat(float12)); - assertEquals(true, tenToTwenty.includesFloat(float20)); - assertEquals(false, tenToTwenty.includesFloat(float21)); + assertEquals(false, tenToTwenty.containsFloat(float8)); + assertEquals(true, tenToTwenty.containsFloat(float10)); + assertEquals(true, tenToTwenty.containsFloat(float12)); + assertEquals(true, tenToTwenty.containsFloat(float20)); + assertEquals(false, tenToTwenty.containsFloat(float21)); - assertEquals(false, tenToTwenty.includesFloat(9f)); - assertEquals(true, tenToTwenty.includesFloat(10f)); - assertEquals(true, tenToTwenty.includesFloat(15f)); - assertEquals(true, tenToTwenty.includesFloat(20f)); - assertEquals(false, tenToTwenty.includesFloat(21f)); + assertEquals(false, tenToTwenty.containsFloat(9f)); + assertEquals(true, tenToTwenty.containsFloat(10f)); + assertEquals(true, tenToTwenty.containsFloat(15f)); + assertEquals(true, tenToTwenty.containsFloat(20f)); + assertEquals(false, tenToTwenty.containsFloat(21f)); } //-------------------------------------------------------------------------- - public void testIncludesRange() { - assertEquals(false, tenToTwenty.includesRange(createRange(five, five))); - assertEquals(false, tenToTwenty.includesRange(createRange(five, ten))); - assertEquals(false, tenToTwenty.includesRange(createRange(five, twelve))); - assertEquals(false, tenToTwenty.includesRange(createRange(five, fifteen))); - assertEquals(false, tenToTwenty.includesRange(createRange(five, twenty))); - assertEquals(false, tenToTwenty.includesRange(createRange(five, twentyFive))); + public void testContainsRange() { + assertEquals(false, tenToTwenty.containsRange(createRange(five, five))); + assertEquals(false, tenToTwenty.containsRange(createRange(five, ten))); + assertEquals(false, tenToTwenty.containsRange(createRange(five, twelve))); + assertEquals(false, tenToTwenty.containsRange(createRange(five, fifteen))); + assertEquals(false, tenToTwenty.containsRange(createRange(five, twenty))); + assertEquals(false, tenToTwenty.containsRange(createRange(five, twentyFive))); - assertEquals(true, tenToTwenty.includesRange(createRange(ten, ten))); - assertEquals(true, tenToTwenty.includesRange(createRange(ten, twelve))); - assertEquals(true, tenToTwenty.includesRange(createRange(ten, fifteen))); - assertEquals(true, tenToTwenty.includesRange(createRange(ten, twenty))); - assertEquals(false, tenToTwenty.includesRange(createRange(ten, twentyFive))); + assertEquals(true, tenToTwenty.containsRange(createRange(ten, ten))); + assertEquals(true, tenToTwenty.containsRange(createRange(ten, twelve))); + assertEquals(true, tenToTwenty.containsRange(createRange(ten, fifteen))); + assertEquals(true, tenToTwenty.containsRange(createRange(ten, twenty))); + assertEquals(false, tenToTwenty.containsRange(createRange(ten, twentyFive))); - assertEquals(true, tenToTwenty.includesRange(createRange(twelve, twelve))); - assertEquals(true, tenToTwenty.includesRange(createRange(twelve, fifteen))); - assertEquals(true, tenToTwenty.includesRange(createRange(twelve, twenty))); - assertEquals(false, tenToTwenty.includesRange(createRange(twelve, twentyFive))); + assertEquals(true, tenToTwenty.containsRange(createRange(twelve, twelve))); + assertEquals(true, tenToTwenty.containsRange(createRange(twelve, fifteen))); + assertEquals(true, tenToTwenty.containsRange(createRange(twelve, twenty))); + assertEquals(false, tenToTwenty.containsRange(createRange(twelve, twentyFive))); - assertEquals(true, tenToTwenty.includesRange(createRange(fifteen, fifteen))); - assertEquals(true, tenToTwenty.includesRange(createRange(fifteen, twenty))); - assertEquals(false, tenToTwenty.includesRange(createRange(fifteen, twentyFive))); + assertEquals(true, tenToTwenty.containsRange(createRange(fifteen, fifteen))); + assertEquals(true, tenToTwenty.containsRange(createRange(fifteen, twenty))); + assertEquals(false, tenToTwenty.containsRange(createRange(fifteen, twentyFive))); - assertEquals(true, tenToTwenty.includesRange(createRange(twenty, twenty))); - assertEquals(false, tenToTwenty.includesRange(createRange(twenty, twentyFive))); + assertEquals(true, tenToTwenty.containsRange(createRange(twenty, twenty))); + assertEquals(false, tenToTwenty.containsRange(createRange(twenty, twentyFive))); - assertEquals(false, tenToTwenty.includesRange(createRange(twentyFive, twentyFive))); + assertEquals(false, tenToTwenty.containsRange(createRange(twentyFive, twentyFive))); } public void testOverlapsRange() { diff --git a/src/test/org/apache/commons/lang/math/DoubleRangeTest.java b/src/test/org/apache/commons/lang/math/DoubleRangeTest.java index a62f65ede..08f68e9e6 100644 --- a/src/test/org/apache/commons/lang/math/DoubleRangeTest.java +++ b/src/test/org/apache/commons/lang/math/DoubleRangeTest.java @@ -60,7 +60,7 @@ * Test cases for the {@link DoubleRange} class. * * @author Stephen Colebourne - * @version $Id: DoubleRangeTest.java,v 1.2 2003/06/08 14:19:43 scolebourne Exp $ + * @version $Id: DoubleRangeTest.java,v 1.3 2003/08/04 01:14:02 scolebourne Exp $ */ public final class DoubleRangeTest extends AbstractRangeTest { @@ -167,33 +167,33 @@ public void testConstructor2b() { //-------------------------------------------------------------------------- - public void testIncludesNumber() { - assertEquals(false, tenToTwenty.includesNumber(null)); - assertEquals(true, tenToTwenty.includesNumber(nonComparable)); + public void testContainsNumber() { + assertEquals(false, tenToTwenty.containsNumber(null)); + assertEquals(true, tenToTwenty.containsNumber(nonComparable)); - assertEquals(false, tenToTwenty.includesNumber(five)); - assertEquals(true, tenToTwenty.includesNumber(ten)); - assertEquals(true, tenToTwenty.includesNumber(fifteen)); - assertEquals(true, tenToTwenty.includesNumber(twenty)); - assertEquals(false, tenToTwenty.includesNumber(twentyFive)); + assertEquals(false, tenToTwenty.containsNumber(five)); + assertEquals(true, tenToTwenty.containsNumber(ten)); + assertEquals(true, tenToTwenty.containsNumber(fifteen)); + assertEquals(true, tenToTwenty.containsNumber(twenty)); + assertEquals(false, tenToTwenty.containsNumber(twentyFive)); - assertEquals(false, tenToTwenty.includesNumber(long8)); - assertEquals(true, tenToTwenty.includesNumber(long10)); - assertEquals(true, tenToTwenty.includesNumber(long12)); - assertEquals(true, tenToTwenty.includesNumber(long20)); - assertEquals(false, tenToTwenty.includesNumber(long21)); + assertEquals(false, tenToTwenty.containsNumber(long8)); + assertEquals(true, tenToTwenty.containsNumber(long10)); + assertEquals(true, tenToTwenty.containsNumber(long12)); + assertEquals(true, tenToTwenty.containsNumber(long20)); + assertEquals(false, tenToTwenty.containsNumber(long21)); - assertEquals(false, tenToTwenty.includesNumber(double8)); - assertEquals(true, tenToTwenty.includesNumber(double10)); - assertEquals(true, tenToTwenty.includesNumber(double12)); - assertEquals(true, tenToTwenty.includesNumber(double20)); - assertEquals(false, tenToTwenty.includesNumber(double21)); + assertEquals(false, tenToTwenty.containsNumber(double8)); + assertEquals(true, tenToTwenty.containsNumber(double10)); + assertEquals(true, tenToTwenty.containsNumber(double12)); + assertEquals(true, tenToTwenty.containsNumber(double20)); + assertEquals(false, tenToTwenty.containsNumber(double21)); - assertEquals(false, tenToTwenty.includesNumber(float8)); - assertEquals(true, tenToTwenty.includesNumber(float10)); - assertEquals(true, tenToTwenty.includesNumber(float12)); - assertEquals(true, tenToTwenty.includesNumber(float20)); - assertEquals(false, tenToTwenty.includesNumber(float21)); + assertEquals(false, tenToTwenty.containsNumber(float8)); + assertEquals(true, tenToTwenty.containsNumber(float10)); + assertEquals(true, tenToTwenty.containsNumber(float12)); + assertEquals(true, tenToTwenty.containsNumber(float20)); + assertEquals(false, tenToTwenty.containsNumber(float21)); } public void testToString() { diff --git a/src/test/org/apache/commons/lang/math/FloatRangeTest.java b/src/test/org/apache/commons/lang/math/FloatRangeTest.java index 76beb2f4e..3362a3649 100644 --- a/src/test/org/apache/commons/lang/math/FloatRangeTest.java +++ b/src/test/org/apache/commons/lang/math/FloatRangeTest.java @@ -60,7 +60,7 @@ * Test cases for the {@link FloatRange} class. * * @author Stephen Colebourne - * @version $Id: FloatRangeTest.java,v 1.2 2003/06/08 14:19:43 scolebourne Exp $ + * @version $Id: FloatRangeTest.java,v 1.3 2003/08/04 01:14:02 scolebourne Exp $ */ public final class FloatRangeTest extends AbstractRangeTest { @@ -167,33 +167,33 @@ public void testConstructor2b() { //-------------------------------------------------------------------------- - public void testIncludesNumber() { - assertEquals(false, tenToTwenty.includesNumber(null)); - assertEquals(true, tenToTwenty.includesNumber(nonComparable)); + public void testContainsNumber() { + assertEquals(false, tenToTwenty.containsNumber(null)); + assertEquals(true, tenToTwenty.containsNumber(nonComparable)); - assertEquals(false, tenToTwenty.includesNumber(five)); - assertEquals(true, tenToTwenty.includesNumber(ten)); - assertEquals(true, tenToTwenty.includesNumber(fifteen)); - assertEquals(true, tenToTwenty.includesNumber(twenty)); - assertEquals(false, tenToTwenty.includesNumber(twentyFive)); + assertEquals(false, tenToTwenty.containsNumber(five)); + assertEquals(true, tenToTwenty.containsNumber(ten)); + assertEquals(true, tenToTwenty.containsNumber(fifteen)); + assertEquals(true, tenToTwenty.containsNumber(twenty)); + assertEquals(false, tenToTwenty.containsNumber(twentyFive)); - assertEquals(false, tenToTwenty.includesNumber(long8)); - assertEquals(true, tenToTwenty.includesNumber(long10)); - assertEquals(true, tenToTwenty.includesNumber(long12)); - assertEquals(true, tenToTwenty.includesNumber(long20)); - assertEquals(false, tenToTwenty.includesNumber(long21)); + assertEquals(false, tenToTwenty.containsNumber(long8)); + assertEquals(true, tenToTwenty.containsNumber(long10)); + assertEquals(true, tenToTwenty.containsNumber(long12)); + assertEquals(true, tenToTwenty.containsNumber(long20)); + assertEquals(false, tenToTwenty.containsNumber(long21)); - assertEquals(false, tenToTwenty.includesNumber(double8)); - assertEquals(true, tenToTwenty.includesNumber(double10)); - assertEquals(true, tenToTwenty.includesNumber(double12)); - assertEquals(true, tenToTwenty.includesNumber(double20)); - assertEquals(false, tenToTwenty.includesNumber(double21)); + assertEquals(false, tenToTwenty.containsNumber(double8)); + assertEquals(true, tenToTwenty.containsNumber(double10)); + assertEquals(true, tenToTwenty.containsNumber(double12)); + assertEquals(true, tenToTwenty.containsNumber(double20)); + assertEquals(false, tenToTwenty.containsNumber(double21)); - assertEquals(false, tenToTwenty.includesNumber(float8)); - assertEquals(true, tenToTwenty.includesNumber(float10)); - assertEquals(true, tenToTwenty.includesNumber(float12)); - assertEquals(true, tenToTwenty.includesNumber(float20)); - assertEquals(false, tenToTwenty.includesNumber(float21)); + assertEquals(false, tenToTwenty.containsNumber(float8)); + assertEquals(true, tenToTwenty.containsNumber(float10)); + assertEquals(true, tenToTwenty.containsNumber(float12)); + assertEquals(true, tenToTwenty.containsNumber(float20)); + assertEquals(false, tenToTwenty.containsNumber(float21)); } public void testToString() { diff --git a/src/test/org/apache/commons/lang/math/IntRangeTest.java b/src/test/org/apache/commons/lang/math/IntRangeTest.java index e3f70e357..637d06e77 100644 --- a/src/test/org/apache/commons/lang/math/IntRangeTest.java +++ b/src/test/org/apache/commons/lang/math/IntRangeTest.java @@ -60,7 +60,7 @@ * Test cases for the {@link IntRange} class. * * @author Stephen Colebourne - * @version $Id: IntRangeTest.java,v 1.2 2003/06/08 14:19:43 scolebourne Exp $ + * @version $Id: IntRangeTest.java,v 1.3 2003/08/04 01:14:02 scolebourne Exp $ */ public final class IntRangeTest extends AbstractRangeTest { @@ -148,39 +148,39 @@ public void testConstructor2b() { //-------------------------------------------------------------------------- - public void testIncludesNumber() { - assertEquals(false, tenToTwenty.includesNumber(null)); - assertEquals(true, tenToTwenty.includesNumber(nonComparable)); + public void testContainsNumber() { + assertEquals(false, tenToTwenty.containsNumber(null)); + assertEquals(true, tenToTwenty.containsNumber(nonComparable)); - assertEquals(false, tenToTwenty.includesNumber(five)); - assertEquals(true, tenToTwenty.includesNumber(ten)); - assertEquals(true, tenToTwenty.includesNumber(fifteen)); - assertEquals(true, tenToTwenty.includesNumber(twenty)); - assertEquals(false, tenToTwenty.includesNumber(twentyFive)); + assertEquals(false, tenToTwenty.containsNumber(five)); + assertEquals(true, tenToTwenty.containsNumber(ten)); + assertEquals(true, tenToTwenty.containsNumber(fifteen)); + assertEquals(true, tenToTwenty.containsNumber(twenty)); + assertEquals(false, tenToTwenty.containsNumber(twentyFive)); - assertEquals(false, tenToTwenty.includesNumber(long8)); - assertEquals(true, tenToTwenty.includesNumber(long10)); - assertEquals(true, tenToTwenty.includesNumber(long12)); - assertEquals(true, tenToTwenty.includesNumber(long20)); - assertEquals(false, tenToTwenty.includesNumber(long21)); + assertEquals(false, tenToTwenty.containsNumber(long8)); + assertEquals(true, tenToTwenty.containsNumber(long10)); + assertEquals(true, tenToTwenty.containsNumber(long12)); + assertEquals(true, tenToTwenty.containsNumber(long20)); + assertEquals(false, tenToTwenty.containsNumber(long21)); - assertEquals(false, tenToTwenty.includesNumber(double8)); - assertEquals(true, tenToTwenty.includesNumber(double10)); - assertEquals(true, tenToTwenty.includesNumber(double12)); - assertEquals(true, tenToTwenty.includesNumber(double20)); - assertEquals(false, tenToTwenty.includesNumber(double21)); + assertEquals(false, tenToTwenty.containsNumber(double8)); + assertEquals(true, tenToTwenty.containsNumber(double10)); + assertEquals(true, tenToTwenty.containsNumber(double12)); + assertEquals(true, tenToTwenty.containsNumber(double20)); + assertEquals(false, tenToTwenty.containsNumber(double21)); - assertEquals(false, tenToTwenty.includesNumber(float8)); - assertEquals(true, tenToTwenty.includesNumber(float10)); - assertEquals(true, tenToTwenty.includesNumber(float12)); - assertEquals(true, tenToTwenty.includesNumber(float20)); - assertEquals(false, tenToTwenty.includesNumber(float21)); + assertEquals(false, tenToTwenty.containsNumber(float8)); + assertEquals(true, tenToTwenty.containsNumber(float10)); + assertEquals(true, tenToTwenty.containsNumber(float12)); + assertEquals(true, tenToTwenty.containsNumber(float20)); + assertEquals(false, tenToTwenty.containsNumber(float21)); } - public void testIncludesIntegerBig() { + public void testContainsIntegerBig() { IntRange big = new IntRange(Integer.MAX_VALUE, Integer.MAX_VALUE- 2); - assertEquals(true, big.includesInteger(Integer.MAX_VALUE - 1)); - assertEquals(false, big.includesInteger(Integer.MAX_VALUE - 3)); + assertEquals(true, big.containsInteger(Integer.MAX_VALUE - 1)); + assertEquals(false, big.containsInteger(Integer.MAX_VALUE - 3)); } //-------------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/lang/math/LongRangeTest.java b/src/test/org/apache/commons/lang/math/LongRangeTest.java index c4d4c77c8..154ac4098 100644 --- a/src/test/org/apache/commons/lang/math/LongRangeTest.java +++ b/src/test/org/apache/commons/lang/math/LongRangeTest.java @@ -60,7 +60,7 @@ * Test cases for the {@link LongRange} class. * * @author Stephen Colebourne - * @version $Id: LongRangeTest.java,v 1.2 2003/06/08 14:19:43 scolebourne Exp $ + * @version $Id: LongRangeTest.java,v 1.3 2003/08/04 01:14:02 scolebourne Exp $ */ public final class LongRangeTest extends AbstractRangeTest { @@ -148,39 +148,39 @@ public void testConstructor2b() { //-------------------------------------------------------------------------- - public void testIncludesNumber() { - assertEquals(false, tenToTwenty.includesNumber(null)); - assertEquals(true, tenToTwenty.includesNumber(nonComparable)); + public void testContainsNumber() { + assertEquals(false, tenToTwenty.containsNumber(null)); + assertEquals(true, tenToTwenty.containsNumber(nonComparable)); - assertEquals(false, tenToTwenty.includesNumber(five)); - assertEquals(true, tenToTwenty.includesNumber(ten)); - assertEquals(true, tenToTwenty.includesNumber(fifteen)); - assertEquals(true, tenToTwenty.includesNumber(twenty)); - assertEquals(false, tenToTwenty.includesNumber(twentyFive)); + assertEquals(false, tenToTwenty.containsNumber(five)); + assertEquals(true, tenToTwenty.containsNumber(ten)); + assertEquals(true, tenToTwenty.containsNumber(fifteen)); + assertEquals(true, tenToTwenty.containsNumber(twenty)); + assertEquals(false, tenToTwenty.containsNumber(twentyFive)); - assertEquals(false, tenToTwenty.includesNumber(long8)); - assertEquals(true, tenToTwenty.includesNumber(long10)); - assertEquals(true, tenToTwenty.includesNumber(long12)); - assertEquals(true, tenToTwenty.includesNumber(long20)); - assertEquals(false, tenToTwenty.includesNumber(long21)); + assertEquals(false, tenToTwenty.containsNumber(long8)); + assertEquals(true, tenToTwenty.containsNumber(long10)); + assertEquals(true, tenToTwenty.containsNumber(long12)); + assertEquals(true, tenToTwenty.containsNumber(long20)); + assertEquals(false, tenToTwenty.containsNumber(long21)); - assertEquals(false, tenToTwenty.includesNumber(double8)); - assertEquals(true, tenToTwenty.includesNumber(double10)); - assertEquals(true, tenToTwenty.includesNumber(double12)); - assertEquals(true, tenToTwenty.includesNumber(double20)); - assertEquals(false, tenToTwenty.includesNumber(double21)); + assertEquals(false, tenToTwenty.containsNumber(double8)); + assertEquals(true, tenToTwenty.containsNumber(double10)); + assertEquals(true, tenToTwenty.containsNumber(double12)); + assertEquals(true, tenToTwenty.containsNumber(double20)); + assertEquals(false, tenToTwenty.containsNumber(double21)); - assertEquals(false, tenToTwenty.includesNumber(float8)); - assertEquals(true, tenToTwenty.includesNumber(float10)); - assertEquals(true, tenToTwenty.includesNumber(float12)); - assertEquals(true, tenToTwenty.includesNumber(float20)); - assertEquals(false, tenToTwenty.includesNumber(float21)); + assertEquals(false, tenToTwenty.containsNumber(float8)); + assertEquals(true, tenToTwenty.containsNumber(float10)); + assertEquals(true, tenToTwenty.containsNumber(float12)); + assertEquals(true, tenToTwenty.containsNumber(float20)); + assertEquals(false, tenToTwenty.containsNumber(float21)); } - public void testIncludesLongBig() { + public void testContainsLongBig() { LongRange big = new LongRange(Long.MAX_VALUE, Long.MAX_VALUE- 2); - assertEquals(true, big.includesLong(Long.MAX_VALUE - 1)); - assertEquals(false, big.includesLong(Long.MAX_VALUE - 3)); + assertEquals(true, big.containsLong(Long.MAX_VALUE - 1)); + assertEquals(false, big.containsLong(Long.MAX_VALUE - 3)); } //-------------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/lang/math/NumberRangeTest.java b/src/test/org/apache/commons/lang/math/NumberRangeTest.java index 670c7273d..4fc1d21f5 100644 --- a/src/test/org/apache/commons/lang/math/NumberRangeTest.java +++ b/src/test/org/apache/commons/lang/math/NumberRangeTest.java @@ -62,7 +62,7 @@ * @author Christopher Elkins * @author Ringo De Smet * @author Stephen Colebourne - * @version $Id: NumberRangeTest.java,v 1.2 2003/06/08 14:19:43 scolebourne Exp $ + * @version $Id: NumberRangeTest.java,v 1.3 2003/08/04 01:14:02 scolebourne Exp $ */ public final class NumberRangeTest extends AbstractRangeTest { @@ -166,25 +166,25 @@ public void testConstructor2() { //-------------------------------------------------------------------------- - public void testIncludesNumber() { - assertEquals(false, tenToTwenty.includesNumber(null)); - assertEquals(false, tenToTwenty.includesNumber(five)); - assertEquals(true, tenToTwenty.includesNumber(ten)); - assertEquals(true, tenToTwenty.includesNumber(fifteen)); - assertEquals(true, tenToTwenty.includesNumber(twenty)); - assertEquals(false, tenToTwenty.includesNumber(twentyFive)); + public void testContainsNumber() { + assertEquals(false, tenToTwenty.containsNumber(null)); + assertEquals(false, tenToTwenty.containsNumber(five)); + assertEquals(true, tenToTwenty.containsNumber(ten)); + assertEquals(true, tenToTwenty.containsNumber(fifteen)); + assertEquals(true, tenToTwenty.containsNumber(twenty)); + assertEquals(false, tenToTwenty.containsNumber(twentyFive)); try { - tenToTwenty.includesNumber(long21); + tenToTwenty.containsNumber(long21); fail(); } catch (IllegalArgumentException ex) {} } - public void testIncludesLongBig() { + public void testContainsLongBig() { // original NumberRange class failed this test NumberRange big = new NumberRange(new Long(Long.MAX_VALUE), new Long(Long.MAX_VALUE- 2)); - assertEquals(true, big.includesLong(Long.MAX_VALUE - 1)); - assertEquals(false, big.includesLong(Long.MAX_VALUE - 3)); + assertEquals(true, big.containsLong(Long.MAX_VALUE - 1)); + assertEquals(false, big.containsLong(Long.MAX_VALUE - 3)); } //--------------------------------------------------------------------------