@Test
public void mergeNodes_interrupted() throws ParserConfigurationException, SAXException, IOException, PDUStitchingException {

    List<Node> fromParents = new ArrayList<>();
    fromParents.add(ManifestTestUtils.createNode(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "<slstr:missingElements threshold=\"75\">\n" +
                    "  <slstr:globalInfo grid=\"1 km\" view=\"Oblique\" value=\"77\" over=\"601\" percentage=\"12.81198\"/>\n" +
                    "  <slstr:elementMissing grid=\"1 km\" view=\"Oblique\" startTime=\"2017-10-18T01:25:22.192255Z\" stopTime=\"2017-10-18T01:25:24.592142Z\" percentage=\"10.482529\">\n" +
                    "     <slstr:bandSet>S8, F2</slstr:bandSet>\n" +
                    "  </slstr:elementMissing>\n" +
                    "  <slstr:elementMissing grid=\"1 km\" view=\"Oblique\" startTime=\"2017-10-18T01:25:34.592568Z\" stopTime=\"2017-10-18T01:25:35.292568Z\" percentage=\"2.329451\">\n" +
                    "     <slstr:bandSet>S8</slstr:bandSet>\n" +
                    "  </slstr:elementMissing>\n" +
                    "</slstr:missingElements>").getFirstChild());
    fromParents.add(ManifestTestUtils.createNode(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "<slstr:missingElements threshold=\"75\">\n" +
                    "  <slstr:globalInfo grid=\"1 km\" view=\"Oblique\" value=\"15\" over=\"575\" percentage=\"2.608696\"/>\n" +
                    "  <slstr:elementMissing grid=\"1 km\" view=\"Oblique\" startTime=\"2017-10-18T01:25:35.592568Z\" stopTime=\"2017-10-18T01:25:36.442568Z\" percentage=\"0.173913\">\n" +
                    "     <slstr:bandSet>S8</slstr:bandSet>\n" +
                    "  </slstr:elementMissing>\n" +
                    "  <slstr:elementMissing grid=\"1 km\" view=\"Oblique\" startTime=\"2017-10-18T01:25:36.942504Z\" stopTime=\"2017-10-18T01:25:38.142447Z\" percentage=\"0.869565\">\n" +
                    "     <slstr:bandSet>S8</slstr:bandSet>\n" +
                    "  </slstr:elementMissing>\n" +
                    "  <slstr:elementMissing grid=\"1 km\" view=\"Oblique\" startTime=\"2017-10-18T01:25:42.192255Z\" stopTime=\"2017-10-18T01:25:44.562142Z\" percentage=\"1.565217\">\n" +
                    "     <slstr:bandSet>S8, F2</slstr:bandSet>\n" +
                    "  </slstr:elementMissing>\n" +
                    "</slstr:missingElements>").getFirstChild());
    fromParents.add(ManifestTestUtils.createNode(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "<slstr:missingElements threshold=\"75\">\n" +
                    "  <slstr:globalInfo grid=\"1 km\" view=\"Oblique\" value=\"10\" over=\"575\" percentage=\"2.608696\"/>\n" +
                    "  <slstr:elementMissing grid=\"1 km\" view=\"Oblique\" startTime=\"2017-10-18T01:25:44.592142Z\" stopTime=\"2017-10-18T01:25:46.592142Z\" percentage=\"1.391304\">\n" +
                    "     <slstr:bandSet>S8, F2</slstr:bandSet>\n" +
                    "  </slstr:elementMissing>\n" +
                    "  <slstr:elementMissing grid=\"1 km\" view=\"Oblique\" startTime=\"2017-10-18T01:25:55.592568Z\" stopTime=\"2017-10-18T01:25:56.592568Z\" percentage=\"0.347826\">\n" +
                    "     <slstr:bandSet>F2</slstr:bandSet>\n" +
                    "  </slstr:elementMissing>\n" +
                    "</slstr:missingElements>").getFirstChild());
    Document manifest = ManifestTestUtils.createDocument();
    final Element manifestElement = manifest.createElement("slstr:missingElements");
    manifest.appendChild(manifestElement);
    new MissingElementsMerger().mergeNodes(fromParents, manifestElement, manifest);
    assertEquals(1, manifestElement.getAttributes().getLength());
    assert(manifestElement.hasAttribute("threshold"));
    assertEquals("75", manifestElement.getAttribute("threshold"));
    final NodeList childNodes = manifestElement.getChildNodes();
    assertEquals(6, childNodes.getLength());
    final Node globalInfoNode = childNodes.item(0);
    assertEquals("slstr:globalInfo", globalInfoNode.getNodeName());
    assert(globalInfoNode.hasAttributes());
    final NamedNodeMap globalInfoNodeAttributes = globalInfoNode.getAttributes();
    assertEquals(5, globalInfoNodeAttributes.getLength());
    assertNotNull(globalInfoNodeAttributes.getNamedItem("grid"));
    assertEquals("1 km", globalInfoNodeAttributes.getNamedItem("grid").getNodeValue());
    assertNotNull(globalInfoNodeAttributes.getNamedItem("view"));
    assertEquals("Oblique", globalInfoNodeAttributes.getNamedItem("view").getNodeValue());
    assertNotNull(globalInfoNodeAttributes.getNamedItem("value"));
    assertEquals("102", globalInfoNodeAttributes.getNamedItem("value").getNodeValue());
    assertNotNull(globalInfoNodeAttributes.getNamedItem("over"));
    assertEquals("1751", globalInfoNodeAttributes.getNamedItem("over").getNodeValue());
    assertNotNull(globalInfoNodeAttributes.getNamedItem("percentage"));
    assertEquals("5.825243", globalInfoNodeAttributes.getNamedItem("percentage").getNodeValue());
    assertElement(childNodes.item(1), "1 km", "Oblique", "2017-10-18T01:25:22.192255Z",
                  "2017-10-18T01:25:24.592142Z", "3.597944", "S8, F2");
    assertElement(childNodes.item(2), "1 km", "Oblique", "2017-10-18T01:25:34.592568Z",
                  "2017-10-18T01:25:36.442568Z", "0.856653", "S8");
    assertElement(childNodes.item(3), "1 km", "Oblique", "2017-10-18T01:25:36.942504Z",
                  "2017-10-18T01:25:38.142447Z", "0.285551", "S8");
    assertElement(childNodes.item(4), "1 km", "Oblique", "2017-10-18T01:25:42.192255Z",
                  "2017-10-18T01:25:46.592142Z", "0.970874", "S8, F2");
    assertElement(childNodes.item(5), "1 km", "Oblique", "2017-10-18T01:25:55.592568Z",
                  "2017-10-18T01:25:56.592568Z", "0.114220", "F2");
}