public static void checkValid(boolean isValid, String argName) {
    checkArgument(isValid, "'%s' is invalid.", argName);
  }
@Test
  public void testCheckValidWithValues() throws Exception {
    String validValues = "foo, bar";

    // Should not throw.
    Validate.checkValid(true, "arg", validValues);

    // Verify it throws.

    intercept(IllegalArgumentException.class,
        "'arg' is invalid. Valid values are: foo, bar",
        () -> Validate.checkValid(false, "arg", validValues));

  }