Package com.google.common.truth
Class OptionalIntSubject
java.lang.Object
com.google.common.truth.Subject
com.google.common.truth.OptionalIntSubject
Propositions for Java 8
OptionalInt
subjects.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.EqualityCheck, Subject.Factory<SubjectT extends Subject,
ActualT> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOptionalIntSubject
(FailureMetadata failureMetadata, OptionalInt subject, String typeDescription) -
Method Summary
Modifier and TypeMethodDescriptionvoid
hasValue
(int expected) Fails if theOptionalInt
does not have the given value or the subject is null.void
isEmpty()
Fails if theOptionalInt
is present or the subject is null.void
Fails if theOptionalInt
is empty or the subject is null.Methods inherited from class com.google.common.truth.Subject
actual, actualCustomStringRepresentation, actualCustomStringRepresentationForPackageMembersToCall, butWas, check, check, checkNoNeedToDisplayBothValues, equals, fail, fail, fail, failEqualityCheckForEqualsWithoutDescription, failWithActual, failWithActual, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutSubject, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString, typeDescription
-
Field Details
-
actual
-
-
Constructor Details
-
OptionalIntSubject
OptionalIntSubject(FailureMetadata failureMetadata, OptionalInt subject, String typeDescription)
-
-
Method Details
-
isPresent
public void isPresent()Fails if theOptionalInt
is empty or the subject is null. -
isEmpty
public void isEmpty()Fails if theOptionalInt
is present or the subject is null. -
hasValue
public void hasValue(int expected) Fails if theOptionalInt
does not have the given value or the subject is null. More sophisticated comparisons can be done usingassertThat(optional.getAsInt())…
. -
optionalInts
-