Interface Litmus

All Known Implementing Classes:
HintStrategyTable.HintErrorLogger

public interface Litmus
Callback to be called when a test for validity succeeds or fails.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Litmus
    Implementation of Litmus that returns a status code but does not throw.
    static final Litmus
    Implementation of Litmus that throws an AssertionError on failure.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    check(boolean condition, @Nullable String message, @Nullable Object... args)
    Checks a condition.
    boolean
    fail(@Nullable String message, @Nullable Object... args)
    Called when test fails.
    default boolean
    Called when test succeeds.
    default Litmus
    withMessageArgs(@Nullable String message, @Nullable Object... args)
    Creates a Litmus that, if it fails, will use the given arguments.
  • Field Details

    • THROW

      static final Litmus THROW
      Implementation of Litmus that throws an AssertionError on failure.
    • IGNORE

      static final Litmus IGNORE
      Implementation of Litmus that returns a status code but does not throw.
  • Method Details

    • fail

      boolean fail(@Nullable String message, @Nullable Object... args)
      Called when test fails. Returns false or throws.
      Parameters:
      message - Message
      args - Arguments
    • succeed

      default boolean succeed()
      Called when test succeeds. Returns true.
    • check

      default boolean check(boolean condition, @Nullable String message, @Nullable Object... args)
      Checks a condition.

      If the condition is true, calls succeed(); if the condition is false, calls fail(java.lang.String, java.lang.Object...), converting info into a string message.

    • withMessageArgs

      default Litmus withMessageArgs(@Nullable String message, @Nullable Object... args)
      Creates a Litmus that, if it fails, will use the given arguments.