NormalizedNodeAggregator { public static Optional<NormalizedNode<?,?>> aggregate(final YangInstanceIdentifier rootIdentifier, final List<Optional<NormalizedNode<?, ?>>> nodes, final EffectiveModelContext schemaContext, final LogicalDatastoreType logicalDatastoreType) throws DataValidationFailedException { return new NormalizedNodeAggregator(rootIdentifier, nodes, schemaContext, logicalDatastoreType).aggregate(); } private  NormalizedNodeAggregator(final YangInstanceIdentifier rootIdentifier,
            final List<Optional<NormalizedNode<?, ?>>> nodes, final EffectiveModelContext schemaContext,
            final LogicalDatastoreType logicalDatastoreType); static Optional<NormalizedNode<?,?>> aggregate(final YangInstanceIdentifier rootIdentifier,
            final List<Optional<NormalizedNode<?, ?>>> nodes, final EffectiveModelContext schemaContext,
            final LogicalDatastoreType logicalDatastoreType);  }
@Test public void testAggregate() throws InterruptedException, ExecutionException, DataValidationFailedException { EffectiveModelContext schemaContext = SchemaContextHelper.full(); NormalizedNode<?, ?> expectedNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME); NormalizedNode<?, ?> expectedNode2 = ImmutableNodes.containerNode(CarsModel.CARS_QNAME); Optional<NormalizedNode<?, ?>> optional = NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.empty(), ImmutableList.of( Optional.<NormalizedNode<?, ?>>of(getRootNode(expectedNode1, schemaContext)), Optional.<NormalizedNode<?, ?>>of(getRootNode(expectedNode2, schemaContext))), schemaContext, LogicalDatastoreType.CONFIGURATION); NormalizedNode<?,?> normalizedNode = optional.get(); assertTrue("Expect value to be a Collection", normalizedNode.getValue() instanceof Collection); @SuppressWarnings("unchecked") Collection<NormalizedNode<?,?>> collection = (Collection<NormalizedNode<?,?>>) normalizedNode.getValue(); for (NormalizedNode<?,?> node : collection) { assertTrue("Expected " + node + " to be a ContainerNode", node instanceof ContainerNode); } assertTrue("Child with QName = " + TestModel.TEST_QNAME + " not found", findChildWithQName(collection, TestModel.TEST_QNAME) != null); assertEquals(expectedNode1, findChildWithQName(collection, TestModel.TEST_QNAME)); assertTrue("Child with QName = " + CarsModel.BASE_QNAME + " not found", findChildWithQName(collection, CarsModel.BASE_QNAME) != null); assertEquals(expectedNode2, findChildWithQName(collection, CarsModel.BASE_QNAME)); }