### Question:
KerberosServiceDescriptor extends AbstractKerberosDescriptorContainer { @Override public Map<String, Object> toMap() { Map<String, Object> map = super.toMap(); if (components != null) { List<Map<String, Object>> list = new ArrayList<>(); for (KerberosComponentDescriptor component : components.values()) { list.add(component.toMap()); } map.put(KEY_COMPONENTS, list); } if (preconfigure != null) { map.put(KEY_PRECONFIGURE, preconfigure.toString()); } return map; } KerberosServiceDescriptor(Map<?, ?> data);   KerberosServiceDescriptor(String name, Map<?, ?> data); @Override Collection<? extends AbstractKerberosDescriptorContainer> getChildContainers(); @Override AbstractKerberosDescriptorContainer getChildContainer(String name); Map<String, KerberosComponentDescriptor> getComponents(); KerberosComponentDescriptor getComponent(String name); void putComponent(KerberosComponentDescriptor component); void update(KerberosServiceDescriptor updates); boolean shouldPreconfigure(); void setPreconfigure(Boolean preconfigure); @Override Map<String, Object> toMap(); List<KerberosIdentityDescriptor> getComponentIdentities(String componentName); @Override int hashCode(); @Override boolean equals(Object object);  }### Answer:
@Test public void testToMap() throws AmbariException { Gson gson = new Gson(); KerberosServiceDescriptor descriptor = createFromMap(); Assert.assertNotNull(descriptor); Assert.assertEquals(gson.toJson(MAP_VALUE), gson.toJson(descriptor.toMap())); }