@Test (timeout = 30000)
public void testConstructorWithRules() throws Exception {

  // security off, but use rules if explicitly set
  conf.set(HADOOP_SECURITY_AUTH_TO_LOCAL,
      "RULE:[1:$1@$0](.*@OTHER.REALM)s/(.*)@.*/other-$1/");
  UserGroupInformation.setConfiguration(conf);
  testConstructorSuccess("user1", "user1");
  testConstructorSuccess("user4@OTHER.REALM", "other-user4");
  // failure test
  testConstructorFailures("user2@DEFAULT.REALM");
  testConstructorFailures("user3/cron@DEFAULT.REALM");
  testConstructorFailures("user5/cron@OTHER.REALM");
  testConstructorFailures(null);
  testConstructorFailures("");
}