@Test
public void testFactory() throws Exception {

  Configuration conf = new Configuration();
  final String userUri = UserProvider.SCHEME_NAME + ":///";
  final Path jksPath = new Path(tmpDir.toString(), "test.jks");
  final String jksUri = JavaKeyStoreProvider.SCHEME_NAME +
      "://file" + jksPath.toUri();
  conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH,
      userUri + "," + jksUri);
  List<CredentialProvider> providers = 
      CredentialProviderFactory.getProviders(conf);
  assertEquals(2, providers.size());
  assertEquals(UserProvider.class, providers.get(0).getClass());
  assertEquals(JavaKeyStoreProvider.class, providers.get(1).getClass());
  assertEquals(userUri, providers.get(0).toString());
  assertEquals(jksUri, providers.get(1).toString());
}