public static void checkState(boolean isValid, String message) throws IllegalStateException {
    if (!isValid) {
      throw new IllegalStateException(message);
    }
  }
@Test
  public void checkStateMessageOnlySupportsStringTypeTemplate() {
    try {
      Preconditions.checkState(true, "Test message %d", 12);
    } catch (IllegalStateException e) {
      Assert.fail("Should not throw exception when isValid is true");
    }

    try {
      Preconditions.checkState(false, "Test message %d", 12);
      Assert.fail("Should throw exception when isValid is false");
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("%d is not a valid format option", "d != java.lang.String", e.getMessage());
    }
  }