public abstract class ComparableSubject<S extends ComparableSubject<S,T>,T extends Comparable> extends Subject<S,T>
Comparable typed subjects.| Modifier | Constructor and Description |
|---|---|
protected |
ComparableSubject(FailureMetadata metadata,
T actual)
Constructor for use by subclasses.
|
| 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, check, equals, fail, fail, fail, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutSubject, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNotSameInstanceAs, isNull, isSameAs, isSameInstanceAs, named, toStringprotected ComparableSubject(FailureMetadata metadata, @NullableDecl T actual)
Subject.check().that(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.