S
- the "self" type of this assertion class. Please read "Emulating
'self types' using Java Generics to simplify fluent API implementation" for more details.A
- the type of the "actual" value.public interface ComparableAssert<S extends ComparableAssert<S,A>,A extends Comparable<? super A>>
Comparable
s.Modifier and Type | Method and Description |
---|---|
S |
isEqualByComparingTo(A other)
Verifies that the actual value is equal to the given one by invoking
. |
S |
isGreaterThan(A other)
Verifies that the actual value is greater than the given one.
|
S |
isGreaterThanOrEqualTo(A other)
Verifies that the actual value is greater than or equal to the given one.
|
S |
isLessThan(A other)
Verifies that the actual value is less than the given one.
|
S |
isLessThanOrEqualTo(A other)
Verifies that the actual value is less than or equal to the given one.
|
S |
isNotEqualByComparingTo(A other)
Verifies that the actual value is not equal to the given one by invoking
. |
S isEqualByComparingTo(A other)
Comparable.compareTo(Object)
.
Example:
// assertion will pass
assertThat(1.0).isEqualByComparingTo(1.0);
// assertion will pass because 8.0 is equal to 8.00 using BigDecimal.compareTo(BigDecimal)
assertThat(new BigDecimal("8.0")).isEqualByComparingTo(new BigDecimal("8.00"));
// assertion will fail
assertThat(new BigDecimal(1.0)).isEqualByComparingTo(new BigDecimal(2.0));
other
- the given value to compare the actual value to.this
assertion object.AssertionError
- if the actual value is null
.AssertionError
- if the actual value is not equal when comparing to the given one.S isNotEqualByComparingTo(A other)
Comparable.compareTo(Object)
.
Example:
// assertion will pass
assertThat(new BigDecimal(1.0)).isNotEqualByComparingTo(new BigDecimal(2.0));
// assertion will fail
assertThat(1.0).isNotEqualByComparingTo(1.0);
// assertion will fail because 8.0 is equal to 8.00 using BigDecimal.compareTo(BigDecimal)
assertThat(new BigDecimal("8.0")).isNotEqualByComparingTo(new BigDecimal("8.00"));
other
- the given value to compare the actual value to.this
assertion object.AssertionError
- if the actual value is null
.AssertionError
- if the actual value is equal when comparing to the given one.S isLessThan(A other)
other
- the given value to compare the actual value to.this
assertion object.AssertionError
- if the actual value is null
.AssertionError
- if the actual value is equal to or greater than the given one.S isLessThanOrEqualTo(A other)
other
- the given value to compare the actual value to.this
assertion object.AssertionError
- if the actual value is null
.AssertionError
- if the actual value is greater than the given one.S isGreaterThan(A other)
other
- the given value to compare the actual value to.this
assertion object.AssertionError
- if the actual value is null
.AssertionError
- if the actual value is equal to or less than the given one.S isGreaterThanOrEqualTo(A other)
other
- the given value to compare the actual value to.this
assertion object.AssertionError
- if the actual value is null
.AssertionError
- if the actual value is less than the given one.Copyright © 2014–2016 AssertJ. All rights reserved.