public static void setRuleMechanism(String ruleMech) {
    if (ruleMech != null
            && (!ruleMech.equalsIgnoreCase(MECHANISM_HADOOP)
            && !ruleMech.equalsIgnoreCase(MECHANISM_MIT))) {
      throw new IllegalArgumentException("Invalid rule mechanism: " + ruleMech);
    }
    ruleMechanism = ruleMech;
  }
@Test(expected = IllegalArgumentException.class)
  public void testInvalidRuleMechanism() throws Exception {
    KerberosName.setRuleMechanism("INVALID_MECHANISM");
  }