Code example for Text

Methods: getNodeTypereplaceWholeText

0
                expected, domToString(document));
    } 
 
    public void testReplaceWholeTextOnly() throws TransformerException { 
        String original = domToString(document);
        Text replacement = vitamincText.replaceWholeText("70%");
        assertEquals(Node.TEXT_NODE, replacement.getNodeType());
        assertSame(vitamincText, replacement);
        String expected = original.replace("60%", "70%");
        assertEquals(expected, domToString(document));
    } 
 
    public void testReplaceWholeTextFirstWithNull() throws TransformerException { 
        String original = domToString(document);
        assertNull(descriptionText1.replaceWholeText(null));
        String expected = original.replaceFirst(">.*</description>", "/>");
        assertEquals("This implementation doesn't remove adjacent nodes in replaceWholeText(null)",
                expected, domToString(document));
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE