org.jtiger.assertion
Class Comparable

java.lang.Object
  extended by org.jtiger.assertion.Comparable

public final class Comparable
extends Object

Makes assertions on instances of java.lang.Comparable. This requires the creation of an instance of ObjectFactory to return instances to use to test. The given ObjectFactory must meet the its own general contract.

Version:
2.1
Build Number 0376
Build Time 2006-07-28 01:50.16.218 CET (GMT + 1)
Author:
Tony Morris
See Also:
ObjectFactory, ObjectFactoryContract, Comparable

Method Summary
static void assertEqualComparesToZero(ObjectFactory<? extends Comparable<?>> factory, Object... message)
          Asserts that two equal instances of java.lang.Comparable return zero (0) from the compareTo method.
static void assertNotEqualNotComparesToZero(ObjectFactory<? extends Comparable<?>> factory, Object... message)
          Asserts that two unequal instances of java.lang.Comparable return non-zero from the compareTo method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertEqualComparesToZero

public static void assertEqualComparesToZero(ObjectFactory<? extends Comparable<?>> factory,
                                             Object... message)
                                      throws AssertionException
Asserts that two equal instances of java.lang.Comparable return zero (0) from the compareTo method.

Parameters:
factory - The factory to use to return instances for making the assertion.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that are equal but do not return zero (0) from the compareTo method, or the compareTo method cannot be invoked through reflection.

assertNotEqualNotComparesToZero

public static void assertNotEqualNotComparesToZero(ObjectFactory<? extends Comparable<?>> factory,
                                                   Object... message)
                                            throws AssertionException
Asserts that two unequal instances of java.lang.Comparable return non-zero from the compareTo method.

Parameters:
factory - The factory to use to return instances for making the assertion.
message - The assertion message.
Throws:
AssertionException - If the given ObjectFactory returns instances that are unequal and return zero (0) from the compareTo method, or the compareTo method cannot be invoked through reflection.