public abstract class AbstractSinkTest 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 |
---|
AbstractSinkTest() |
Modifier and Type | Method and Description |
---|---|
protected abstract Sink |
createSink(Writer writer)
Return a new instance of the sink that is being tested.
|
protected abstract String |
getAnchorBlock(String anchor)
Returns a Anchor block generated by this sink.
|
protected abstract String |
getAuthorBlock(String author)
Returns an author block generated by this sink.
|
protected abstract String |
getBodyBlock()
Returns a body block generated by this sink.
|
protected abstract String |
getBoldBlock(String text)
Returns a Bold block generated by this sink.
|
protected abstract String |
getCommentBlock(String text)
Returns a comment block generated by this sink.
|
protected abstract String |
getDateBlock(String date)
Returns a date block generated by this sink.
|
protected abstract String |
getDefinitionListBlock(String definum,
String definition)
Returns a DefinitionList block generated by this sink.
|
protected abstract String |
getFigureBlock(String source,
String caption)
Returns a Figure block generated by this sink.
|
protected abstract String |
getHeadBlock()
Returns a head block generated by this sink.
|
protected abstract String |
getHorizontalRuleBlock()
Returns a HorizontalRule block generated by this sink.
|
protected abstract String |
getItalicBlock(String text)
Returns a Italic block generated by this sink.
|
protected abstract String |
getLineBreakBlock()
Returns a LineBreak block generated by this sink.
|
protected abstract String |
getLinkBlock(String link,
String text)
Returns a Link block generated by this sink.
|
protected abstract String |
getListBlock(String item)
Returns a list block generated by this sink.
|
protected abstract String |
getMonospacedBlock(String text)
Returns a Monospaced block generated by this sink.
|
protected abstract String |
getNonBreakingSpaceBlock()
Returns a NonBreakingSpace block generated by this sink.
|
protected abstract String |
getNumberedListBlock(String item)
Returns a NumberedList block generated by this sink.
|
protected String |
getOutputDir()
Returns the directory where all sink test output will go.
|
protected abstract String |
getPageBreakBlock()
Returns a PageBreak block generated by this sink.
|
protected abstract String |
getParagraphBlock(String text)
Returns a Paragraph block generated by this sink.
|
protected abstract String |
getRawTextBlock(String text)
Returns a RawText block generated by this sink.
|
protected abstract String |
getSection1Block(String title)
Returns a Section1 block generated by this sink.
|
protected abstract String |
getSection2Block(String title)
Returns a Section2 block generated by this sink.
|
protected abstract String |
getSection3Block(String title)
Returns a Section3 block generated by this sink.
|
protected abstract String |
getSection4Block(String title)
Returns a Section4 block generated by this sink.
|
protected abstract String |
getSection5Block(String title)
Returns a Section5 block generated by this sink.
|
protected abstract String |
getSectionTitleBlock(String title)
Returns a SectionTitle block generated by this sink.
|
protected Sink |
getSink()
Returns the sink that is currently being tested.
|
protected String |
getSinkContent()
Returns a String representation of all events that have been written to the sink.
|
protected abstract String |
getTableBlock(String cell,
String caption)
Returns a Table block generated by this sink.
|
protected abstract String |
getTextBlock(String text)
Returns a Text block generated by this sink.
|
protected abstract String |
getTitleBlock(String title)
Returns a title block generated by this sink.
|
protected abstract String |
getVerbatimBlock(String text)
Returns a Verbatim block generated by this sink.
|
protected abstract boolean |
isXmlSink()
This method allows to use the correct Writer in
testTestDocument() . |
protected void |
setUp()
Resets the writer and creates a new sink with it.
|
void |
testAnchor()
Checks that the sequence
[anchor( anchor ), text( anchor ),
anchor_()] , invoked on the current sink, produces the same
result as getAnchorBlock ( anchor ). |
void |
testAuthor()
Checks that the sequence
[author(), text( author ), author_()]
, invoked on the current sink, produces the same result as
getAuthorBlock ( author ). |
void |
testBody()
Checks that the sequence
[body(), body_()] ,
invoked on the current sink, produces the same result as
getBodyBlock() . |
void |
testBold()
Checks that the sequence
[bold(), text( text ), bold_()] ,
invoked on the current sink, produces the same result as
getBoldBlock ( text ). |
void |
testComment()
Checks that the sequence
[comment(comment)] ,
invoked on the current sink, produces the same result as
getCommentBlock ( comment ). |
void |
testDate()
Checks that the sequence
[date(), text( date ), date_()] ,
invoked on the current sink, produces the same result as
getDateBlock ( date ). |
void |
testDefinitionList()
Checks that the sequence
[definitionList(), definitionListItem(),
definedTerm(), text( definum ), definedTerm_(), definition(),
text( definition ), definition_(), definitionListItem_(),
definitionList_()] , invoked on the current sink, produces the same
result as getDefinitionListBlock
( definum, definition ). |
void |
testFigure()
Checks that the sequence
[figure(), figureGraphics( source ),
figureCaption(), text( caption ), figureCaption_(), figure_()] ,
invoked on the current sink, produces the same result as
getFigureBlock ( source, caption ). |
void |
testFigureWithoutCaption() |
void |
testHead()
Checks that the sequence
[head(), head_()] ,
invoked on the current sink, produces the same result as
getHeadBlock() . |
void |
testHorizontalRule()
Checks that the sequence
[horizontalRule()] ,
invoked on the current sink, produces the same result as
getHorizontalRuleBlock() . |
void |
testItalic()
Checks that the sequence
[italic(), text( text ), italic_()] ,
invoked on the current sink, produces the same result as
getItalicBlock ( text ). |
void |
testLineBreak()
Checks that the sequence
[lineBreak()] ,
invoked on the current sink, produces the same result as
getLineBreakBlock() . |
void |
testLink()
Checks that the sequence
[link( link ), text( text ),
link_()] , invoked on the current sink, produces the same
result as getLinkBlock ( link, text ). |
void |
testList()
Checks that the sequence
[list(), listItem(), text( item ),
listItem_(), list_()] , invoked on the current sink, produces
the same result as getListBlock ( item ). |
void |
testMonospaced()
Checks that the sequence
[monospaced(), text( text ),
monospaced_()] , invoked on the current sink, produces the same
result as getMonospacedBlock ( text ). |
void |
testNonBreakingSpace()
Checks that the sequence
[nonBreakingSpace()] ,
invoked on the current sink, produces the same result as
getNonBreakingSpaceBlock() . |
void |
testNumberedList()
Checks that the sequence
[numberedList( Sink.NUMBERING_LOWER_ROMAN ), numberedListItem(),
text( item ), numberedListItem_(), numberedList_()] ,
invoked on the current sink, produces the same result as
getNumberedListBlock ( item ). |
void |
testPageBreak()
Checks that the sequence
[pageBreak()] ,
invoked on the current sink, produces the same result as
getPageBreakBlock() . |
void |
testParagraph()
Checks that the sequence
[paragraph(), text( text ),
paragraph_()] , invoked on the current sink, produces
the same result as getParagraphBlock ( text ). |
void |
testRawText()
Checks that the sequence
[rawText( text )] ,
invoked on the current sink, produces the same result as
getRawTextBlock ( text ). |
void |
testSection1()
Checks that the sequence
[section1(), sectionTitle1(),
text( title ), sectionTitle1_(), section1_()] ,
invoked on the current sink, produces the same result as
getSection1Block ( title ). |
void |
testSection2()
Checks that the sequence
[section2(), sectionTitle2(),
text( title ), sectionTitle2_(), section2_()] ,
invoked on the current sink, produces the same result as
getSection2Block ( title ). |
void |
testSection3()
Checks that the sequence
[section3(), sectionTitle3(),
text( title ), sectionTitle3_(), section3_()] ,
invoked on the current sink, produces the same result as
getSection3Block ( title ). |
void |
testSection4()
Checks that the sequence
[section4(), sectionTitle4(),
text( title ), sectionTitle4_(), section4_()] ,
invoked on the current sink, produces the same result as
getSection4Block ( title ). |
void |
testSection5()
Checks that the sequence
[section5(), sectionTitle5(),
text( title ), sectionTitle5_(), section5_()] ,
invoked on the current sink, produces the same result as
getSection5Block ( title ). |
void |
testSectionTitle()
Checks that the sequence
[sectionTitle(), text( title ),
sectionTitle_()] , invoked on the current sink, produces
the same result as
getSectionTitleBlock ( title ). |
void |
testTable()
Checks that the sequence
[table(),
tableRows( Sink.JUSTIFY_CENTER, false ), tableRow(), tableCell(),
text( cell ), tableCell_(), tableRow_(), tableRows_(), tableCaption(),
text( caption ), tableCaption_(), table_()] ,
invoked on the current sink, produces the same result as
getTableBlock ( cell, caption ). |
void |
testTestDocument()
Tests that the current sink is able to render the common test document.
|
void |
testText()
Checks that the sequence
[text( text )] ,
invoked on the current sink, produces the same result as
getTextBlock() . |
void |
testTitle()
Checks that the sequence
[title(), text( title ), title_()] ,
invoked on the current sink, produces the same result as
getTitleBlock ( title ). |
void |
testVerbatim()
Checks that the sequence
[verbatim( SinkEventAttributeSet.BOXED ), text( text ),
verbatim_()] , invoked on the current sink, produces the
same result as getVerbatimBlock ( text ). |
protected static String |
toXmlComment(String comment)
Transforms a given string to be compatible to XML comments.
|
protected void |
verifyDecorationLineThrough(String text) |
protected void |
verifyDecorationUnderline(String text) |
protected void |
verifyValignSub(String text) |
protected void |
verifyValignSup(String text) |
protected String |
wrapXml(String xmlFragment)
Ability to wrap the xmlFragment with a roottag and namespaces, when required
|
getBasedirFile, getTestReader, getTestReader, getTestWriter, getTestWriter, getTestWriterFile, getTestWriterFile, getXmlTestWriter, getXmlTestWriter, normalizeLineEnds, outputBaseDir, outputExtension
customizeComponentConfiguration, customizeContainerConfiguration, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getConfigurationName, getContainer, getCustomConfigurationName, getResourceAsStream, getTestConfiguration, getTestConfiguration, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, lookup, lookup, release, 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 AbstractSinkTest()
protected void setUp() throws Exception
setUp
in class PlexusTestCase
Exception
- if something goes wrong.protected String wrapXml(String xmlFragment)
xmlFragment
- protected static String toXmlComment(String comment)
comment
- The string to transform.http://www.w3.org/TR/2000/REC-xml-20001006#sec-comments
public final void testTestDocument() throws IOException
isXmlSink()
, it uses an Xml Writer defined by AbstractModuleTest.getXmlTestWriter(String)
. If not, it uses
the Writer defined by AbstractModuleTest.getTestWriter(String)
.IOException
- If the target test document could not be generated.SinkTestDocument
,
isXmlSink()
,
AbstractModuleTest.getTestWriter(String)
,
AbstractModuleTest.getXmlTestWriter(String)
public void testTitle()
[title(), text( title ), title_()]
,
invoked on the current sink, produces the same result as
getTitleBlock
( title ).public void testAuthor()
[author(), text( author ), author_()]
, invoked on the current sink, produces the same result as
getAuthorBlock
( author ).public void testDate()
[date(), text( date ), date_()]
,
invoked on the current sink, produces the same result as
getDateBlock
( date ).public void testHead()
[head(), head_()]
,
invoked on the current sink, produces the same result as
getHeadBlock()
.public void testBody()
[body(), body_()]
,
invoked on the current sink, produces the same result as
getBodyBlock()
.public void testSectionTitle()
[sectionTitle(), text( title ),
sectionTitle_()]
, invoked on the current sink, produces
the same result as
getSectionTitleBlock
( title ).public void testSection1()
[section1(), sectionTitle1(),
text( title ), sectionTitle1_(), section1_()]
,
invoked on the current sink, produces the same result as
getSection1Block
( title ).public void testSection2()
[section2(), sectionTitle2(),
text( title ), sectionTitle2_(), section2_()]
,
invoked on the current sink, produces the same result as
getSection2Block
( title ).public void testSection3()
[section3(), sectionTitle3(),
text( title ), sectionTitle3_(), section3_()]
,
invoked on the current sink, produces the same result as
getSection3Block
( title ).public void testSection4()
[section4(), sectionTitle4(),
text( title ), sectionTitle4_(), section4_()]
,
invoked on the current sink, produces the same result as
getSection4Block
( title ).public void testSection5()
[section5(), sectionTitle5(),
text( title ), sectionTitle5_(), section5_()]
,
invoked on the current sink, produces the same result as
getSection5Block
( title ).public void testList()
[list(), listItem(), text( item ),
listItem_(), list_()]
, invoked on the current sink, produces
the same result as getListBlock
( item ).public void testNumberedList()
[numberedList( Sink.NUMBERING_LOWER_ROMAN ), numberedListItem(),
text( item ), numberedListItem_(), numberedList_()]
,
invoked on the current sink, produces the same result as
getNumberedListBlock
( item ).public void testDefinitionList()
[definitionList(), definitionListItem(),
definedTerm(), text( definum ), definedTerm_(), definition(),
text( definition ), definition_(), definitionListItem_(),
definitionList_()]
, invoked on the current sink, produces the same
result as getDefinitionListBlock
( definum, definition ).public void testFigure() throws Exception
[figure(), figureGraphics( source ),
figureCaption(), text( caption ), figureCaption_(), figure_()]
,
invoked on the current sink, produces the same result as
getFigureBlock
( source, caption ).Exception
public void testFigureWithoutCaption() throws Exception
Exception
public void testTable() throws Exception
[table(),
tableRows( Sink.JUSTIFY_CENTER, false ), tableRow(), tableCell(),
text( cell ), tableCell_(), tableRow_(), tableRows_(), tableCaption(),
text( caption ), tableCaption_(), table_()]
,
invoked on the current sink, produces the same result as
getTableBlock
( cell, caption ).Exception
public void testParagraph()
[paragraph(), text( text ),
paragraph_()]
, invoked on the current sink, produces
the same result as getParagraphBlock
( text ).public void testVerbatim()
[verbatim( SinkEventAttributeSet.BOXED ), text( text ),
verbatim_()]
, invoked on the current sink, produces the
same result as getVerbatimBlock
( text ).public void testHorizontalRule()
[horizontalRule()]
,
invoked on the current sink, produces the same result as
getHorizontalRuleBlock()
.public void testPageBreak()
[pageBreak()]
,
invoked on the current sink, produces the same result as
getPageBreakBlock()
.public void testAnchor()
[anchor( anchor ), text( anchor ),
anchor_()]
, invoked on the current sink, produces the same
result as getAnchorBlock
( anchor ).public void testLink()
[link( link ), text( text ),
link_()]
, invoked on the current sink, produces the same
result as getLinkBlock
( link, text ).public void testItalic()
[italic(), text( text ), italic_()]
,
invoked on the current sink, produces the same result as
getItalicBlock
( text ).public void testBold()
[bold(), text( text ), bold_()]
,
invoked on the current sink, produces the same result as
getBoldBlock
( text ).public void testMonospaced()
[monospaced(), text( text ),
monospaced_()]
, invoked on the current sink, produces the same
result as getMonospacedBlock
( text ).public void testLineBreak()
[lineBreak()]
,
invoked on the current sink, produces the same result as
getLineBreakBlock()
.public void testNonBreakingSpace()
[nonBreakingSpace()]
,
invoked on the current sink, produces the same result as
getNonBreakingSpaceBlock()
.public void testText()
[text( text )]
,
invoked on the current sink, produces the same result as
getTextBlock()
.public void testRawText()
[rawText( text )]
,
invoked on the current sink, produces the same result as
getRawTextBlock
( text ).public void testComment()
[comment(comment)]
,
invoked on the current sink, produces the same result as
getCommentBlock
( comment ).protected Sink getSink()
protected String getSinkContent()
protected String getOutputDir()
getOutputDir
in class AbstractModuleTest
protected abstract boolean isXmlSink()
testTestDocument()
.true
if the Sink is an XML one, false
otherwise.testTestDocument()
protected abstract Sink createSink(Writer writer)
writer
- The writer for the sink.protected abstract String getTitleBlock(String title)
title
- The title to use.testTitle()
protected abstract String getAuthorBlock(String author)
author
- The author to use.testAuthor()
protected abstract String getDateBlock(String date)
date
- The date to use.testDate()
protected abstract String getHeadBlock()
testHead()
protected abstract String getBodyBlock()
testBody()
protected abstract String getSectionTitleBlock(String title)
title
- The title to use.testSectionTitle()
protected abstract String getSection1Block(String title)
title
- The title to use.testSection1()
protected abstract String getSection2Block(String title)
title
- The title to use.testSection2()
protected abstract String getSection3Block(String title)
title
- The title to use.testSection3()
protected abstract String getSection4Block(String title)
title
- The title to use.testSection4()
protected abstract String getSection5Block(String title)
title
- The title to use.testSection5()
protected abstract String getListBlock(String item)
item
- The item to use.testList()
protected abstract String getNumberedListBlock(String item)
item
- The item to use.testNumberedList()
protected abstract String getDefinitionListBlock(String definum, String definition)
definum
- The term to define.definition
- The definition.testDefinitionList()
protected abstract String getFigureBlock(String source, String caption)
source
- The figure source string.caption
- The caption to use (may be null).testFigure()
protected abstract String getTableBlock(String cell, String caption)
cell
- A tabel cell to use.caption
- The caption to use (may be null).testTable()
protected abstract String getParagraphBlock(String text)
text
- The text to use.testParagraph()
protected abstract String getVerbatimBlock(String text)
text
- The text to use.testVerbatim()
protected abstract String getHorizontalRuleBlock()
testHorizontalRule()
protected abstract String getPageBreakBlock()
testPageBreak()
protected abstract String getAnchorBlock(String anchor)
anchor
- The anchor to use.testAnchor()
protected abstract String getLinkBlock(String link, String text)
link
- The link to use.text
- The link text.testLink()
protected abstract String getItalicBlock(String text)
text
- The text to use.testItalic()
protected abstract String getBoldBlock(String text)
text
- The text to use.testBold()
protected abstract String getMonospacedBlock(String text)
text
- The text to use.testMonospaced()
protected abstract String getLineBreakBlock()
testLineBreak()
protected abstract String getNonBreakingSpaceBlock()
testNonBreakingSpace()
protected abstract String getTextBlock(String text)
text
- The text to use.testText()
protected abstract String getRawTextBlock(String text)
text
- The text to use.testRawText()
protected abstract String getCommentBlock(String text)
text
- The text to use.testComment()
protected final void verifyValignSup(String text)
protected final void verifyValignSub(String text)
protected final void verifyDecorationUnderline(String text)
protected final void verifyDecorationLineThrough(String text)
Copyright © 2005–2017 The Apache Software Foundation. All rights reserved.