public static void checkState(final boolean expression) {
    if (!expression) {
      throw new IllegalStateException();
    }
  }
@Test
  public void testCheckStateWithSuccess() throws Exception {
    // success
    Preconditions.checkState(true);
    // null supplier
    Preconditions.checkState(true, null);
    // null message
    Preconditions.checkState(true, (String) null);
    Preconditions.checkState(true, NON_NULL_STRING);
    // null in string format
    Preconditions.checkState(true, EXPECTED_ERROR_MSG_ARGS, null, null);
    // illegalformat
    Preconditions.checkState(true, EXPECTED_ERROR_MSG_ARGS, 1, 2);
    // ill-formated string supplier
    Preconditions.checkState(true, ()-> String.format("%d",
        NON_INT_STRING));
    // null pattern to string formatter
    Preconditions.checkState(true, NULL_FORMATTER, null, 1);
    // null arguments to string formatter
    Preconditions.checkState(true, EXPECTED_ERROR_MSG_ARGS,
        null, null);
    // illegal format exception
    Preconditions.checkState(true, "message %d %d",
        NON_INT_STRING, 1);
    // insufficient arguments
    Preconditions.checkState(true, EXPECTED_ERROR_MSG_ARGS,
        NON_INT_STRING);
    // null format in string supplier
    Preconditions.checkState(true,
        () -> String.format(NULL_FORMATTER, NON_INT_STRING));
  }