public static void replaceNodeText(Document document, String containerNodeName, String nodeName, String toReplace, String replacement) {
        asStream(document.getElementsByTagName(containerNodeName))
                .forEach(containerNode -> asStream(containerNode.getChildNodes())
                        .filter(childNode -> Objects.equals(nodeName, childNode.getNodeName()) && Objects.equals(toReplace, childNode.getTextContent()))
                        .forEach(childNode -> childNode.setTextContent(replacement)));
    }
@Test
    public void replaceNodeText() throws Exception {
        final String replacement = "replacement";
        Document document = DOMParserUtil.getDocument(XML);
        DOMParserUtil.replaceNodeText(document, MAIN_NODE, TEST_NODE, TEST_NODE_CONTENT, replacement);
        final Map<Node, List<Node>> retrieved = DOMParserUtil.getChildrenNodesMap(document, MAIN_NODE, TEST_NODE);
        assertThat(retrieved).isNotNull();
        assertThat(retrieved).hasSize(1);
        List<Node> testNodes = retrieved.values().iterator().next();
        assertThat(testNodes).isNotNull();
        assertThat(testNodes).hasSize(1);
        assertThat(testNodes.get(0).getTextContent()).isEqualTo(replacement);
    }