public void testNoAdditionalWhiteSpaceForCDATA() throws IOException { Document d = DOMUtils.newDocument(); Element root = d.createElement("root"); DOMUtils.appendCDATAElement(root, "cdataElement", "content"); StringWriter sw = new StringWriter(); DOMElementWriter w = new DOMElementWriter(); w.write(root, sw, 0, " "); assertEquals("<root>" + StringUtils.LINE_SEP + " <cdataElement><![CDATA[content]]></cdataElement>" + StringUtils.LINE_SEP + "</root>" + StringUtils.LINE_SEP, sw.toString());
public void testNoAdditionalWhiteSpaceForEmptyElement() throws IOException { Document d = DOMUtils.newDocument(); Element root = d.createElement("root"); DOMUtils.createChildElement(root, "emptyElement"); StringWriter sw = new StringWriter(); DOMElementWriter w = new DOMElementWriter(); w.write(root, sw, 0, " "); assertEquals("<root>" + StringUtils.LINE_SEP // + " <emptyElement></emptyElement>" + " <emptyElement />" + StringUtils.LINE_SEP + "</root>" + StringUtils.LINE_SEP, sw.toString());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public void testNoAdditionalWhiteSpaceForCDATA() throws IOException {
1
public void testNoAdditionalWhiteSpaceForEmptyElement() throws IOException {
2
        Document d = DOMUtils.newDocument();
2
        Document d = DOMUtils.newDocument();
3
        Element root = d.createElement("root");
3
        Element root = d.createElement("root");
4
        DOMUtils.appendCDATAElement(root, "cdataElement", "content");
4
        DOMUtils.createChildElement(root, "emptyElement");
5
        StringWriter sw = new StringWriter();
5
        StringWriter sw = new StringWriter();
6
        DOMElementWriter w = new DOMElementWriter();
6
        DOMElementWriter w = new DOMElementWriter();
7
        w.write(root, sw, 0, "  ");
7
        w.write(root, sw, 0, "  ");
8
        assertEquals("<root>" + StringUtils.LINE_SEP
8
        assertEquals("<root>" + StringUtils.LINE_SEP
9
                     + "  <cdataElement><![CDATA[content]]></cdata
9
                     //                     + "  <emptyElement></emptyElement>"
10
Element>"
10
                     + "  <emptyElement />"
11
                     + StringUtils.LINE_SEP
11
                     + StringUtils.LINE_SEP
12
                     + "</root>" + StringUtils.LINE_SEP,
12
                     + "</root>" + StringUtils.LINE_SEP,
13
                     sw.toString());
13
                     sw.toString());
14
    
14
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0