1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.officeimporter.internal.cleaner; |
21 |
|
|
22 |
|
import java.io.StringReader; |
23 |
|
|
24 |
|
import org.w3c.dom.Document; |
25 |
|
import org.w3c.dom.NodeList; |
26 |
|
import org.junit.Assert; |
27 |
|
import org.junit.Test; |
28 |
|
|
29 |
|
|
30 |
|
@link |
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
35 |
|
public class EmptyLineParagraphOfficeCleaningTest extends AbstractHTMLCleaningTest |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
40 |
1 |
@Test... |
41 |
|
public void testRemoveFirstEmptyLineParagraph() |
42 |
|
{ |
43 |
1 |
String html = header + "<p><br/></p>" + footer; |
44 |
1 |
Document doc = officeHTMLCleaner.clean(new StringReader(html)); |
45 |
1 |
NodeList paras = doc.getElementsByTagName("p"); |
46 |
1 |
Assert.assertEquals(0, paras.getLength()); |
47 |
1 |
NodeList breaks = doc.getElementsByTagName("br"); |
48 |
1 |
Assert.assertEquals(0, breaks.getLength()); |
49 |
|
} |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
55 |
1 |
@Test... |
56 |
|
public void testReplaceAdditionalEmptyLineParagraphs() |
57 |
|
{ |
58 |
1 |
String html = header + "<p><br/></p><p><br/></p><p><br/></p><p><br/></p>" + footer; |
59 |
1 |
Document doc = officeHTMLCleaner.clean(new StringReader(html)); |
60 |
1 |
NodeList breaks = doc.getElementsByTagName("br"); |
61 |
1 |
Assert.assertEquals(3, breaks.getLength()); |
62 |
|
} |
63 |
|
} |