Class OptionalIntSubject

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

public final class OptionalIntSubject extends Subject
Propositions for Java 8 OptionalInt subjects.
  • Field Details

  • Constructor Details

  • Method Details

    • isPresent

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

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

      public void hasValue(int expected)
      Fails if the OptionalInt does not have the given value or the subject is null. More sophisticated comparisons can be done using assertThat(optional.getAsInt())….
    • optionalInts

      public static Subject.Factory<OptionalIntSubject,OptionalInt> optionalInts()