@Test
public void testGetPrincipalNamesFromKeytab() throws IOException {

  createKeyTab(testKeytab, testPrincipals); 
  // read all principals in the keytab file
  String[] principals = KerberosUtil.getPrincipalNames(testKeytab);
  Assert.assertNotNull("principals cannot be null", principals);
  
  int expectedSize = 0;
  List<String> principalList = Arrays.asList(principals);
  for (String principal : testPrincipals) {
    Assert.assertTrue("missing principal "+principal,
        principalList.contains(principal));
    expectedSize++;
  }
  Assert.assertEquals(expectedSize, principals.length);
}