Package org.fest.assertions.internal
Class Comparables
- java.lang.Object
- 
- org.fest.assertions.internal.Comparables
 
- 
- Direct Known Subclasses:
- Characters,- Numbers
 
 public class Comparables extends java.lang.ObjectReusable assertions forComparable- Author:
- Alex Ruiz, Joel Costigliola
 
- 
- 
Constructor SummaryConstructors Constructor Description Comparables(ComparisonStrategy comparisonStrategy)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> booleanareEqual(T actual, T expected)<T> voidassertEqual(AssertionInfo info, T actual, T expected)Asserts that two T instances are equal.<T extends java.lang.Comparable<? super T>>
 voidassertEqualByComparison(AssertionInfo info, T actual, T expected)Asserts that twoComparableComparable.compareTo(Object)
 Note that it does not rely on the customcomparisonStrategyif one has been set.<T extends java.lang.Comparable<? super T>>
 voidassertGreaterThan(AssertionInfo info, T actual, T other)Asserts that the actual value is greater than the other one.<T extends java.lang.Comparable<? super T>>
 voidassertGreaterThanOrEqualTo(AssertionInfo info, T actual, T other)Asserts that the actual value is greater than or equal to the other one.<T extends java.lang.Comparable<? super T>>
 voidassertLessThan(AssertionInfo info, T actual, T other)Asserts that the actual value is less than the other one.<T extends java.lang.Comparable<? super T>>
 voidassertLessThanOrEqualTo(AssertionInfo info, T actual, T other)Asserts that the actual value is less than or equal to the other one.<T> voidassertNotEqual(AssertionInfo info, T actual, T other)Asserts that two T instances are not equal.<T extends java.lang.Comparable<? super T>>
 voidassertNotEqualByComparison(AssertionInfo info, T actual, T other)Asserts that twoComparableComparable.compareTo(Object)
 Note that it does not rely on the customcomparisonStrategyif one has been set.protected static <T> voidassertNotNull(AssertionInfo info, T actual)java.util.Comparator<?>getComparator()static Comparablesinstance()Returns the singleton instance of this class based onStandardComparisonStrategy.
 
- 
- 
- 
Constructor Detail- 
Comparablespublic Comparables(ComparisonStrategy comparisonStrategy) 
 
- 
 - 
Method Detail- 
instancepublic static Comparables instance() Returns the singleton instance of this class based onStandardComparisonStrategy.- Returns:
- the singleton instance of this class based on StandardComparisonStrategy.
 
 - 
getComparatorpublic java.util.Comparator<?> getComparator() 
 - 
assertEqualpublic <T> void assertEqual(AssertionInfo info, T actual, T expected) Asserts that two T instances are equal.- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- expected- the expected value.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.AssertionError- if the actual value is not equal to the expected one. This method will throw a- org.junit.ComparisonFailureinstead if JUnit is in the classpath and the expected and actual values are not equal.
 
 - 
areEqualprotected <T> boolean areEqual(T actual, T expected)
 - 
assertNotEqualpublic <T> void assertNotEqual(AssertionInfo info, T actual, T other) Asserts that two T instances are not equal.- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- other- the value to compare the actual value to.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.AssertionError- if the actual value is equal to the other one.
 
 - 
assertEqualByComparisonpublic <T extends java.lang.Comparable<? super T>> void assertEqualByComparison(AssertionInfo info, T actual, T expected) Asserts that twoComparableComparable.compareTo(Object)
 Note that it does not rely on the customcomparisonStrategyif one has been set.- Type Parameters:
- T- used to guarantee that two objects of the same type are being compared against each other.
- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- expected- the expected value.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.AssertionError- if the actual value is not equal to the expected one. This method will throw a- org.junit.ComparisonFailureinstead if JUnit is in the classpath and the expected and actual values are not equal.
 
 - 
assertNotEqualByComparisonpublic <T extends java.lang.Comparable<? super T>> void assertNotEqualByComparison(AssertionInfo info, T actual, T other) Asserts that twoComparableComparable.compareTo(Object)
 Note that it does not rely on the customcomparisonStrategyif one has been set.- Type Parameters:
- T- used to guarantee that two objects of the same type are being compared against each other.
- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- other- the value to compare the actual value to.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.AssertionError- if the actual value is equal to the other one.
 
 - 
assertLessThanpublic <T extends java.lang.Comparable<? super T>> void assertLessThan(AssertionInfo info, T actual, T other) Asserts that the actual value is less than the other one.- Type Parameters:
- T- used to guarantee that two objects of the same type are being compared against each other.
- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- other- the value to compare the actual value to.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.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.
 
 - 
assertLessThanOrEqualTopublic <T extends java.lang.Comparable<? super T>> void assertLessThanOrEqualTo(AssertionInfo info, T actual, T other) Asserts that the actual value is less than or equal to the other one.- Type Parameters:
- T- used to guarantee that two objects of the same type are being compared against each other.
- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- other- the value to compare the actual value to.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.AssertionError- if the actual value is greater than the other one.
 
 - 
assertGreaterThanpublic <T extends java.lang.Comparable<? super T>> void assertGreaterThan(AssertionInfo info, T actual, T other) Asserts that the actual value is greater than the other one.- Type Parameters:
- T- used to guarantee that two objects of the same type are being compared against each other.
- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- other- the value to compare the actual value to.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.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.
 
 - 
assertGreaterThanOrEqualTopublic <T extends java.lang.Comparable<? super T>> void assertGreaterThanOrEqualTo(AssertionInfo info, T actual, T other) Asserts that the actual value is greater than or equal to the other one.- Type Parameters:
- T- used to guarantee that two objects of the same type are being compared against each other.
- Parameters:
- info- contains information about the assertion.
- actual- the actual value.
- other- the value to compare the actual value to.
- Throws:
- java.lang.AssertionError- if the actual value is- null.
- java.lang.AssertionError- if the actual value is less than the other one.
 
 - 
assertNotNullprotected static <T> void assertNotNull(AssertionInfo info, T actual) 
 
- 
 
-