private KerberosServiceDescriptor createMockServiceDescriptor(String serviceName,
                                                                HashMap<String, KerberosComponentDescriptor> componentMap,
                                                                List<KerberosIdentityDescriptor> identities,
                                                                boolean shouldPreconfigure)
      throws AmbariException {
    KerberosServiceDescriptor descriptor = createMock(KerberosServiceDescriptor.class);
    expect(descriptor.getName()).andReturn(serviceName).anyTimes();
    expect(descriptor.getComponents()).andReturn(componentMap).anyTimes();
    expect(descriptor.getIdentities(eq(true), EasyMock.anyObject())).andReturn(identities).anyTimes();
    expect(descriptor.getAuthToLocalProperties()).andReturn(null).anyTimes();
    expect(descriptor.shouldPreconfigure()).andReturn(shouldPreconfigure).anyTimes();
    return descriptor;
  }
Test that a Kerberos Descriptor that contains a Service with 0 Components does not raise any exceptions.
ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java