Class OptionalIntSubject
java.lang.Object
com.google.common.truth.Subject
com.google.common.truth.OptionalIntSubject
A subject for
OptionalInt
values.- Since:
- 1.3.0 (previously part of
truth-java8-extension
) - Author:
- Ben Douglass
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.Factory<SubjectT extends Subject, ActualT>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
hasValue
(int expected) Checks that the actualOptionalInt
contains the given value.void
isEmpty()
Checks that the actualOptionalInt
does not contain a value.void
Checks that the actualOptionalInt
contains a value.static Subject.Factory
<OptionalIntSubject, OptionalInt> Deprecated.Methods inherited from class com.google.common.truth.Subject
actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString
-
Method Details
-
isPresent
public void isPresent()Checks that the actualOptionalInt
contains a value. -
isEmpty
public void isEmpty()Checks that the actualOptionalInt
does not contain a value. -
hasValue
public void hasValue(int expected) Checks that the actualOptionalInt
contains the given value. More sophisticated comparisons can be done usingassertThat(optional.getAsInt())…
. -
optionalInts
Deprecated.Instead ofabout(optionalInts()).that(...)
, use justthat(...)
. Similarly, instead ofassertAbout(optionalInts()).that(...)
, use justassertThat(...)
.Obsolete factory instance. This factory was previously necessary for assertions likeassertWithMessage(...).about(optionalInts()).that(optional)....
. Now, you can perform assertions like that without theabout(...)
call.
-
about(optionalInts()).that(...)
, use justthat(...)
.