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

File EventDumpListenerTest.java

 

Code metrics

0
6
4
1
94
33
4
0.67
1.5
4
1

Classes

Class Line # Actions
EventDumpListenerTest 33 6 0% 4 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.test;
21   
22    import org.xwiki.rendering.wikimodel.EventDumpListener;
23    import org.xwiki.rendering.wikimodel.IWemListener;
24    import org.xwiki.rendering.wikimodel.IWikiParser;
25    import org.xwiki.rendering.wikimodel.IWikiPrinter;
26    import org.xwiki.rendering.wikimodel.WikiParserException;
27    import org.xwiki.rendering.wikimodel.common.CommonWikiParser;
28   
29    /**
30    * @version $Id: 4c98062143db01ce74b31ef96238e8e109d16cf6 $
31    * @since 4.0M1
32    */
 
33    public class EventDumpListenerTest extends AbstractWikiParserTest
34    {
 
35  1 toggle public EventDumpListenerTest(String name)
36    {
37  1 super(name);
38    }
39   
 
40  1 toggle @Override
41    protected IWikiParser newWikiParser()
42    {
43  1 return new CommonWikiParser();
44    }
45   
46    /**
47    * @param buf
48    * @return
49    */
 
50  1 toggle protected IWemListener newParserListener(final StringBuffer buf)
51    {
52  1 IWikiPrinter printer = newPrinter(buf);
53  1 IWemListener listener = new EventDumpListener(printer);
54  1 return listener;
55    }
56   
 
57  1 toggle public void test() throws WikiParserException
58    {
59  1 test("%worksIn (((\n"
60    + " %type [Company]\n"
61    + " %name Cognium *Systems*\n"
62    + " %address (((\n"
63    + " )))");
64    /**
65    * The trace, how it *should* be:
66    *
67    * <pre>
68    beginDocument()
69    beginPropertyBlock('worksIn',doc=true)
70    beginPropertyBlock('type',doc=false)
71    beginParagraph()
72    beginFormat([])
73    onReference('Company')
74    endFormat([])
75    endParagraph()
76    endPropertyBlock('type', doc=false)
77    beginPropertyBlock('name',doc=false)
78    beginParagraph()
79    beginFormat([])
80    onWord('Cognium')
81    onSpace(' ')
82    onWord('Systems')
83    endFormat([])
84    endParagraph()
85    endPropertyBlock('name', doc=false)
86    beginPropertyBlock('address',doc=true)
87    endPropertyBlock('address', doc=true)
88    endPropertyBlock('worksIn', doc=true)
89    endDocument()
90    </pre>
91    */
92   
93    }
94    }