S
- deprecated - the self-type, allowing this
-returning methods to avoid
needing subclassing. This type parameter will be removed, as the method that needs it is
being removed. You can prepare for this change by editing your class to refer to raw ComparableSubject
today and then, after the removal, editing it to refer to ComparableSubject<T>
(with a single type parameter).T
- the type of the object being tested by this ComparableSubject
public abstract class ComparableSubject<S extends ComparableSubject<S,T>,T extends Comparable> extends Subject<S,T>
Comparable
typed subjects.Subject.Factory<SubjectT extends Subject,ActualT>
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 . |
actual, actualAsString, actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, named, 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.