KerberosOperationHandlerFactory { public KerberosOperationHandler getKerberosOperationHandler(KDCType kdcType) { if (kdcType == null) { throw new IllegalArgumentException("kdcType may not be null"); } switch (kdcType) { case MIT_KDC: return injector.getInstance(MITKerberosOperationHandler.class); case ACTIVE_DIRECTORY: return injector.getInstance(ADKerberosOperationHandler.class); case IPA: return injector.getInstance(IPAKerberosOperationHandler.class); default: throw new IllegalArgumentException(String.format("Unexpected kdcType value: %s", kdcType.name())); } }  KerberosOperationHandler getKerberosOperationHandler(KDCType kdcType);  }
@Test public void testForAD() { Assert.assertEquals(MITKerberosOperationHandler.class, injector.getInstance(KerberosOperationHandlerFactory.class).getKerberosOperationHandler(KDCType.MIT_KDC).getClass()); }
@Test public void testForMIT() { Assert.assertEquals(ADKerberosOperationHandler.class, injector.getInstance(KerberosOperationHandlerFactory.class).getKerberosOperationHandler(KDCType.ACTIVE_DIRECTORY).getClass()); }
@Test(expected = IllegalArgumentException.class) public void testForNone() { Assert.assertNull(injector.getInstance(KerberosOperationHandlerFactory.class).getKerberosOperationHandler(KDCType.NONE)); }
@Test(expected = IllegalArgumentException.class) public void testForNull() { Assert.assertNull(injector.getInstance(KerberosOperationHandlerFactory.class).getKerberosOperationHandler(null)); }