AggregatorMessage { String packageResponse(Map<Document, String> responses) throws DispatchException { if (responses.isEmpty()) { throw new DispatchException("Processing has an exception of response."); } String response; String typeOfNetconfRequest = NetconfMessageUtil.getTypeOfNetconfRequest(m_document); switch (typeOfNetconfRequest) { case NetconfResources.GET: case NetconfResources.GET_CONFIG: case NetconfResources.GET_CONFIG_CONFIG: response = buildNeedPackageResponse(responses); break; default: response = getLastResult(responses); break; } return response; } private  AggregatorMessage();   AggregatorMessage(String netconfMessage); static NodeList getDeviceNodes(Document document); static Document stringToDocument(String request); @Override String toString(); static final String NS_OBBAA_NETWORK_MANAGER; }
@Test public void packageResponseTest() throws Exception { Map<Document, String> inputMap = new HashMap<>(); inputMap.put(AggregatorMessage.stringToDocument(TEST_RPC_REPLY_MSG_A), TEST_DEVICE_NAME_A); inputMap.put(AggregatorMessage.stringToDocument(TEST_RPC_REPLY_MSG_B), TEST_DEVICE_NAME_B); String responses = m_aggregatorMessage.packageResponse(inputMap); assertFalse(responses.isEmpty()); assertTrue(responses.contains(TEST_DEVICE_NAME_B)); }