Class OptionalLongSubject

java.lang.Object
com.google.common.truth.Subject
com.google.common.truth.OptionalLongSubject

public final class OptionalLongSubject extends Subject
A subject for OptionalLong values.
Since:
1.3.0 (previously part of truth-java8-extension)
Author:
Ben Douglass
  • Method Details

    • isPresent

      public void isPresent()
      Checks that the actual OptionalLong contains a value.
    • isEmpty

      public void isEmpty()
      Checks that the actual OptionalLong does not contain a value.
    • hasValue

      public void hasValue(long expected)
      Checks that the actual OptionalLong contains the given value. More sophisticated comparisons can be done using assertThat(optional.getAsLong())….
    • 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.