OutboundDocQueryAggregator implements NhinAggregator { protected void aggregateRegistryErrors(AdhocQueryResponse aggregatedResponse, AdhocQueryResponse individualResponse) { RegistryErrorList registryErrorList = individualResponse.getRegistryErrorList(); if (registryErrorList != null && CollectionUtils.isNotEmpty(registryErrorList.getRegistryError())) { if (aggregatedResponse.getRegistryErrorList() == null) { aggregatedResponse.setRegistryErrorList(new RegistryErrorList()); } aggregatedResponse.getRegistryErrorList().getRegistryError().addAll(registryErrorList.getRegistryError()); } }  void increaseCount(AdhocQueryResponse aggregate); void aggregate(OutboundDocQueryOrchestratable to, OutboundDocQueryOrchestratable from); @Override void aggregate(OutboundOrchestratable to, OutboundOrchestratable from);  }
@Test public void testAggregateRegistryErrors() { AdhocQueryResponse aggregatedResponse = new AdhocQueryResponse(); AdhocQueryResponse individualResponse = new AdhocQueryResponse(); nhinAggregator.aggregateRegistryErrors(aggregatedResponse, individualResponse); assertNull(aggregatedResponse.getRegistryErrorList()); individualResponse.setRegistryErrorList(new RegistryErrorList()); individualResponse.getRegistryErrorList().getRegistryError().add(new RegistryError()); nhinAggregator.aggregateRegistryErrors(aggregatedResponse, individualResponse); assertEquals(1, aggregatedResponse.getRegistryErrorList().getRegistryError().size()); }