@Test
public void testCreateKeytabFileExceptions() throws Exception {

  KerberosOperationHandler handler = createHandler();
  File file = folder.newFile();
  final String principal1 = "principal1@REALM.COM";
  try {
    handler.createKeytabFile(null, "some password", 0, file);
    Assert.fail("KerberosOperationException not thrown with null principal");
  } catch (Throwable t) {
    Assert.assertEquals(KerberosOperationException.class, t.getClass());
  }
  try {
    handler.createKeytabFile(principal1, null, null, file);
    Assert.fail("KerberosOperationException not thrown with null password");
  } catch (Throwable t) {
    Assert.assertEquals(KerberosOperationException.class, t.getClass());
  }
  try {
    handler.createKeytabFile(principal1, "some password", 0, null);
    Assert.fail("KerberosOperationException not thrown with null file");
  } catch (Throwable t) {
    Assert.assertEquals(KerberosOperationException.class, t.getClass());
  }
}