@Test
public void testCreateKeytabFileOneAtATime() throws Exception {

  KerberosOperationHandler handler = createHandler();
  File file = folder.newFile();
  final String principal1 = "principal1@REALM.COM";
  final String principal2 = "principal2@REALM.COM";
  int count;
  Assert.assertTrue(handler.createKeytabFile(principal1, "some password", 0, file));
  Keytab keytab = Keytab.read(file);
  Assert.assertNotNull(keytab);
  List<KeytabEntry> entries = keytab.getEntries();
  Assert.assertNotNull(entries);
  Assert.assertFalse(entries.isEmpty());
  count = entries.size();
  for (KeytabEntry entry : entries) {
    Assert.assertEquals(principal1, entry.getPrincipalName());
  }
  Assert.assertTrue(handler.createKeytabFile(principal2, "some password", 0, file));
  keytab = Keytab.read(file);
  Assert.assertNotNull(keytab);
  entries = keytab.getEntries();
  Assert.assertNotNull(entries);
  Assert.assertFalse(entries.isEmpty());
  Assert.assertEquals(count * 2, entries.size());
}