Package com.google.common.truth
Class ComparableSubject<S extends Subject<S,T>,T extends java.lang.Comparable>
- java.lang.Object
-
- com.google.common.truth.Subject<S,T>
-
- com.google.common.truth.ComparableSubject<S,T>
-
- Direct Known Subclasses:
BooleanSubject
,IntegerSubject
,LongSubject
,StringSubject
public abstract class ComparableSubject<S extends Subject<S,T>,T extends java.lang.Comparable> extends Subject<S,T>
Propositions forComparable
typed subjects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.HasField
-
-
Field Summary
-
Fields inherited from class com.google.common.truth.Subject
failureStrategy
-
-
Constructor Summary
Constructors Constructor Description ComparableSubject(FailureStrategy failureStrategy, T subject)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
comparesEqualTo(T other)
Fails if the subject is not equivalent to the given value according toComparable.compareTo(T)
.void
isAtLeast(T other)
Fails if the subject is less than the given value.void
isAtMost(T other)
Fails if the subject is greater than the given value.void
isGreaterThan(T other)
Fails if the subject is not greater than the given value.void
isIn(com.google.common.collect.Range<T> range)
Fails if the subject is not in the given range.void
isLessThan(T other)
Fails if the subject is not less than the given value.void
isNotIn(com.google.common.collect.Range<T> range)
Fails if the subject is in the given range.-
Methods inherited from class com.google.common.truth.Subject
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getDisplaySubject, getSubject, hasField, hashCode, internalCustomName, is, isA, isEqualTo, isInstanceOf, isNotA, isNotEqualTo, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, labeled, named
-
-
-
-
Constructor Detail
-
ComparableSubject
ComparableSubject(FailureStrategy failureStrategy, T subject)
-
-
Method Detail
-
isIn
public final void isIn(com.google.common.collect.Range<T> range)
Fails if the subject is not in the given range.
-
isNotIn
public final void isNotIn(com.google.common.collect.Range<T> range)
Fails if the subject is in the given range.
-
comparesEqualTo
public final void comparesEqualTo(T other)
Fails if the subject is not equivalent to the given value according toComparable.compareTo(T)
.
-
isGreaterThan
public final void isGreaterThan(T other)
Fails if the subject is not greater than the given value.
-
isLessThan
public final void isLessThan(T other)
Fails if the subject is not less than the given value.
-
isAtMost
public final void isAtMost(T other)
Fails if the subject is greater than the given value.
-
isAtLeast
public final void isAtLeast(T other)
Fails if the subject is less than the given value.
-
-