KerberosIdentityDescriptor extends AbstractKerberosDescriptor { @Override public Map<String, Object> toMap() { Map<String, Object> dataMap = super.toMap(); if (reference != null) { dataMap.put("reference", reference); } if (principal != null) { dataMap.put(Type.PRINCIPAL.getDescriptorName(), principal.toMap()); } if (keytab != null) { dataMap.put(Type.KEYTAB.getDescriptorName(), keytab.toMap()); } if (password != null) { dataMap.put("password", password); } if(when != null) { dataMap.put("when", PredicateUtils.toMap(when)); } return dataMap; } KerberosIdentityDescriptor(String name, String reference, KerberosPrincipalDescriptor principal, KerberosKeytabDescriptor keytab, Predicate when);  KerberosIdentityDescriptor(Map<?, ?> data); String getReference(); void setReference(String reference); KerberosPrincipalDescriptor getPrincipalDescriptor(); void setPrincipalDescriptor(KerberosPrincipalDescriptor principal); KerberosKeytabDescriptor getKeytabDescriptor(); void setKeytabDescriptor(KerberosKeytabDescriptor keytab); String getPassword(); void setPassword(String password); Predicate getWhen(); void setWhen(Predicate when); boolean shouldInclude(Map<String, Object> context); void update(KerberosIdentityDescriptor updates); @Override Map<String, Object> toMap(); @Override int hashCode(); @Override boolean equals(Object object);  }
@Test public void testToMap() throws AmbariException { KerberosIdentityDescriptor descriptor = createFromMap(); Assert.assertNotNull(descriptor); Assert.assertEquals(MAP_VALUE, descriptor.toMap()); }