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 |
comparesEqualTo(T other)
Deprecated.
Use
isEquivalentAccordingToCompareTo(T) instead. |
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, failComparing, failComparing, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutSubject, failWithRawMessage, failWithRawMessageAndCause, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, named, toString
protected 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)
.
@Deprecated public void comparesEqualTo(T other)
isEquivalentAccordingToCompareTo(T)
instead.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 © 2018. All rights reserved.