1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.wikimodel.xml

File WemTagNotifierTest.java

 

Code metrics

0
13
3
1
89
56
3
0.23
4.33
3
1

Classes

Class Line # Actions
WemTagNotifierTest 34 13 0% 3 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
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 $Id: b6dd44efabc13fb4ae1afc09c9173fa62f7c34bf $
32    * @since 4.0M1
33    */
 
34    public class WemTagNotifierTest extends AbstractWikiParserTest
35    {
36    /**
37    * @param name
38    */
 
39  1 toggle public WemTagNotifierTest(String name)
40    {
41  1 super(name);
42    }
43   
 
44  1 toggle @Override
45    protected IWikiParser newWikiParser()
46    {
47  1 return new CommonWikiParser();
48    }
49   
 
50  1 toggle 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    }