### Question:
Node { static Node mergeNodes(List<Node> children1, List<Node> children2) { int totalChildren = children1.size() + children2.size(); List<Node> children = Stream.concat(children1.stream(), children2.stream()).collect(Collectors.toList()); if (totalChildren <= MAX_CHILDREN) { return Node.fromPieces(children); } else { int splitPoint = Math.min(MAX_CHILDREN, totalChildren - MIN_CHILDREN); List<Node> left = children.subList(0, splitPoint); List<Node> right = children.subList(splitPoint, children.size()); List<Node> parent = Arrays.asList(Node.fromPieces(left), Node.fromPieces(right)); return Node.fromPieces(parent); } } Node(NodeBody nodeBody); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testMergeNodes() { Node readme = Node.fromString(text); Node first = Node.fromString(text.substring(0, MAX_LEAF)); Node second = Node.fromString(text.substring(MAX_LEAF, 2 * MAX_LEAF)); Node third = Node.fromString(text.substring(2 * MAX_LEAF)); Node parent = Node.mergeNodes(Arrays.asList(first, second), Collections.singletonList(third)); assertEquals(parent, readme); parent = Node.mergeNodes(Collections.singletonList(first), Arrays.asList(second, third)); assertEquals(parent, readme); }