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

java.lang.Object
  extended by org.fest.assertions.Assert
      extended by org.fest.assertions.GenericAssert<T>
          extended by org.fest.assertions.ComparableAssert<T>
Type Parameters:
T - the type of Comparable this template can verify.
Direct Known Subclasses:
BigDecimalAssert

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

Understands a template for assertion methods, applicable to Comparables.

Author:
Alex Ruiz

Field Summary
 
Fields inherited from class org.fest.assertions.GenericAssert
actual
 
Constructor Summary
protected ComparableAssert(T actual)
          Creates a new ComparableAssert.
 
Method Summary
protected  void assertIsEqualByComparingTo(T expected)
          Verifies that the actual Comparable is equal to the given one.
protected  void assertIsGreaterThan(T other)
          Verifies that the actual Comparable is greater than the given one.
protected  void assertIsGreaterThanOrEqualTo(T other)
          Verifies that the actual Comparable is greater than or equal to the given one.
protected  void assertIsLessThan(T other)
          Verifies that the actual Comparable is less than the given one.
protected  void assertIsLessThanOrEqualTo(T other)
          Verifies that the actual Comparable is less than or equal to the given one.
protected  void assertIsNotEqualByComparingTo(T expected)
          Verifies that the actual Comparable is not equal to the given one.
protected abstract  ComparableAssert<T> isEqualByComparingTo(T expected)
          Verifies that the actual Comparable is equal to the given one.
protected abstract  ComparableAssert<T> isGreaterThan(T other)
          Verifies that the actual Comparable is greater than the given one.
protected abstract  ComparableAssert<T> isGreaterThanOrEqualTo(T other)
          Verifies that the actual Comparable is greater than or equal to the given one.
protected abstract  ComparableAssert<T> isLessThan(T other)
          Verifies that the actual Comparable is less than the given one.
protected abstract  ComparableAssert<T> isLessThanOrEqualTo(T other)
          Verifies that the actual Comparable is less than or equal to the given one.
protected abstract  ComparableAssert<T> 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, assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, describedAs, describedAs, doesNotSatisfy, is, isEqualTo, isNot, isNotEqualTo, 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(T actual)
Creates a new ComparableAssert.

Parameters:
actual - the target to verify.
Method Detail

isEqualByComparingTo

protected abstract ComparableAssert<T> 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

protected abstract ComparableAssert<T> 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

protected abstract ComparableAssert<T> 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

protected abstract ComparableAssert<T> 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

protected abstract ComparableAssert<T> 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

protected abstract ComparableAssert<T> 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.

assertIsEqualByComparingTo

protected final void assertIsEqualByComparingTo(T expected)
Verifies that the actual Comparable is equal to the given one.

Parameters:
expected - the given Comparable to compare the actual Comparable to.
Throws:
AssertionError - if the actual Comparable value is null.
AssertionError - if the actual Comparable value is not equal to the given one.

assertIsNotEqualByComparingTo

protected final void assertIsNotEqualByComparingTo(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.
Throws:
AssertionError - if the actual Comparable is null.
AssertionError - if the actual Comparable is equal to the given one.

assertIsLessThan

protected final void assertIsLessThan(T other)
Verifies that the actual Comparable is less than the given one.

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

assertIsGreaterThan

protected final void assertIsGreaterThan(T other)
Verifies that the actual Comparable is greater than the given one.

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

assertIsLessThanOrEqualTo

protected final void assertIsLessThanOrEqualTo(T other)
Verifies that the actual Comparable is less than or equal to the given one.

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

assertIsGreaterThanOrEqualTo

protected final void assertIsGreaterThanOrEqualTo(T other)
Verifies that the actual Comparable is greater than or equal to the given one.

Parameters:
other - the given value.
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.