org.fest.assertions
Class ComparableAssert<S,T extends Comparable<T>>

java.lang.Object
  extended by org.fest.assertions.Assert
      extended by org.fest.assertions.GenericAssert<S,T>
          extended by org.fest.assertions.ComparableAssert<S,T>
Type Parameters:
S - used to simulate "self types." For more information please read "Emulating 'self types' using Java Generics to simplify fluent API implementation."
T - the type of the "actual" value.
Direct Known Subclasses:
BigDecimalAssert

public abstract class ComparableAssert<S,T extends Comparable<T>>
extends GenericAssert<S,T>

Template for assertions applicable to Comparables.

Author:
Alex Ruiz, Ted M. Young

Field Summary
 
Fields inherited from class org.fest.assertions.GenericAssert
actual, myself
 
Constructor Summary
protected ComparableAssert(Class<S> selfType, T actual)
          Creates a new ComparableAssert.
 
Method Summary
 S isEqualByComparingTo(T expected)
          Verifies that the actual Comparable is equal to the given one.
 S isGreaterThan(T other)
          Verifies that the actual Comparable is greater than the given one.
 S isGreaterThanOrEqualTo(T other)
          Verifies that the actual Comparable is greater than or equal to the given one.
 S isLessThan(T other)
          Verifies that the actual Comparable is less than the given one.
 S isLessThanOrEqualTo(T other)
          Verifies that the actual Comparable is less than or equal to the given one.
 S isNotEqualByComparingTo(T expected)
          Verifies that the actual Comparable is not equal to the given one.
 
Methods inherited from class org.fest.assertions.GenericAssert
as, as, describedAs, describedAs, doesNotSatisfy, is, isEqualTo, isIn, isIn, isNot, isNotEqualTo, isNotIn, isNotIn, isNotNull, isNotSameAs, isNull, isSameAs, overridingErrorMessage, satisfies
 
Methods inherited from class org.fest.assertions.Assert
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparableAssert

protected ComparableAssert(Class<S> selfType,
                           T actual)
Creates a new ComparableAssert.

Parameters:
selfType - the "self type."
actual - the target to verify.
Method Detail

isEqualByComparingTo

public final S isEqualByComparingTo(T expected)
Verifies that the actual Comparable is equal to the given one.

Parameters:
expected - the given Comparable to compare the actual Comparable to.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Comparable is null.
AssertionError - if the actual Comparable is not equal to the given one.

isNotEqualByComparingTo

public final S isNotEqualByComparingTo(T expected)
Verifies that the actual Comparable is not equal to the given one.

Parameters:
expected - the given Comparable to use to compare to the actual Comparable.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Comparable is null.
AssertionError - if the actual Comparable is equal to the given one.

isLessThan

public final S isLessThan(T other)
Verifies that the actual Comparable is less than the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Comparable is null.
AssertionError - if the actual Comparable is not less than the given one.

isGreaterThan

public final S isGreaterThan(T other)
Verifies that the actual Comparable is greater than the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Comparable is null.
AssertionError - if the actual Comparable is not greater than the given one.

isLessThanOrEqualTo

public final S isLessThanOrEqualTo(T other)
Verifies that the actual Comparable is less than or equal to the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Comparable is null.
AssertionError - if the actual Comparable is not less than or equal to the given one.

isGreaterThanOrEqualTo

public final S isGreaterThanOrEqualTo(T other)
Verifies that the actual Comparable is greater than or equal to the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Comparable is null.
AssertionError - if the actual Comparable is not greater than or equal to the given one.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.