public abstract class AbstractIdentityTest extends AbstractModuleTest
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 and Description |
---|
AbstractIdentityTest() |
Modifier and Type | Method and Description |
---|---|
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. |
getBasedirFile, getTestReader, getTestReader, getTestWriter, getTestWriter, getTestWriterFile, getTestWriterFile, getXmlTestWriter, getXmlTestWriter, normalizeLineEnds, outputBaseDir
customizeComponentConfiguration, customizeContainerConfiguration, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getConfigurationName, getContainer, getCustomConfigurationName, getResourceAsStream, getTestConfiguration, getTestConfiguration, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, lookup, lookup, release, setUp, setupContainer, tearDown
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
public AbstractIdentityTest()
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()
Copyright © 2005–2017 The Apache Software Foundation. All rights reserved.