|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.assertions.internal.Comparables
public class Comparables
Reusable assertions for
s.
Comparable
Constructor Summary | |
---|---|
Comparables(org.fest.util.ComparisonStrategy comparisonStrategy)
|
Method Summary | ||
---|---|---|
protected
|
areEqual(T actual,
T expected)
|
|
|
assertEqual(AssertionInfo info,
T actual,
T expected)
Asserts that two T instances are equal. |
|
|
assertEqualByComparison(AssertionInfo info,
T actual,
T expected)
Asserts that two s are equal by invoking
. |
|
|
assertGreaterThan(AssertionInfo info,
T actual,
T other)
Asserts that the actual value is greater than the other one. |
|
|
assertGreaterThanOrEqualTo(AssertionInfo info,
T actual,
T other)
Asserts that the actual value is greater than or equal to the other one. |
|
|
assertLessThan(AssertionInfo info,
T actual,
T other)
Asserts that the actual value is less than the other one. |
|
|
assertLessThanOrEqualTo(AssertionInfo info,
T actual,
T other)
Asserts that the actual value is less than or equal to the other one. |
|
|
assertNotEqual(AssertionInfo info,
T actual,
T other)
Asserts that two T instances are not equal. |
|
|
assertNotEqualByComparison(AssertionInfo info,
T actual,
T other)
Asserts that two s are not equal by invoking
. |
|
protected static
|
assertNotNull(AssertionInfo info,
T actual)
|
|
Comparator<?> |
getComparator()
|
|
static Comparables |
instance()
Returns the singleton instance of this class based on StandardComparisonStrategy . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Comparables(org.fest.util.ComparisonStrategy comparisonStrategy)
Method Detail |
---|
public static Comparables instance()
StandardComparisonStrategy
.
StandardComparisonStrategy
.public Comparator<?> getComparator()
public <T> void assertEqual(AssertionInfo info, T actual, T expected)
info
- contains information about the assertion.actual
- the actual value.expected
- the expected value.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is not equal to the expected one. This method will throw a
org.junit.ComparisonFailure
instead if JUnit is in the classpath and the expected and actual
values are not equal.protected <T> boolean areEqual(T actual, T expected)
public <T> void assertNotEqual(AssertionInfo info, T actual, T other)
info
- contains information about the assertion.actual
- the actual value.other
- the value to compare the actual value to.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is equal to the other one.public <T extends Comparable<? super T>> void assertEqualByComparison(AssertionInfo info, T actual, T expected)
Comparable
s are equal by invoking
Comparable.compareTo(Object)
.comparisonStrategy
if one has been set.
T
- used to guarantee that two objects of the same type are being compared against each other.info
- contains information about the assertion.actual
- the actual value.expected
- the expected value.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is not equal to the expected one. This method will throw a
org.junit.ComparisonFailure
instead if JUnit is in the classpath and the expected and actual
values are not equal.public <T extends Comparable<? super T>> void assertNotEqualByComparison(AssertionInfo info, T actual, T other)
Comparable
s are not equal by invoking
Comparable.compareTo(Object)
.comparisonStrategy
if one has been set.
T
- used to guarantee that two objects of the same type are being compared against each other.info
- contains information about the assertion.actual
- the actual value.other
- the value to compare the actual value to.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is equal to the other one.public <T extends Comparable<? super T>> void assertLessThan(AssertionInfo info, T actual, T other)
T
- used to guarantee that two objects of the same type are being compared against each other.info
- contains information about the assertion.actual
- the actual value.other
- the value to compare the actual value to.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is not less than the other one: this assertion will
fail if the actual value is equal to or greater than the other value.public <T extends Comparable<? super T>> void assertLessThanOrEqualTo(AssertionInfo info, T actual, T other)
T
- used to guarantee that two objects of the same type are being compared against each other.info
- contains information about the assertion.actual
- the actual value.other
- the value to compare the actual value to.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is greater than the other one.public <T extends Comparable<? super T>> void assertGreaterThan(AssertionInfo info, T actual, T other)
T
- used to guarantee that two objects of the same type are being compared against each other.info
- contains information about the assertion.actual
- the actual value.other
- the value to compare the actual value to.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is not greater than the other one: this assertion will
fail if the actual value is equal to or less than the other value.public <T extends Comparable<? super T>> void assertGreaterThanOrEqualTo(AssertionInfo info, T actual, T other)
T
- used to guarantee that two objects of the same type are being compared against each other.info
- contains information about the assertion.actual
- the actual value.other
- the value to compare the actual value to.
AssertionError
- if the actual value is null
.
AssertionError
- if the actual value is less than the other one.protected static <T> void assertNotNull(AssertionInfo info, T actual)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |