|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.codehaus.plexus.PlexusTestCase org.apache.maven.doxia.AbstractModuleTest org.apache.maven.doxia.module.AbstractIdentityTest
public abstract class AbstractIdentityTest
If a module provides both Parser and Sink, this class can be used to check that chaining them together results in the identity transformation, ie the model is still the same after being piped through a Parser and the corresponding Sink.
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 | |
---|---|
AbstractIdentityTest()
|
Method Summary | |
---|---|
protected void |
assertIdentity(boolean doAssert)
Set to true if the identity transformation should actually be asserted, by default only the expected and actual results are written to a file, but not compared. |
protected abstract Parser |
createParser()
Create a new instance of the parser to test. |
protected abstract Sink |
createSink(Writer writer)
Return a new instance of the sink that is being tested. |
protected String |
getExpected()
|
protected String |
getOutputDir()
Returns the directory where test output will go. |
protected String |
outputExtension()
The output files generated by this class are text files, independent of the kind of module being tested. |
void |
testIdentity()
Pipes a full model generated by SinkTestDocument through
a Sink (generated by createSink(Writer) ) and a Parser
(generated by createParser() ) and checks if the result
is the same as the original model. |
Methods inherited from class org.apache.maven.doxia.AbstractModuleTest |
---|
getBasedirFile, getTestReader, getTestReader, getTestWriter, getTestWriter, getTestWriterFile, getTestWriterFile, getXmlTestWriter, getXmlTestWriter, outputBaseDir |
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 |
---|
public AbstractIdentityTest()
Method Detail |
---|
protected abstract Parser createParser()
protected abstract Sink createSink(Writer writer)
writer
- The writer for the sink.
public void testIdentity() throws IOException, ParseException
SinkTestDocument
through
a Sink (generated by createSink(Writer)
) and a Parser
(generated by createParser()
) and checks if the result
is the same as the original model. By default, this doesn't actually
assert anything (use assertIdentity(boolean)
in the setUp()
of an implementation to switch on the test), but the two generated
output files, expected.txt and actual.txt, can be compared for differences.
IOException
- if there's a problem reading/writing a test file.
ParseException
- if a model cannot be parsed.protected String getOutputDir()
getOutputDir
in class AbstractModuleTest
protected String outputExtension()
outputExtension
in class AbstractModuleTest
protected void assertIdentity(boolean doAssert)
doAssert
- True to actually execute the test.protected String getExpected()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |