public void testChaining() throws Exception {
  BasicUserNameMapper mapper1=new BasicUserNameMapper();
  mapper1.setMappings(Collections.singletonMap("1","101"));
  KerberosUserNameMapper mapper2=new KerberosUserNameMapper();
  mapper2.setInstance(INSTANCE);
  mapper2.setRealm(REALM);
  ChainedUserNameMapper mapper=create(mapper1,mapper2);
  assertEquals("101" + "/" + INSTANCE + "@"+ REALM,mapper.map("1"));
  assertEquals("2" + "/" + INSTANCE + "@"+ REALM,mapper.map("2"));
  assertEquals(IgfsUtils.fixUserName(null) + "/" + INSTANCE+ "@"+ REALM,mapper.map(null));
}

public void testChaining ( ) throws Exception { BasicUserNameMapper mapper1 = new BasicUserNameMapper ( ) ; mapper1 . setMappings ( Collections . singletonMap ( "1" , "101" ) ) ; KerberosUserNameMapper mapper2 = new KerberosUserNameMapper ( ) ; mapper2 . setInstance ( INSTANCE ) ; mapper2 . setRealm ( REALM ) ; ChainedUserNameMapper mapper = create ( mapper1 , mapper2 ) ; assertEquals ( "101" + "/" + INSTANCE + "@" + REALM , mapper . map ( "1" ) ) ; assertEquals ( "2" + "/" + INSTANCE + "@" + REALM , mapper . map ( "2" ) ) ; assertEquals ( IgfsUtils . fixUserName ( null ) + "/" + INSTANCE + "@" + REALM , mapper . map ( null ) ) ; }
test actual chaining logic .
