org.apache.maven.doxia
Class AbstractModuleTest

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
All Implemented Interfaces:
junit.framework.Test, Markup
Direct Known Subclasses:
AbstractIdentityTest, AbstractParserTest, AbstractSinkTest, ITextSinkTestCase

public abstract class AbstractModuleTest
extends org.codehaus.plexus.PlexusTestCase
implements Markup

Provide some common convenience methods to test Doxia modules (parsers and sinks).

Since:
1.0
Version:
$Id: AbstractModuleTest.java 712574 2008-11-09 22:16:42Z hboutemy $

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
AbstractModuleTest()
           
 
Method Summary
protected  File getBasedirFile()
          Returns the common base directory.
protected abstract  String getOutputDir()
          Returns the directory where test output will go.
protected  Reader getTestReader(String baseName)
          Returns an InputStreamReader to read a resource from a file in the test target output directory.
protected  Reader getTestReader(String baseName, String extension)
          Returns an InputStreamReader to read a resource from a file in the test target output directory.
protected  Writer getTestWriter(String baseName)
          Returns a FileWriter to write to a file with the given name in the test target output directory.
protected  Writer getTestWriter(String baseName, String extension)
          Returns a FileWriter to write to a file with the given name in the test target output directory.
protected  Writer getXmlTestWriter(String baseName)
          Returns an XML FileWriter to write to a file with the given name in the test target output directory.
protected  Writer getXmlTestWriter(String baseName, String extension)
          Returns an XML FileWriter to write to a file with the given name in the test target output directory.
protected  String outputBaseDir()
          Returns the base directory where all test output will go.
protected abstract  String outputExtension()
          Determines the default file extension for the current module.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractModuleTest

public AbstractModuleTest()
Method Detail

getTestWriter

protected Writer getTestWriter(String baseName,
                               String extension)
                        throws IOException
Returns a FileWriter to write to a file with the given name in the test target output directory.

Parameters:
baseName - The name of the target file.
extension - The file extension of the file to write.
Returns:
A FileWriter.
Throws:
IOException - If the FileWriter could not be generated.
See Also:
WriterFactory.newWriter(File, String)

getXmlTestWriter

protected Writer getXmlTestWriter(String baseName)
                           throws IOException
Returns an XML FileWriter to write to a file with the given name in the test target output directory.

Parameters:
baseName - The name of the target file.
Returns:
An XML FileWriter.
Throws:
IOException - If the FileWriter could not be generated.
See Also:
getXmlTestWriter(String, String)

getXmlTestWriter

protected Writer getXmlTestWriter(String baseName,
                                  String extension)
                           throws IOException
Returns an XML FileWriter to write to a file with the given name in the test target output directory.

Parameters:
baseName - The name of the target file.
extension - The file extension of the file to write.
Returns:
An XML FileWriter.
Throws:
IOException - If the FileWriter could not be generated.
See Also:
WriterFactory.newXmlWriter(File)

getTestWriter

protected Writer getTestWriter(String baseName)
                        throws IOException
Returns a FileWriter to write to a file with the given name in the test target output directory.

Parameters:
baseName - The name of the target file.
Returns:
A FileWriter.
Throws:
IOException - If the FileWriter could not be generated.
See Also:
getTestWriter(String, String)

getTestReader

protected Reader getTestReader(String baseName,
                               String extension)
Returns an InputStreamReader to read a resource from a file in the test target output directory.

Parameters:
baseName - The name of the resource file to read.
extension - The file extension of the resource file to read.
Returns:
An InputStreamReader.

getTestReader

protected Reader getTestReader(String baseName)
Returns an InputStreamReader to read a resource from a file in the test target output directory.

Parameters:
baseName - The name of the resource file to read.
Returns:
An InputStreamReader.
See Also:
getTestReader(String, String)

getBasedirFile

protected File getBasedirFile()
Returns the common base directory.

Returns:
The common base directory as a File.

outputBaseDir

protected final String outputBaseDir()
Returns the base directory where all test output will go.

Returns:
The test output directory.

outputExtension

protected abstract String outputExtension()
Determines the default file extension for the current module.

Returns:
The default file extension.

getOutputDir

protected abstract String getOutputDir()
Returns the directory where test output will go. Should be relative to outputBaseDir().

Returns:
The test output directory, relative to outputBaseDir().


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