private KerberosKeytabDescriptor createMockKeytabDescriptor(String file, String configuration) {
    KerberosKeytabDescriptor descriptor = createMock(KerberosKeytabDescriptor.class);
    expect(descriptor.getFile()).andReturn(file).anyTimes();
    expect(descriptor.getConfiguration()).andReturn(configuration).anyTimes();
    expect(descriptor.getOwnerName()).andReturn("user1").anyTimes();
    expect(descriptor.getOwnerAccess()).andReturn("rw").anyTimes();
    expect(descriptor.getGroupName()).andReturn("groupA").anyTimes();
    expect(descriptor.getGroupAccess()).andReturn("r").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