ProductSizeMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { addTextToNode(toParent, productSizeAsString, toDocument); } ProductSizeMerger(long productSize); @Override void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument);  }
@Test public void mergeNodes() throws Exception { List<Node> fromParents = new ArrayList<>(); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + " <sentinel3:productSize>2879317399</sentinel3:productSize>\n")); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + " <sentinel3:productSize>2879317399</sentinel3:productSize>\n")); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + " <sentinel3:productSize>2879317399</sentinel3:productSize>\n")); Document manifest = ManifestTestUtils.createDocument(); final Element manifestElement = manifest.createElement("sentinel3:productSize"); manifest.appendChild(manifestElement); new ProductSizeMerger(545765).mergeNodes(fromParents, manifestElement, manifest); assertEquals(0, manifestElement.getAttributes().getLength()); assertEquals(1, manifestElement.getChildNodes().getLength()); assertEquals("545765", manifestElement.getFirstChild().getNodeValue()); }