Package com.google.common.truth
Class OptionalLongSubject
java.lang.Object
com.google.common.truth.Subject
com.google.common.truth.OptionalLongSubject
Propositions for Java 8
OptionalLong
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
ConstructorsConstructorDescriptionOptionalLongSubject
(FailureMetadata failureMetadata, OptionalLong subject, String typeDescription) -
Method Summary
Modifier and TypeMethodDescriptionvoid
hasValue
(long expected) Fails if theOptionalLong
does not have the given value or the subject is null.void
isEmpty()
Fails if theOptionalLong
is present or the subject is null.void
Fails if theOptionalLong
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
-
OptionalLongSubject
OptionalLongSubject(FailureMetadata failureMetadata, OptionalLong subject, String typeDescription)
-
-
Method Details
-
isPresent
public void isPresent()Fails if theOptionalLong
is empty or the subject is null. -
isEmpty
public void isEmpty()Fails if theOptionalLong
is present or the subject is null. -
hasValue
public void hasValue(long expected) Fails if theOptionalLong
does not have the given value or the subject is null. More sophisticated comparisons can be done usingassertThat(optional.getAsLong())…
. -
optionalLongs
-