@Test
public void testMergeNodes() throws Exception {

    List<Node> fromParents = new ArrayList<>();
    fromParents.add(ManifestTestUtils.createNode(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "          <sentinel-safe:orbitReference>\n" +
                    "            <sentinel-safe:orbitNumber groundTrackDirection=\"descending\" type=\"start\">60627</sentinel-safe:orbitNumber>\n" +
                    "            <sentinel-safe:relativeOrbitNumber groundTrackDirection=\"descending\" type=\"start\">182</sentinel-safe:relativeOrbitNumber>\n" +
                    "            <sentinel-safe:passNumber groundTrackDirection=\"descending\" type=\"start\">121254</sentinel-safe:passNumber>\n" +
                    "            <sentinel-safe:relativePassNumber groundTrackDirection=\"descending\" type=\"start\">364</sentinel-safe:relativePassNumber>\n" +
                    "            <sentinel-safe:cycleNumber>158</sentinel-safe:cycleNumber>\n" +
                    "            <sentinel-safe:phaseIdentifier>1</sentinel-safe:phaseIdentifier>\n" +
                    "            <sentinel-safe:elementSet>\n" +
                    "              <sentinel-safe:ephemeris>\n" +
                    "                <sentinel-safe:epoch type=\"UTC\">2013-07-07T14:38:40.174945Z</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:epoch type=\"UT1\">2013-07-07T14:38:40.233437</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:epoch type=\"TAI\">2013-07-07T14:39:15.174945</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:position>\n" +
                    "                  <sentinel-safe:x>-2496716.548</sentinel-safe:x>\n" +
                    "                  <sentinel-safe:y>+6735891.009</sentinel-safe:y>\n" +
                    "                  <sentinel-safe:z>+0000014.370</sentinel-safe:z>\n" +
                    "                </sentinel-safe:position>\n" +
                    "                <sentinel-safe:velocity>\n" +
                    "                  <sentinel-safe:x>+1541.463032</sentinel-safe:x>\n" +
                    "                  <sentinel-safe:y>+0562.236011</sentinel-safe:y>\n" +
                    "                  <sentinel-safe:z>+7366.402657</sentinel-safe:z>\n" +
                    "                </sentinel-safe:velocity>\n" +
                    "              </sentinel-safe:ephemeris>\n" +
                    "            </sentinel-safe:elementSet>\n" +
                    "          </sentinel-safe:orbitReference>").getFirstChild());
    fromParents.add(ManifestTestUtils.createNode(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "          <sentinel-safe:orbitReference>\n" +
                    "            <sentinel-safe:orbitNumber groundTrackDirection=\"descending\" type=\"start\">60627</sentinel-safe:orbitNumber>\n" +
                    "            <sentinel-safe:relativeOrbitNumber groundTrackDirection=\"descending\" type=\"start\">182</sentinel-safe:relativeOrbitNumber>\n" +
                    "            <sentinel-safe:passNumber groundTrackDirection=\"descending\" type=\"start\">121254</sentinel-safe:passNumber>\n" +
                    "            <sentinel-safe:relativePassNumber groundTrackDirection=\"descending\" type=\"start\">364</sentinel-safe:relativePassNumber>\n" +
                    "            <sentinel-safe:cycleNumber>158</sentinel-safe:cycleNumber>\n" +
                    "            <sentinel-safe:phaseIdentifier>1</sentinel-safe:phaseIdentifier>\n" +
                    "            <sentinel-safe:elementSet>\n" +
                    "              <sentinel-safe:ephemeris>\n" +
                    "                <sentinel-safe:epoch type=\"UTC\">2013-07-07T14:38:40.174945Z</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:epoch type=\"UT1\">2013-07-07T14:38:40.233437</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:epoch type=\"TAI\">2013-07-07T14:39:15.174945</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:position>\n" +
                    "                  <sentinel-safe:x>-2496716.548</sentinel-safe:x>\n" +
                    "                  <sentinel-safe:y>+6735891.009</sentinel-safe:y>\n" +
                    "                  <sentinel-safe:z>+0000014.370</sentinel-safe:z>\n" +
                    "                </sentinel-safe:position>\n" +
                    "                <sentinel-safe:velocity>\n" +
                    "                  <sentinel-safe:x>+1541.463032</sentinel-safe:x>\n" +
                    "                  <sentinel-safe:y>+0562.236011</sentinel-safe:y>\n" +
                    "                  <sentinel-safe:z>+7366.402657</sentinel-safe:z>\n" +
                    "                </sentinel-safe:velocity>\n" +
                    "              </sentinel-safe:ephemeris>\n" +
                    "            </sentinel-safe:elementSet>\n" +
                    "          </sentinel-safe:orbitReference>").getFirstChild());
    fromParents.add(ManifestTestUtils.createNode(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "          <sentinel-safe:orbitReference>\n" +
                    "            <sentinel-safe:orbitNumber groundTrackDirection=\"descending\" type=\"start\">60627</sentinel-safe:orbitNumber>\n" +
                    "            <sentinel-safe:relativeOrbitNumber groundTrackDirection=\"descending\" type=\"start\">182</sentinel-safe:relativeOrbitNumber>\n" +
                    "            <sentinel-safe:passNumber groundTrackDirection=\"descending\" type=\"start\">121254</sentinel-safe:passNumber>\n" +
                    "            <sentinel-safe:relativePassNumber groundTrackDirection=\"descending\" type=\"start\">364</sentinel-safe:relativePassNumber>\n" +
                    "            <sentinel-safe:cycleNumber>158</sentinel-safe:cycleNumber>\n" +
                    "            <sentinel-safe:phaseIdentifier>1</sentinel-safe:phaseIdentifier>\n" +
                    "            <sentinel-safe:elementSet>\n" +
                    "              <sentinel-safe:ephemeris>\n" +
                    "                <sentinel-safe:epoch type=\"UTC\">2013-07-07T14:38:40.174945Z</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:epoch type=\"UT1\">2013-07-07T14:38:40.233437</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:epoch type=\"TAI\">2013-07-07T14:39:15.174945</sentinel-safe:epoch>\n" +
                    "                <sentinel-safe:position>\n" +
                    "                  <sentinel-safe:x>-2496716.548</sentinel-safe:x>\n" +
                    "                  <sentinel-safe:y>+6735891.009</sentinel-safe:y>\n" +
                    "                  <sentinel-safe:z>+0000014.370</sentinel-safe:z>\n" +
                    "                </sentinel-safe:position>\n" +
                    "                <sentinel-safe:velocity>\n" +
                    "                  <sentinel-safe:x>+1541.463032</sentinel-safe:x>\n" +
                    "                  <sentinel-safe:y>+0562.236011</sentinel-safe:y>\n" +
                    "                  <sentinel-safe:z>+7366.402657</sentinel-safe:z>\n" +
                    "                </sentinel-safe:velocity>\n" +
                    "              </sentinel-safe:ephemeris>\n" +
                    "            </sentinel-safe:elementSet>\n" +
                    "          </sentinel-safe:orbitReference>").getFirstChild());
    Document manifest = ManifestTestUtils.createDocument();
    final Element manifestElement = manifest.createElement("sentinel-safe:orbitReference");
    manifest.appendChild(manifestElement);
    new OrbitReferenceMerger().mergeNodes(fromParents, manifestElement, manifest);
    for (Node fromParent : fromParents) {
        assertEqualsElement(fromParent, manifestElement);
    }
}