View Javadoc
1   /*
2    * #%L
3    * JRst :: Doxia module legacy
4    * %%
5    * Copyright (C) 2009 - 2010 CodeLutin
6    * %%
7    * This program is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU Lesser General Public License as 
9    * published by the Free Software Foundation, either version 3 of the 
10   * License, or (at your option) any later version.
11   * 
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Lesser Public License for more details.
16   * 
17   * You should have received a copy of the GNU General Lesser Public 
18   * License along with this program.  If not, see
19   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
20   * #L%
21   */
22  
23  package org.nuiton.jrst;
24  
25  import java.io.Reader;
26  import java.io.StringWriter;
27  
28  import org.apache.maven.doxia.AbstractModuleTest;
29  import org.apache.maven.doxia.module.xdoc.XdocSink;
30  import org.apache.maven.doxia.parser.Parser;
31  import org.apache.maven.doxia.sink.Sink;
32  import org.junit.Ignore;
33  
34  /**
35   * @author chatellier
36   * @version $Revision : 1$
37   * 
38   * Test ignored due to bug : http://jira.codehaus.org/browse/MPLUGINTESTING-25
39   */
40  @Ignore
41  public class JrstParserTest extends AbstractModuleTest {
42  
43      protected JrstParser parser;
44  
45      @Override
46      protected void setUp() throws Exception {
47          super.setUp();
48  
49          parser = (JrstParser) lookup(Parser.ROLE, "jrst");
50      }
51  
52      public void testParse() throws Exception {
53          StringWriter output = null;
54          Reader reader = null;
55  
56          try {
57              output = new StringWriter();
58              reader = getTestReader("test", "rst");
59  
60              Sink sink = new XdocSink(output){};
61              parser.parse(reader, sink);
62  
63              assertTrue(output.toString().contains("emphasis"));
64              assertTrue(output.toString().contains("This is the first item"));
65              assertTrue(output.toString().contains("Title"));
66              assertTrue(output.toString().contains("blocks."));
67          } finally {
68              if (output != null) {
69                  output.close();
70              }
71              if (reader != null) {
72                  reader.close();
73              }
74          }
75      }
76  
77      @Override
78      protected String outputExtension() {
79          return "rst";
80      }
81  
82      @Override
83      protected String getOutputDir(){
84          return "parser/";
85      }
86  
87  }