Class OptionalLongSubject


  • public final class OptionalLongSubject
    extends Subject
    Propositions for Java 8 OptionalLong subjects.
    Since:
    1.3.0 (previously part of truth-java8-extension)
    Author:
    Ben Douglass
    • Method Detail

      • isPresent

        public void isPresent()
        Fails if the OptionalLong is empty or the subject is null.
      • isEmpty

        public void isEmpty()
        Fails if the OptionalLong is present or the subject is null.
      • hasValue

        public void hasValue​(long expected)
        Fails if the OptionalLong does not have the given value or the subject is null. More sophisticated comparisons can be done using assertThat(optional.getAsLong())….
      • optionalLongs

        @Deprecated
        public static Subject.Factory<OptionalLongSubject,​OptionalLong> optionalLongs()
        Deprecated.
        Instead of about(optionalLongs()).that(...), use just that(...). Similarly, instead of assertAbout(optionalLongs()).that(...), use just assertThat(...).
        Obsolete factory instance. This factory was previously necessary for assertions like assertWithMessage(...).about(optionalLongs()).that(optional)..... Now, you can perform assertions like that without the about(...) call.