T
- the type of the object being tested by this ComparableSubject
public abstract class ComparableSubject<T extends Comparable> extends Subject
Comparable
typed subjects.Modifier | Constructor and Description |
---|---|
protected |
ComparableSubject(FailureMetadata metadata,
T actual) |
Modifier and Type | Method and Description |
---|---|
void |
isAtLeast(T other)
Checks that the subject is greater than or equal to
other . |
void |
isAtMost(T other)
Checks that the subject is less than or equal to
other . |
void |
isEquivalentAccordingToCompareTo(T expected)
Checks that the subject is equivalent to
other according to Comparable.compareTo(T) , (i.e., checks that a.comparesTo(b) == 0 ). |
void |
isGreaterThan(T other)
Checks that the subject is greater than
other . |
void |
isIn(Range<T> range)
Checks that the subject is in
range . |
void |
isLessThan(T other)
Checks that the subject is less than
other . |
void |
isNotIn(Range<T> range)
Checks that the subject is not in
range . |
actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString
protected ComparableSubject(FailureMetadata metadata, @NullableDecl T actual)
public void isEquivalentAccordingToCompareTo(T expected)
other
according to Comparable.compareTo(T)
, (i.e., checks that a.comparesTo(b) == 0
).
Note: Do not use this method for checking object equality. Instead, use Subject.isEqualTo(Object)
.
public final void isGreaterThan(T other)
other
.
Use isAtLeast(T)
to check that the subject is greater than or equal to other
.
public final void isLessThan(T other)
other
.
Use isAtMost(T)
to check that the subject is less than or equal to other
.
public final void isAtMost(T other)
other
.
Use isLessThan(T)
to check that the subject is less than other
.
public final void isAtLeast(T other)
other
.
Use isGreaterThan(T)
to check that the subject is greater than other
.
Copyright © 2019. All rights reserved.