org.apache.maven.doxia.parser
Class AbstractParserTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.codehaus.plexus.PlexusTestCase
              extended by org.apache.maven.doxia.AbstractModuleTest
                  extended by org.apache.maven.doxia.parser.AbstractParserTest
All Implemented Interfaces:
junit.framework.Test, Markup
Direct Known Subclasses:
XhtmlBaseParserTest

public abstract class AbstractParserTest
extends AbstractModuleTest

Test the parsing of sample input files.
Note: you have to provide a sample "test." + outputExtension() file in the test resources directory if you extend this class.

Since:
1.0
Version:
$Id: AbstractParserTest.java 1463127 2013-04-01 12:46:37Z rfscholte $

Field Summary
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
container, context
 
Fields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STAR
 
Constructor Summary
AbstractParserTest()
           
 
Method Summary
protected  void assertAttributeEquals(SinkEventElement element, String name, String attr, String value)
           
protected  void assertEquals(Iterator<SinkEventElement> it, String... names)
           
protected  void assertEquals(SinkEventElement element, String name, Object... args)
           
protected abstract  Parser createParser()
          Create a new instance of the parser to test.
protected  String getOutputDir()
          Returns the directory where all parser test output will go.
 void testDocument()
          Parse a test document '"test." + outputExtension()' with parser from createParser(), and output to a text file, using the TextSink.
 void testParser()
          Parse a test document '"test." + outputExtension()' with parser from createParser(), and output to a new WellformednessCheckingSink.
 
Methods inherited from class org.apache.maven.doxia.AbstractModuleTest
getBasedirFile, getTestReader, getTestReader, getTestWriter, getTestWriter, getTestWriterFile, getTestWriterFile, getXmlTestWriter, getXmlTestWriter, outputBaseDir, outputExtension
 
Methods inherited from class org.codehaus.plexus.PlexusTestCase
customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getConfigurationName, getContainer, getCustomConfigurationName, getResourceAsStream, getTestConfiguration, getTestConfiguration, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, lookup, lookup, release, setUp, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractParserTest

public AbstractParserTest()
Method Detail

createParser

protected abstract Parser createParser()
Create a new instance of the parser to test.

Returns:
the parser to test.

getOutputDir

protected String getOutputDir()
Returns the directory where all parser test output will go.

Specified by:
getOutputDir in class AbstractModuleTest
Returns:
The test output directory.

testParser

public final void testParser()
                      throws IOException,
                             ParseException
Parse a test document '"test." + outputExtension()' with parser from createParser(), and output to a new WellformednessCheckingSink. Asserts that output is well-formed.

Throws:
IOException - if the test document cannot be read.
ParseException - if the test document cannot be parsed.

testDocument

public final void testDocument()
                        throws IOException,
                               ParseException
Parse a test document '"test." + outputExtension()' with parser from createParser(), and output to a text file, using the TextSink.

Throws:
IOException - if the test document cannot be read.
ParseException - if the test document cannot be parsed.

assertEquals

protected void assertEquals(SinkEventElement element,
                            String name,
                            Object... args)

assertAttributeEquals

protected void assertAttributeEquals(SinkEventElement element,
                                     String name,
                                     String attr,
                                     String value)

assertEquals

protected void assertEquals(Iterator<SinkEventElement> it,
                            String... names)


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.