Package com.google.common.truth
Class OptionalLongSubject
- java.lang.Object
-
- com.google.common.truth.Subject
-
- com.google.common.truth.OptionalLongSubject
-
public final class OptionalLongSubject extends Subject
Propositions for Java 8OptionalLong
subjects.- 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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
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
isPresent()
Fails if theOptionalLong
is empty or the subject is null.static Subject.Factory<OptionalLongSubject,OptionalLong>
optionalLongs()
Deprecated.Instead ofabout(optionalLongs()).that(...)
, use justthat(...)
.-
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 Detail
-
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
@Deprecated public static Subject.Factory<OptionalLongSubject,OptionalLong> optionalLongs()
Deprecated.Instead ofabout(optionalLongs()).that(...)
, use justthat(...)
. Similarly, instead ofassertAbout(optionalLongs()).that(...)
, use justassertThat(...)
.Obsolete factory instance. This factory was previously necessary for assertions likeassertWithMessage(...).about(optionalLongs()).that(optional)....
. Now, you can perform assertions like that without theabout(...)
call.
-
-