OspfConfigUtil { public static List<OspfProcess> processes(JsonNode jsonNodes) { List<OspfProcess> ospfProcesses = new ArrayList<>(); if (jsonNodes == null) { return ospfProcesses; } jsonNodes.forEach(jsonNode -> { List<OspfArea> areas = new ArrayList<>(); for (JsonNode areaNode : jsonNode.path(AREAS)) { List<OspfInterface> interfaceList = new ArrayList<>(); for (JsonNode interfaceNode : areaNode.path(INTERFACE)) { OspfInterface ospfInterface = interfaceDetails(interfaceNode); if (ospfInterface != null) { interfaceList.add(ospfInterface); } } OspfArea area = areaDetails(areaNode); if (area != null) { area.setOspfInterfaceList(interfaceList); areas.add(area); } } OspfProcess process = new OspfProcessImpl(); process.setProcessId(jsonNode.path(PROCESSID).asText()); process.setAreas(areas); ospfProcesses.add(process); }); return ospfProcesses; } private  OspfConfigUtil(); static List<OspfProcess> processes(JsonNode jsonNodes); static final String PROCESSID; static final String AREAS; static final String INTERFACEINDEX; static final String AREAID; static final String ROUTERID; static final String INTERFACE; static final String HELLOINTERVAL; static final String ROUTERDEADINTERVAL; static final String INTERFACETYPE; static final String EXTERNALROUTINGCAPABILITY; }
@Test public void testProcesses() throws Exception { jsonNode.path("areas"); ospfProcessList = OspfConfigUtil.processes(jsonNode); assertThat(ospfProcessList, is(notNullValue())); }