### Question:
KerberosDescriptor extends AbstractKerberosDescriptorContainer { @Override public Map<String, Object> toMap() { Map<String, Object> map = super.toMap(); if (services != null) { List<Map<String, Object>> list = new ArrayList<>(); for (KerberosServiceDescriptor service : services.values()) { list.add(service.toMap()); } map.put(KEY_SERVICES, list); } if (properties != null) { map.put(KEY_PROPERTIES, new TreeMap<>(properties)); } return map; } KerberosDescriptor();   KerberosDescriptor(Map<?, ?> data); @Override Collection<? extends AbstractKerberosDescriptorContainer> getChildContainers(); @Override AbstractKerberosDescriptorContainer getChildContainer(String name); void setServices(Map<String, KerberosServiceDescriptor> services); Map<String, KerberosServiceDescriptor> getServices(); KerberosServiceDescriptor getService(String name); void putService(KerberosServiceDescriptor service); void setProperties(Map<String, String> properties); Map<String, String> getProperties(); String getProperty(String name); void putProperty(String name, String value); void update(KerberosDescriptor updates); @Override Map<String, Object> toMap(); @Override void setParent(AbstractKerberosDescriptor parent); @Override int hashCode(); @Override boolean equals(Object object); Set<String> getAllAuthToLocalProperties(); Map<String, String> principals();  }### Answer:
@Test public void testToMap() throws AmbariException { Gson gson = new Gson(); KerberosDescriptor descriptor = createFromMap(); Assert.assertNotNull(descriptor); Assert.assertEquals(gson.toJson(MAP_VALUE), gson.toJson(descriptor.toMap())); }