private KerberosPrincipalDescriptor createMockPrincipalDescriptor(String value,
                                                                    KerberosPrincipalType type,
                                                                    String localUsername,
                                                                    String configuration) {
    KerberosPrincipalDescriptor descriptor = createMock(KerberosPrincipalDescriptor.class);
    expect(descriptor.getValue()).andReturn(value).anyTimes();
    expect(descriptor.getType()).andReturn(type).anyTimes();
    expect(descriptor.getLocalUsername()).andReturn(localUsername).anyTimes();
    expect(descriptor.getConfiguration()).andReturn(configuration).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