1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.wikimodel.xml; |
21 |
|
|
22 |
|
import java.io.StringReader; |
23 |
|
import java.io.StringWriter; |
24 |
|
|
25 |
|
import org.xwiki.rendering.wikimodel.IWikiParser; |
26 |
|
import org.xwiki.rendering.wikimodel.common.CommonWikiParser; |
27 |
|
import org.xwiki.rendering.wikimodel.test.AbstractWikiParserTest; |
28 |
|
import org.xwiki.rendering.wikimodel.xml.sax.WemReader; |
29 |
|
|
30 |
|
|
31 |
|
@version |
32 |
|
@since |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 3 |
Complexity Density: 0.23 |
|
34 |
|
public class WemTagNotifierTest extends AbstractWikiParserTest |
35 |
|
{ |
36 |
|
|
37 |
|
@param |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
1 |
public WemTagNotifierTest(String name)... |
40 |
|
{ |
41 |
1 |
super(name); |
42 |
|
} |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
44 |
1 |
@Override... |
45 |
|
protected IWikiParser newWikiParser() |
46 |
|
{ |
47 |
1 |
return new CommonWikiParser(); |
48 |
|
} |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
50 |
1 |
public void test() throws Exception... |
51 |
|
{ |
52 |
1 |
showSections(true); |
53 |
1 |
String str = "{{a=b c=d}}\n=Header=\n* item __one__\n* item two"; |
54 |
1 |
StringReader reader = new StringReader(str); |
55 |
|
|
56 |
1 |
IWikiParser parser = newWikiParser(); |
57 |
1 |
WemReader xmlReader = new WemReader(parser); |
58 |
1 |
StringWriter writer = new StringWriter(); |
59 |
1 |
XmlUtil.write(reader, xmlReader, writer); |
60 |
1 |
String control = |
61 |
|
"<w:document xmlns:w=\"http://www.wikimodel.org/ns/wem#\" xmlns:u=\"http://www.wikimodel.org/ns/user-defined-params#\">\n" |
62 |
|
+ " <w:section w:absLevel=\"1\" w:docLevel=\"1\" w:headerLevel=\"0\">\n" |
63 |
|
+ " <w:content w:absLevel=\"1\" w:docLevel=\"1\" w:headerLevel=\"0\">\n" |
64 |
|
+ " <w:section w:absLevel=\"2\" w:docLevel=\"1\" w:headerLevel=\"1\" u:a=\"b\" u:c=\"d\">\n" |
65 |
|
+ " <w:header w:level=\"1\" u:a=\"b\" u:c=\"d\">\n" |
66 |
|
+ " <w:format>Header</w:format>\n" |
67 |
|
+ " </w:header>\n" |
68 |
|
+ |
69 |
|
" <w:content w:absLevel=\"2\" w:docLevel=\"1\" w:headerLevel=\"1\" u:a=\"b\" u:c=\"d\">\n" |
70 |
|
+ " <w:ul>\n" |
71 |
|
+ " <w:li>\n" |
72 |
|
+ " <w:format>item </w:format>\n" |
73 |
|
+ " <w:format w:styles=\"em\">one</w:format>\n" |
74 |
|
+ " </w:li>\n" |
75 |
|
+ " <w:li>\n" |
76 |
|
+ " <w:format>item two</w:format>\n" |
77 |
|
+ " </w:li>\n" |
78 |
|
+ " </w:ul>\n" |
79 |
|
+ " </w:content>\n" |
80 |
|
+ " </w:section>\n" |
81 |
|
+ " </w:content>\n" |
82 |
|
+ " </w:section>\n" |
83 |
|
+ "</w:document>\n" |
84 |
|
+ ""; |
85 |
1 |
String result = writer.toString(); |
86 |
1 |
assertEquals(control, result); |
87 |
1 |
System.out.println(writer); |
88 |
|
} |
89 |
|
} |