### Question:
SerializationUtil { public static String structureToJSON(HierarchicalBrowseResultResponse response, AccessGroupSet groups) { Map<String, Object> result = new HashMap<>(); result.put("root", structureStep(response.getRootNode(), groups)); return objectToJSON(result); } private  SerializationUtil(); static String structureToJSON(HierarchicalBrowseResultResponse response, AccessGroupSet groups); static String resultsToJSON(SearchResultResponse resultResponse, AccessGroupSet groups); static List<Map<String, Object>> resultsToList(SearchResultResponse resultResponse, AccessGroupSet groups); static Map<String, Object> metadataToMap(BriefObjectMetadata metadata, AccessGroupSet groups); static String metadataToJSON(BriefObjectMetadata metadata, AccessGroupSet groups); static String objectToJSON(Object object); static void injectSettings(SearchSettings searchSettings,
            SolrSettings solrSettings, GlobalPermissionEvaluator globalPermissionEvaluator);  }### Answer:
@SuppressWarnings("unchecked") @Test public void testStructureToJSON() throws Exception { BriefObjectMetadataBean rootMd = new BriefObjectMetadataBean(); rootMd.setId("uuid:test"); rootMd.setAncestorPath(singletonList("1,uuid:test")); BriefObjectMetadataBean childMd = new BriefObjectMetadataBean(); childMd.setId("uuid:child"); childMd.setAncestorPath(asList("1,uuid:test")); List<BriefObjectMetadata> mdList = asList(rootMd, childMd); HierarchicalBrowseResultResponse response = new HierarchicalBrowseResultResponse(); response.setResultList(mdList); response.setSelectedContainer(rootMd); response.generateResultTree(); String json = SerializationUtil.structureToJSON(response, null); Map<String, Object> jsonMap = getResultMap(json); Map<String, Object> rootObj = (Map<String, Object>) jsonMap.get("root"); Map<String, Object> rootEntry = (Map<String, Object>) rootObj.get("entry"); assertEquals("uuid:test", rootEntry.get("id")); List<Object> childrenList = (List<Object>) rootObj.get("children"); assertEquals(1, childrenList.size()); Map<String, Object> childObj = (Map<String, Object>) childrenList.get(0); Map<String, Object> childEntry = (Map<String, Object>) childObj.get("entry"); assertEquals("uuid:child", childEntry.get("id")); }