code: public static void state(Boolean valid, Supplier<String> message) {
      if (isNotValid(valid)) {
        throw new IllegalStateException(message.get());
      }
    }
docs: Asserts that the state is valid.
  
  The assertion holds if and only if valid is {@literal true}.
  
  @param valid {@link Boolean} value indicating whether the state is valid.
  @param message {@link Supplier} containing the message used in the {@link IllegalStateException} thrown
  if the assertion fails.
  @throws java.lang.IllegalStateException if the state is invalid.