private KerberosIdentityDescriptor createMockIdentityDescriptor(String name,
                                                                  KerberosPrincipalDescriptor principalDescriptor,
                                                                  KerberosKeytabDescriptor keytabDescriptor) {
    KerberosIdentityDescriptor descriptor = createMock(KerberosIdentityDescriptor.class);
    expect(descriptor.getName()).andReturn(name).anyTimes();
    expect(descriptor.getPrincipalDescriptor()).andReturn(principalDescriptor).anyTimes();
    expect(descriptor.getKeytabDescriptor()).andReturn(keytabDescriptor).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