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: void testNoAdditionalWhiteSpaceForText()
|
Method name: void testNoAdditionalWhiteSpaceForEmptyElement()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | Document d = DOMUtils.newDocument();↵ | 1 | Document d = DOMUtils.newDocument();↵ | |
2 | Element root = d.createElement("root");↵ | 2 | Element root = d.createElement("root");↵ | |
3 | DOMUtils.appendTextElement(root, "textElement", "content");↵ | 3 | DOMUtils.createChildElement(root, "emptyElement");↵ | |
4 | StringWriter sw = new StringWriter();↵ | 4 | StringWriter sw = new StringWriter();↵ | |
5 | DOMElementWriter w = new DOMElementWriter();↵ | 5 | DOMElementWriter w = new DOMElementWriter();↵ | |
6 | w.write(root, sw, 0, " ");↵ | 6 | w.write(root, sw, 0, " ");↵ | |
7 | assertEquals("<root>" + StringUtils.LINE_SEP↵ | 7 | assertEquals("<root>" + StringUtils.LINE_SEP↵ | |
8 | + " <textElement>content</text↵ | 8 | // + " <emptyElement></emptyElement>"↵ | |
9 | Element>"↵ | 9 | + " <emptyElement />"↵ | |
10 | + StringUtils.LINE_SEP↵ | 10 | + StringUtils.LINE_SEP↵ | |
11 | + "</root>" + StringUtils.LINE_SEP,↵ | 11 | + "</root>" + StringUtils.LINE_SEP,↵ | |
12 | sw.toString()); | 12 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 23 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Document d = DOMUtils.newDocument(); | 1 | Document d = DOMUtils.newDocument(); | |||||||||||||||||||||||||
2 | Element root = d.createElement("root"); | 2 | Element root = d.createElement("root"); | |||||||||||||||||||||||||
| 3 | DOMUtils.createChildElement(root, "emptyElement"); | ||||||||||||||||||||||||||
3 | DOMUtils.appendTextElement(root, "textElement", "content"); |
| 7 | assertEquals("<root>" + StringUtils.LINE_SEP + " <emptyElement />" + StringUtils.LINE_SEP + "</root>" + StringUtils.LINE_SEP, sw.toString()); | ||||||||||||||||||||||||
4 | StringWriter sw = new StringWriter(); | 4 | StringWriter sw = new StringWriter(); | |||||||||||||||||||||||||
5 | DOMElementWriter w = new DOMElementWriter(); | 5 | DOMElementWriter w = new DOMElementWriter(); | |||||||||||||||||||||||||
6 | w.write(root, sw, 0, " "); | 6 | w.write(root, sw, 0, " "); | |||||||||||||||||||||||||
7 | assertEquals("<root>" + StringUtils.LINE_SEP + " <textElement>content</textElement>" + StringUtils.LINE_SEP + "</root>" + StringUtils.LINE_SEP, sw.toString()); | |
Row | Violation |
---|---|
1 | Expression DOMUtils.appendTextElement(root,"textElement","content") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression assertEquals("<root>" + StringUtils.LINE_SEP + " <emptyElement />"+ StringUtils.LINE_SEP+ "</root>"+ StringUtils.LINE_SEP,sw.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression DOMUtils.appendTextElement(root,"textElement","content") is a void method call, and thus it cannot be parameterized |
4 | Expression assertEquals("<root>" + StringUtils.LINE_SEP + " <emptyElement />"+ StringUtils.LINE_SEP+ "</root>"+ StringUtils.LINE_SEP,sw.toString()) is a void method call, and thus it cannot be parameterized |
5 | Expression DOMUtils.appendTextElement(root,"textElement","content") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression assertEquals("<root>" + StringUtils.LINE_SEP + " <emptyElement />"+ StringUtils.LINE_SEP+ "</root>"+ StringUtils.LINE_SEP,sw.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression DOMUtils.appendTextElement(root,"textElement","content") is a void method call, and thus it cannot be parameterized |
8 | Expression assertEquals("<root>" + StringUtils.LINE_SEP + " <emptyElement />"+ StringUtils.LINE_SEP+ "</root>"+ StringUtils.LINE_SEP,sw.toString()) is a void method call, and thus it cannot be parameterized |
9 | Clone fragment #1 returns variable sw with type java.io.StringWriter , while Clone fragment #2 returns variable root with type org.w3c.dom.Element |