public static void checkRequired(boolean isPresent, String argName) {
    checkArgument(isPresent, "'%s' is required.", argName);
  }
@Test
  public void testCheckRequired() throws Exception {
    // Should not throw.
    Validate.checkRequired(true, "arg");

    // Verify it throws.

    intercept(IllegalArgumentException.class, "'arg' is required",
        () -> Validate.checkRequired(false, "arg"));

  }