You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2008/10/15 23:46:10 UTC
svn commit: r705065 [2/2] - in
/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src:
main/java/org/apache/maven/doxia/module/twiki/
main/java/org/apache/maven/doxia/module/twiki/parser/
test/java/org/apache/maven/doxia/module/twiki/parser/
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/BlockTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/BlockTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/BlockTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/BlockTest.java Wed Oct 15 14:46:08 2008
@@ -23,7 +23,6 @@
import junit.framework.TestCase;
-
/**
* Generic unit tests for
* {@link Block}s
@@ -31,7 +30,8 @@
* @author Juan F. Codagnone
* @since Nov 2, 2005
*/
-public class BlockTest extends TestCase
+public class BlockTest
+ extends TestCase
{
/**
@@ -39,8 +39,7 @@
*/
public final void testTextBlockEquals()
{
- testEquals( new TextBlock( "bar" ), new TextBlock( "bar" ),
- new TextBlock( "foo" ) );
+ testEquals( new TextBlock( "bar" ), new TextBlock( "bar" ), new TextBlock( "foo" ) );
}
/**
@@ -48,15 +47,13 @@
*/
public final void testWikiWordBlockEquals()
{
- final WikiWordLinkResolver resolver =
- new XHTMLWikiWordLinkResolver();
- testEquals( new WikiWordBlock( "bar", resolver ),
- new WikiWordBlock( "bar", resolver ),
+ final WikiWordLinkResolver resolver = new XHTMLWikiWordLinkResolver();
+ testEquals( new WikiWordBlock( "bar", resolver ), new WikiWordBlock( "bar", resolver ),
new WikiWordBlock( "foo", resolver ) );
testEquals( new WikiWordBlock( "bar", new TextBlock( "text" ), resolver ),
- new WikiWordBlock( "bar", new TextBlock( "text" ), resolver ),
- new WikiWordBlock( "bar", resolver ) );
+ new WikiWordBlock( "bar", new TextBlock( "text" ), resolver ), new WikiWordBlock( "bar",
+ resolver ) );
testEquals( new WikiWordBlock( "bar", new TextBlock( "text" ), resolver ),
new WikiWordBlock( "bar", new TextBlock( "text" ), resolver ),
@@ -70,8 +67,7 @@
public final void testLinkBlockEquals()
{
testEquals( new LinkBlock( "foo", new TextBlock( "bar" ) ),
- new LinkBlock( "foo", new TextBlock( "bar" ) ),
- new LinkBlock( "bar", new TextBlock( "foo" ) ) );
+ new LinkBlock( "foo", new TextBlock( "bar" ) ), new LinkBlock( "bar", new TextBlock( "foo" ) ) );
}
/**
@@ -79,12 +75,9 @@
*/
public final void testListBlockEquals()
{
- final Block []blocks = new Block[]{
- new TextBlock( "hello" )
- };
+ final Block[] blocks = new Block[] { new TextBlock( "hello" ) };
- testEquals( new ListItemBlock( blocks ), new ListItemBlock( blocks ),
- new ListItemBlock( new Block[]{} ) );
+ testEquals( new ListItemBlock( blocks ), new ListItemBlock( blocks ), new ListItemBlock( new Block[] {} ) );
}
/**
@@ -93,39 +86,30 @@
public final void testNestedBlockEquals()
{
- testEquals(
- new ParagraphBlock( new Block[]{
- new BoldBlock( new Block[]{new TextBlock( "foo" )} )} ),
- new ParagraphBlock( new Block[]{
- new BoldBlock( new Block[]{new TextBlock( "foo" )} )} ),
- new ParagraphBlock( new Block[]{
- new BoldBlock( new Block[]{new TextBlock( "bar" )} )} )
- );
+ testEquals( new ParagraphBlock( new Block[] { new BoldBlock( new Block[] { new TextBlock( "foo" ) } ) } ),
+ new ParagraphBlock( new Block[] { new BoldBlock( new Block[] { new TextBlock( "foo" ) } ) } ),
+ new ParagraphBlock( new Block[] { new BoldBlock( new Block[] { new TextBlock( "bar" ) } ) } ) );
}
-
/**
* @see AbstractFatherBlock#equals(Object)
*/
public final void testAbstractFatherBlockEquals()
{
- assertFalse( Arrays.equals( new Block[]{
- new TextBlock( "mary " ),
- new ItalicBlock( new Block[]{
- new MonospaceBlock( new Block[]{
- new TextBlock( "has" )
- } )
- } ),
- },
- new Block[]{
+ assertFalse( Arrays
+ .equals(
+ new Block[] {
+ new TextBlock( "mary " ),
+ new ItalicBlock(
+ new Block[] { new MonospaceBlock(
+ new Block[] { new TextBlock(
+ "has" ) } ) } ), },
+ new Block[] {
new TextBlock( "mary " ),
- new BoldBlock( new Block[]{
- new MonospaceBlock( new Block[]{
- new TextBlock( "has" )
- } )
- } ),
- }
- ) );
+ new BoldBlock(
+ new Block[] { new MonospaceBlock(
+ new Block[] { new TextBlock(
+ "has" ) } ) } ), } ) );
}
/**
@@ -133,8 +117,7 @@
*/
public final void testAnchorBlockEquals()
{
- testEquals( new AnchorBlock( "anchor" ), new AnchorBlock( "anchor" ),
- new AnchorBlock( "anch" ) );
+ testEquals( new AnchorBlock( "anchor" ), new AnchorBlock( "anchor" ), new AnchorBlock( "anch" ) );
}
/**
@@ -150,8 +133,7 @@
* @param b an object that is equals to a
* @param c a diferent object
*/
- public final void testEquals( final Object a, final Object b,
- final Object c )
+ public final void testEquals( final Object a, final Object b, final Object c )
{
assertFalse( a.equals( null ) );
assertFalse( b.equals( null ) );
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/FormatedTextTest.java Wed Oct 15 14:46:08 2008
@@ -21,14 +21,14 @@
import java.util.Arrays;
-
/**
* Tests the {@link org.apache.maven.doxia.module.twiki.parser.FormatedTextParser}
*
* @author Juan F. Codagnone
* @since Nov 2, 2005
*/
-public class FormatedTextTest extends AbstractBlockTestCase
+public class FormatedTextTest
+ extends AbstractBlockTestCase
{
/**
@@ -37,38 +37,28 @@
public final void testBold()
{
String text;
- Block []blocks;
+ Block[] blocks;
text = "*bold*";
blocks = formatTextParser.parse( text );
assertEquals( 1, blocks.length );
- assertEquals( new BoldBlock( new Block[]{new TextBlock( "bold" )} ),
- blocks[0] );
+ assertEquals( new BoldBlock( new Block[] { new TextBlock( "bold" ) } ), blocks[0] );
text = "foo *bold* bar";
blocks = formatTextParser.parse( text );
- assertTrue( Arrays.equals( new Block[]{
- new TextBlock( "foo " ),
- new BoldBlock( new Block[]{new TextBlock( "bold" )} ),
- new TextBlock( " bar" ),
- }, blocks ) );
+ assertTrue( Arrays.equals( new Block[] { new TextBlock( "foo " ),
+ new BoldBlock( new Block[] { new TextBlock( "bold" ) } ), new TextBlock( " bar" ), }, blocks ) );
text = "\t*bold* bar";
blocks = formatTextParser.parse( text );
- assertTrue( Arrays.equals( new Block[]{
- new TextBlock( "\t" ),
- new BoldBlock( new Block[]{new TextBlock( "bold" )} ),
- new TextBlock( " bar" ),
- }, blocks ) );
+ assertTrue( Arrays.equals( new Block[] { new TextBlock( "\t" ),
+ new BoldBlock( new Block[] { new TextBlock( "bold" ) } ), new TextBlock( " bar" ), }, blocks ) );
text = "*nice* foo *bold* bar";
blocks = formatTextParser.parse( text );
- assertTrue( Arrays.equals( new Block[]{
- new BoldBlock( new Block[]{new TextBlock( "nice" )} ),
- new TextBlock( " foo " ),
- new BoldBlock( new Block[]{new TextBlock( "bold" )} ),
- new TextBlock( " bar" ),
- }, blocks ) );
+ assertTrue( Arrays.equals( new Block[] { new BoldBlock( new Block[] { new TextBlock( "nice" ) } ),
+ new TextBlock( " foo " ), new BoldBlock( new Block[] { new TextBlock( "bold" ) } ),
+ new TextBlock( " bar" ), }, blocks ) );
}
/**
@@ -77,30 +67,23 @@
public final void testItalic()
{
String text;
- Block []blocks;
+ Block[] blocks;
text = "_italic_";
blocks = formatTextParser.parse( text );
assertEquals( 1, blocks.length );
- assertEquals( new ItalicBlock( new Block[]{new TextBlock( "italic" )} ),
- blocks[0] );
+ assertEquals( new ItalicBlock( new Block[] { new TextBlock( "italic" ) } ), blocks[0] );
text = "foo _italic_ bar";
blocks = formatTextParser.parse( text );
- assertTrue( Arrays.equals( new Block[]{
- new TextBlock( "foo " ),
- new ItalicBlock( new Block[]{new TextBlock( "italic" )} ),
- new TextBlock( " bar" ),
- }, blocks ) );
+ assertTrue( Arrays.equals( new Block[] { new TextBlock( "foo " ),
+ new ItalicBlock( new Block[] { new TextBlock( "italic" ) } ), new TextBlock( " bar" ), }, blocks ) );
text = "_nice_ foo _italic_ bar";
blocks = formatTextParser.parse( text );
- assertTrue( Arrays.equals( new Block[]{
- new ItalicBlock( new Block[]{new TextBlock( "nice" )} ),
- new TextBlock( " foo " ),
- new ItalicBlock( new Block[]{new TextBlock( "italic" )} ),
- new TextBlock( " bar" ),
- }, blocks ) );
+ assertTrue( Arrays.equals( new Block[] { new ItalicBlock( new Block[] { new TextBlock( "nice" ) } ),
+ new TextBlock( " foo " ), new ItalicBlock( new Block[] { new TextBlock( "italic" ) } ),
+ new TextBlock( " bar" ), }, blocks ) );
}
/**
@@ -109,19 +92,16 @@
public final void testMonospaced()
{
String text;
- Block []blocks;
+ Block[] blocks;
text = "mary =has= a =little= lamb He followed her (=to school one day=)";
blocks = formatTextParser.parse( text );
- assertTrue( Arrays.equals( new Block[]{
- new TextBlock( "mary " ),
- new MonospaceBlock( new Block[]{new TextBlock( "has" )} ),
- new TextBlock( " a " ),
- new MonospaceBlock( new Block[]{new TextBlock( "little" )} ),
+ assertTrue( Arrays.equals( new Block[] { new TextBlock( "mary " ),
+ new MonospaceBlock( new Block[] { new TextBlock( "has" ) } ), new TextBlock( " a " ),
+ new MonospaceBlock( new Block[] { new TextBlock( "little" ) } ),
new TextBlock( " lamb He followed her (" ),
- new MonospaceBlock( new Block[]{new TextBlock( "to school one day" )} ),
- new TextBlock( ")" ),
- }, blocks ) );
+ new MonospaceBlock( new Block[] { new TextBlock( "to school one day" ) } ), new TextBlock( ")" ), },
+ blocks ) );
}
/**
@@ -130,25 +110,16 @@
public final void testBoldMonospaced()
{
String text;
- Block []blocks;
+ Block[] blocks;
text = "mary ==has== a ==little== lamb";
blocks = formatTextParser.parse( text );
- Block [] expected = new Block[]{
- new TextBlock( "mary " ),
- new BoldBlock( new Block[]{
- new MonospaceBlock( new Block[]{
- new TextBlock( "has" )
- } )
- } ),
- new TextBlock( " a " ),
- new BoldBlock( new Block[]{
- new MonospaceBlock( new Block[]{
- new TextBlock( "little" )
- } )
- } ),
- new TextBlock( " lamb" ),
- };
+ Block[] expected =
+ new Block[] { new TextBlock( "mary " ),
+ new BoldBlock( new Block[] { new MonospaceBlock( new Block[] { new TextBlock( "has" ) } ) } ),
+ new TextBlock( " a " ),
+ new BoldBlock( new Block[] { new MonospaceBlock( new Block[] { new TextBlock( "little" ) } ) } ),
+ new TextBlock( " lamb" ), };
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -159,25 +130,15 @@
public final void testBoldItalic()
{
String text;
- Block []blocks;
+ Block[] blocks;
text = "mary __has__ a __little__ lamb";
blocks = formatTextParser.parse( text );
- assertTrue( Arrays.equals( new Block[]{
- new TextBlock( "mary " ),
- new BoldBlock( new Block[]{
- new ItalicBlock( new Block[]{
- new TextBlock( "has" )
- } )
- } ),
+ assertTrue( Arrays.equals( new Block[] { new TextBlock( "mary " ),
+ new BoldBlock( new Block[] { new ItalicBlock( new Block[] { new TextBlock( "has" ) } ) } ),
new TextBlock( " a " ),
- new BoldBlock( new Block[]{
- new ItalicBlock( new Block[]{
- new TextBlock( "little" )
- } )
- } ),
- new TextBlock( " lamb" ),
- }, blocks ) );
+ new BoldBlock( new Block[] { new ItalicBlock( new Block[] { new TextBlock( "little" ) } ) } ),
+ new TextBlock( " lamb" ), }, blocks ) );
}
/**
@@ -186,23 +147,17 @@
public final void testMultiFormatSideBySide()
{
String text;
- Block []blocks;
- Block []expected;
-
+ Block[] blocks;
+ Block[] expected;
text = "All *work and* =no play= _makes_ Juan a dull *boy*";
blocks = formatTextParser.parse( text );
- expected = new Block[]{
- new TextBlock( "All " ),
- new BoldBlock( new Block[]{new TextBlock( "work and" )} ),
- new TextBlock( " " ),
- new MonospaceBlock( new Block[]{new TextBlock( "no play" )} ),
- new TextBlock( " " ),
- new ItalicBlock( new Block[]{new TextBlock( "makes" )} ),
- new TextBlock( " Juan a dull " ),
- new BoldBlock( new Block[]{new TextBlock( "boy" )} ),
- };
+ expected =
+ new Block[] { new TextBlock( "All " ), new BoldBlock( new Block[] { new TextBlock( "work and" ) } ),
+ new TextBlock( " " ), new MonospaceBlock( new Block[] { new TextBlock( "no play" ) } ),
+ new TextBlock( " " ), new ItalicBlock( new Block[] { new TextBlock( "makes" ) } ),
+ new TextBlock( " Juan a dull " ), new BoldBlock( new Block[] { new TextBlock( "boy" ) } ), };
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -213,25 +168,22 @@
public final void testMultiFormatInside()
{
String text;
- Block []blocks;
- Block []expected;
+ Block[] blocks;
+ Block[] expected;
text = "All *work and =no play _makes_ Juan= a dull* boy";
blocks = formatTextParser.parse( text );
- expected = new Block[]{
- new TextBlock( "All " ),
- new BoldBlock( new Block[]{
- new TextBlock( "work and " ),
- new MonospaceBlock( new Block[]{
- new TextBlock( "no play " ),
- new ItalicBlock( new Block[]{new TextBlock( "makes" )} ),
- new TextBlock( " Juan" ),
- } ),
- new TextBlock( " a dull" ),
- } ),
- new TextBlock( " boy" ),
- };
+ expected =
+ new Block[] {
+ new TextBlock( "All " ),
+ new BoldBlock(
+ new Block[] {
+ new TextBlock( "work and " ),
+ new MonospaceBlock( new Block[] { new TextBlock( "no play " ),
+ new ItalicBlock( new Block[] { new TextBlock( "makes" ) } ),
+ new TextBlock( " Juan" ), } ), new TextBlock( " a dull" ), } ),
+ new TextBlock( " boy" ), };
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -256,8 +208,6 @@
*/
public final void testHanging( final String text )
{
- assertTrue( Arrays.equals(
- new Block[]{new TextBlock( text )},
- formatTextParser.parse( text ) ) );
+ assertTrue( Arrays.equals( new Block[] { new TextBlock( text ) }, formatTextParser.parse( text ) ) );
}
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ListTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ListTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ListTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ListTest.java Wed Oct 15 14:46:08 2008
@@ -26,14 +26,14 @@
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.sink.Sink;
-
/**
* Units tests for Lists
*
* @author Juan F. Codagnone
* @since Nov 1, 2005
*/
-public class ListTest extends AbstractBlockTestCase
+public class ListTest
+ extends AbstractBlockTestCase
{
/**
@@ -41,31 +41,22 @@
*
* @throws ParseException on error
*/
- public final void testList() throws ParseException
+ public final void testList()
+ throws ParseException
{
final BlockParser parser = listParser;
- final String text = ""
- + " * item1.1 \n"
- + " * item2\n"
- + " * item2.1\n"
- + " * item3\n"
- + " * item3.1\n"
- + " * item3.2\n"
- + " * item3.2.1\n"
- + " * item3.2.2\n"
- + " * item3.2.3\n"
- + " * item3.3\n"
- + " * item3.3.1\n"
- + " * item4";
+ final String text =
+ "" + " * item1.1 \n" + " * item2\n" + " * item2.1\n" + " * item3\n"
+ + " * item3.1\n" + " * item3.2\n" + " * item3.2.1\n" + " * item3.2.2\n"
+ + " * item3.2.3\n" + " * item3.3\n" + " * item3.3.1\n" + " * item4";
- final ByLineSource source = new ByLineReaderSource( new StringReader(
- text ) );
+ final ByLineSource source = new ByLineReaderSource( new StringReader( text ) );
final Block b = parser.visit( source.getNextLine(), source );
- final Block []firstLevelBlocks = ( (UnorderedListBlock) b ).getBlocks();
+ final Block[] firstLevelBlocks = ( (UnorderedListBlock) b ).getBlocks();
final int numberOfChild = 4;
assertEquals( numberOfChild, firstLevelBlocks.length );
-
+
for ( int i = 0; i < firstLevelBlocks.length; i++ )
{
Block block = firstLevelBlocks[i];
@@ -74,7 +65,7 @@
ListBlock list;
ListItemBlock item;
- Block [] blocks;
+ Block[] blocks;
item = (ListItemBlock) firstLevelBlocks[1];
blocks = item.getBlocks();
@@ -92,23 +83,18 @@
/**
* @throws ParseException on error
*/
- public final void testNumeringDecimal() throws ParseException
+ public final void testNumeringDecimal()
+ throws ParseException
{
- final String text = ""
- + " 1. item1\n"
- + " 1. item2\n"
- + " 1. item3";
+ final String text = "" + " 1. item1\n" + " 1. item2\n" + " 1. item3";
- final ByLineSource source = new ByLineReaderSource( new StringReader(
- text ) );
+ final ByLineSource source = new ByLineReaderSource( new StringReader( text ) );
Block blocks, expected;
- expected = new NumeratedListBlock( Sink.NUMBERING_DECIMAL,
- new ListItemBlock[]{
- new ListItemBlock( new Block[]{new TextBlock( "item1" )} ),
- new ListItemBlock( new Block[]{new TextBlock( "item2" )} ),
- new ListItemBlock( new Block[]{new TextBlock( "item3" )} ),
- }
- );
+ expected =
+ new NumeratedListBlock( Sink.NUMBERING_DECIMAL, new ListItemBlock[] {
+ new ListItemBlock( new Block[] { new TextBlock( "item1" ) } ),
+ new ListItemBlock( new Block[] { new TextBlock( "item2" ) } ),
+ new ListItemBlock( new Block[] { new TextBlock( "item3" ) } ), } );
blocks = listParser.visit( source.getNextLine(), source );
assertEquals( expected, blocks );
}
@@ -116,41 +102,26 @@
/**
* @throws ParseException on error
*/
- public final void testHetero() throws ParseException
+ public final void testHetero()
+ throws ParseException
{
- final String text = ""
- + " A. item1\n"
- + " * item1.1\n"
- + " * item1.2\n"
- + " B. item2\n"
- + " i. item2.1\n"
- + " i. item2.2\n"
- + " C. item3";
+ final String text =
+ "" + " A. item1\n" + " * item1.1\n" + " * item1.2\n" + " B. item2\n"
+ + " i. item2.1\n" + " i. item2.2\n" + " C. item3";
- final ByLineSource source = new ByLineReaderSource( new StringReader(
- text ) );
+ final ByLineSource source = new ByLineReaderSource( new StringReader( text ) );
Block blocks, expected;
- expected = new NumeratedListBlock( Sink.NUMBERING_UPPER_ALPHA,
- new ListItemBlock[]{
- new ListItemBlock( new Block[]{new TextBlock( "item1" )},
- new UnorderedListBlock( new ListItemBlock[]{
- new ListItemBlock( new Block[]{
- new TextBlock( "item1.1" )} ),
- new ListItemBlock( new Block[]{
- new TextBlock( "item1.2" )} ),
- } ) ),
- new ListItemBlock( new Block[]{new TextBlock( "item2" )},
- new NumeratedListBlock(
- Sink.NUMBERING_LOWER_ROMAN,
- new ListItemBlock[]{
- new ListItemBlock( new Block[]{
- new TextBlock( "item2.1" )} ),
- new ListItemBlock( new Block[]{
- new TextBlock( "item2.2" )} ),
- } ) ),
- new ListItemBlock( new Block[]{new TextBlock( "item3" )} ),
- }
- );
+ expected =
+ new NumeratedListBlock( Sink.NUMBERING_UPPER_ALPHA, new ListItemBlock[] {
+ new ListItemBlock( new Block[] { new TextBlock( "item1" ) },
+ new UnorderedListBlock( new ListItemBlock[] {
+ new ListItemBlock( new Block[] { new TextBlock( "item1.1" ) } ),
+ new ListItemBlock( new Block[] { new TextBlock( "item1.2" ) } ), } ) ),
+ new ListItemBlock( new Block[] { new TextBlock( "item2" ) },
+ new NumeratedListBlock( Sink.NUMBERING_LOWER_ROMAN, new ListItemBlock[] {
+ new ListItemBlock( new Block[] { new TextBlock( "item2.1" ) } ),
+ new ListItemBlock( new Block[] { new TextBlock( "item2.2" ) } ), } ) ),
+ new ListItemBlock( new Block[] { new TextBlock( "item3" ) } ), } );
blocks = listParser.visit( source.getNextLine(), source );
assertEquals( expected, blocks );
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ParagraphTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ParagraphTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ParagraphTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/ParagraphTest.java Wed Oct 15 14:46:08 2008
@@ -25,91 +25,71 @@
import org.apache.maven.doxia.util.ByLineReaderSource;
import org.apache.maven.doxia.parser.ParseException;
-
/**
* Tests the {@link org.apache.maven.doxia.module.twiki.parser.ParagraphBlockParser}
*
* @author Juan F. Codagnone
* @since Nov 1, 2005
*/
-public class ParagraphTest extends AbstractBlockTestCase
+public class ParagraphTest
+ extends AbstractBlockTestCase
{
/**
* @throws ParseException on error
*/
- public final void testMultiLines() throws ParseException
+ public final void testMultiLines()
+ throws ParseException
{
- final String text = ""
- + "\n\n\n"
- + "para1 -> text1\n"
- + "para1 -> text2\n"
- + "\n"
- + "para2 -> text1\n"
- + "para2 -> text2\n"
- + " \n \n "
- + "para2 -> text1\n"
- + "para2 -> text2\n";
+ final String text =
+ "" + "\n\n\n" + "para1 -> text1\n" + "para1 -> text2\n" + "\n" + "para2 -> text1\n"
+ + "para2 -> text2\n" + " \n \n " + "para2 -> text1\n" + "para2 -> text2\n";
- final ByLineReaderSource source = new ByLineReaderSource(
- new StringReader( text ) );
+ final ByLineReaderSource source = new ByLineReaderSource( new StringReader( text ) );
final ParagraphBlockParser parser = paraParser;
ParagraphBlock block;
- block = (ParagraphBlock) parser.visit( source
- .getNextLine(), source );
+ block = (ParagraphBlock) parser.visit( source.getNextLine(), source );
assertNotNull( block );
assertEquals( 1, block.getBlocks().length );
- assertEquals( "para1 -> text1 para1 -> text2", ( (TextBlock) block
- .getBlocks()[0] ).getText() );
+ assertEquals( "para1 -> text1 para1 -> text2", ( (TextBlock) block.getBlocks()[0] ).getText() );
- block = (ParagraphBlock) parser.visit( source
- .getNextLine(), source );
+ block = (ParagraphBlock) parser.visit( source.getNextLine(), source );
assertNotNull( block );
assertEquals( 1, block.getBlocks().length );
- assertEquals( "para2 -> text1 para2 -> text2", ( (TextBlock) block
- .getBlocks()[0] ).getText() );
+ assertEquals( "para2 -> text1 para2 -> text2", ( (TextBlock) block.getBlocks()[0] ).getText() );
}
/**
* @throws ParseException on error
*/
- public final void testParagraphWithList() throws ParseException
+ public final void testParagraphWithList()
+ throws ParseException
{
- final String text = ""
- + "Description text:\n"
- + " * item1\n"
- + " * item2\n"
- + "This is more text in the same paragraph\n"
- + "\n"
- + "Another paragraph";
+ final String text =
+ "" + "Description text:\n" + " * item1\n" + " * item2\n"
+ + "This is more text in the same paragraph\n" + "\n" + "Another paragraph";
- final ByLineReaderSource source = new ByLineReaderSource(
- new StringReader( text ) );
+ final ByLineReaderSource source = new ByLineReaderSource( new StringReader( text ) );
final ParagraphBlockParser parser = paraParser;
ParagraphBlock block;
- block = (ParagraphBlock) parser.visit( source
- .getNextLine(), source );
+ block = (ParagraphBlock) parser.visit( source.getNextLine(), source );
assertNotNull( block );
final Block[] firstLevelChilds = block.getBlocks();
final int numberOfChilds = 3;
assertEquals( numberOfChilds, firstLevelChilds.length );
assertEquals( TextBlock.class, firstLevelChilds[0].getClass() );
- assertEquals( UnorderedListBlock.class,
- firstLevelChilds[1].getClass() );
+ assertEquals( UnorderedListBlock.class, firstLevelChilds[1].getClass() );
assertEquals( TextBlock.class, firstLevelChilds[2].getClass() );
- final Block [] listChilds = ( (UnorderedListBlock) firstLevelChilds[1] )
- .getBlocks();
+ final Block[] listChilds = ( (UnorderedListBlock) firstLevelChilds[1] ).getBlocks();
assertEquals( 2, listChilds.length );
assertEquals( 1, ( (ListItemBlock) listChilds[0] ).getBlocks().length );
- assertEquals( "item1", ( (TextBlock) ( (ListItemBlock) listChilds[0] )
- .getBlocks()[0] ).getText() );
- assertEquals( "item2", ( (TextBlock) ( (ListItemBlock) listChilds[1] )
- .getBlocks()[0] ).getText() );
+ assertEquals( "item1", ( (TextBlock) ( (ListItemBlock) listChilds[0] ).getBlocks()[0] ).getText() );
+ assertEquals( "item2", ( (TextBlock) ( (ListItemBlock) listChilds[1] ).getBlocks()[0] ).getText() );
}
/**
@@ -117,45 +97,37 @@
*
* @throws ParseException on error
*/
- public final void testParagraphWithStartingList() throws ParseException
+ public final void testParagraphWithStartingList()
+ throws ParseException
{
- final String text = ""
- + " * item1\n"
- + " * item2\n"
- + "This is more text in the same paragraph\n"
- + "\n"
- + "Another paragraph";
+ final String text =
+ "" + " * item1\n" + " * item2\n" + "This is more text in the same paragraph\n" + "\n"
+ + "Another paragraph";
- final ByLineReaderSource source = new ByLineReaderSource(
- new StringReader( text ) );
+ final ByLineReaderSource source = new ByLineReaderSource( new StringReader( text ) );
final ParagraphBlockParser parser = paraParser;
ParagraphBlock block;
- block = (ParagraphBlock) parser.visit( source
- .getNextLine(), source );
+ block = (ParagraphBlock) parser.visit( source.getNextLine(), source );
assertNotNull( block );
final Block[] firstLevelChilds = block.getBlocks();
assertEquals( 2, firstLevelChilds.length );
- assertEquals( UnorderedListBlock.class,
- firstLevelChilds[0].getClass() );
+ assertEquals( UnorderedListBlock.class, firstLevelChilds[0].getClass() );
assertEquals( TextBlock.class, firstLevelChilds[1].getClass() );
- final Block [] listChilds = ( (UnorderedListBlock) firstLevelChilds[0] )
- .getBlocks();
+ final Block[] listChilds = ( (UnorderedListBlock) firstLevelChilds[0] ).getBlocks();
assertEquals( 2, listChilds.length );
assertEquals( 1, ( (ListItemBlock) listChilds[0] ).getBlocks().length );
- assertEquals( "item1", ( (TextBlock) ( (ListItemBlock) listChilds[0] )
- .getBlocks()[0] ).getText() );
- assertEquals( "item2", ( (TextBlock) ( (ListItemBlock) listChilds[1] )
- .getBlocks()[0] ).getText() );
+ assertEquals( "item1", ( (TextBlock) ( (ListItemBlock) listChilds[0] ).getBlocks()[0] ).getText() );
+ assertEquals( "item2", ( (TextBlock) ( (ListItemBlock) listChilds[1] ).getBlocks()[0] ).getText() );
}
-
/**
* @throws ParseException on error
*/
- public final void testHorizontalRule() throws ParseException
+ public final void testHorizontalRule()
+ throws ParseException
{
Block block, expected;
ByLineReaderSource source;
@@ -173,9 +145,7 @@
expected = new HorizontalRuleBlock();
block = hruleParser.visit( "--- Some text ---- And some more", source );
assertEquals( expected, block );
- expected = new ParagraphBlock( new Block[]{
- new TextBlock( "Some text ---- And some more" )
- } );
+ expected = new ParagraphBlock( new Block[] { new TextBlock( "Some text ---- And some more" ) } );
block = paraParser.visit( source.getNextLine(), source );
assertEquals( expected, block );
}
@@ -183,22 +153,17 @@
/**
* @throws ParseException on error
*/
- public final void testHorizontalRuleAndParagraph() throws ParseException
+ public final void testHorizontalRuleAndParagraph()
+ throws ParseException
{
Block[] blocks, expected;
ByLineReaderSource source;
- source = new ByLineReaderSource( new StringReader( ""
- + "Some text\n"
- + "-----------\n"
- + "More text"
- ) );
- expected = new Block[]{
- new ParagraphBlock( new Block[]{new TextBlock( "Some text" )} ),
- new HorizontalRuleBlock(),
- new ParagraphBlock( new Block[]{new TextBlock( "More text" )} ),
- };
- blocks = (Block[]) twikiParser.parse( source ).toArray( new Block[]{} );
+ source = new ByLineReaderSource( new StringReader( "" + "Some text\n" + "-----------\n" + "More text" ) );
+ expected =
+ new Block[] { new ParagraphBlock( new Block[] { new TextBlock( "Some text" ) } ),
+ new HorizontalRuleBlock(), new ParagraphBlock( new Block[] { new TextBlock( "More text" ) } ), };
+ blocks = (Block[]) twikiParser.parse( source ).toArray( new Block[] {} );
assertTrue( Arrays.equals( expected, blocks ) );
}
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/SectionTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/SectionTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/SectionTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/SectionTest.java Wed Oct 15 14:46:08 2008
@@ -25,14 +25,14 @@
import org.apache.maven.doxia.util.ByLineReaderSource;
import org.apache.maven.doxia.parser.ParseException;
-
/**
* Tests the {@link org.apache.maven.doxia.module.twiki.parser.SectionBlockParser}
*
* @author Juan F. Codagnone
* @since Nov 1, 2005
*/
-public class SectionTest extends AbstractBlockTestCase
+public class SectionTest
+ extends AbstractBlockTestCase
{
/**
@@ -41,12 +41,12 @@
public final void testSectionBlockWrongArgs()
{
final int maxLevel = 5;
- new SectionBlock( "hola", 1, new Block[]{} );
- new SectionBlock( "hola", maxLevel, new Block[]{} );
+ new SectionBlock( "hola", 1, new Block[] {} );
+ new SectionBlock( "hola", maxLevel, new Block[] {} );
try
{
- new SectionBlock( "hola", maxLevel + 1, new Block[]{} );
+ new SectionBlock( "hola", maxLevel + 1, new Block[] {} );
fail();
}
catch ( final Throwable e )
@@ -56,7 +56,7 @@
try
{
- new SectionBlock( "hola", 0, new Block[]{} );
+ new SectionBlock( "hola", 0, new Block[] {} );
fail();
}
catch ( final Throwable e )
@@ -74,7 +74,7 @@
// ok
}
- new SectionBlock( "", 1, new Block[]{} );
+ new SectionBlock( "", 1, new Block[] {} );
}
/**
@@ -98,7 +98,8 @@
* @throws java.lang.Exception
* @see SectionBlockParser
*/
- public final void testSectionParser() throws Exception
+ public final void testSectionParser()
+ throws Exception
{
final SectionBlockParser parser = sectionParser;
assertTrue( parser.accept( "---+ Title1" ) );
@@ -109,8 +110,7 @@
assertTrue( parser.accept( "---+++++ Title6" ) );
SectionBlock block;
- block = (SectionBlock) parser.visit( "---++++ Title4",
- new ByLineReaderSource( new StringReader( "" ) ) );
+ block = (SectionBlock) parser.visit( "---++++ Title4", new ByLineReaderSource( new StringReader( "" ) ) );
final int level = 4;
assertEquals( "Title4", block.getTitle() );
@@ -118,19 +118,17 @@
assertEquals( 0, block.getBlocks().length );
// ejemplo un poco m�s complejo
- block = (SectionBlock) parser.visit( "---+++ Title3",
- new ByLineReaderSource( new StringReader(
- "This is *a* parragraph of a section.\n"
- + "Some text.\n"
- + "---+++ Another Title"
- + "... and more text" ) ) );
- final SectionBlock expected = new SectionBlock( "Title3", 3, new Block[]{
- new ParagraphBlock( new Block[]{
- new TextBlock( "This is " ),
- new BoldBlock( new Block[]{new TextBlock( "a" )} ),
- new TextBlock( " parragraph of a section. Some text." ),
- } )
- } );
+ block =
+ (SectionBlock) parser.visit( "---+++ Title3",
+ new ByLineReaderSource( new StringReader(
+ "This is *a* parragraph of a section.\n"
+ + "Some text.\n"
+ + "---+++ Another Title"
+ + "... and more text" ) ) );
+ final SectionBlock expected =
+ new SectionBlock( "Title3", 3, new Block[] { new ParagraphBlock( new Block[] {
+ new TextBlock( "This is " ), new BoldBlock( new Block[] { new TextBlock( "a" ) } ),
+ new TextBlock( " parragraph of a section. Some text." ), } ) } );
assertEquals( expected, block );
}
@@ -139,55 +137,40 @@
*
* @throws Exception on error
*/
- public final void testSectionWithParagraphs() throws Exception
+ public final void testSectionWithParagraphs()
+ throws Exception
{
- final String text = ""
- + "---++ Title\n"
- + "\n"
- + "hey!\n"
- + "how are\n"
- + "you?\n"
- + " \n "
- + "Fine!! thanks";
+ final String text =
+ "" + "---++ Title\n" + "\n" + "hey!\n" + "how are\n" + "you?\n" + " \n " + "Fine!! thanks";
final SectionBlockParser parser = sectionParser;
parser.setVerbatimBlockParser( new VerbatimBlockParser() );
- final ByLineReaderSource source = new ByLineReaderSource(
- new StringReader( text ) );
- final SectionBlock block = (SectionBlock) parser.visit( source
- .getNextLine(), source );
+ final ByLineReaderSource source = new ByLineReaderSource( new StringReader( text ) );
+ final SectionBlock block = (SectionBlock) parser.visit( source.getNextLine(), source );
assertEquals( 2, block.getBlocks().length );
- assertEquals( "hey! how are you?", ( (TextBlock) ( (ParagraphBlock) block
- .getBlocks()[0] ).getBlocks()[0] ).getText() );
- assertEquals( "Fine!! thanks", ( (TextBlock) ( (ParagraphBlock) block
- .getBlocks()[1] ).getBlocks()[0] ).getText() );
+ assertEquals( "hey! how are you?",
+ ( (TextBlock) ( (ParagraphBlock) block.getBlocks()[0] ).getBlocks()[0] ).getText() );
+ assertEquals( "Fine!! thanks",
+ ( (TextBlock) ( (ParagraphBlock) block.getBlocks()[1] ).getBlocks()[0] ).getText() );
}
/**
* @throws ParseException on error
*/
- public final void testSectionAndParaAndHrule() throws ParseException
+ public final void testSectionAndParaAndHrule()
+ throws ParseException
{
Block[] blocks, expected;
ByLineReaderSource source;
- source = new ByLineReaderSource( new StringReader( ""
- + "---++ Title\n"
- + "Some text\n"
- + "----------- More text\n"
- ) );
- expected = new Block[]{
- new SectionBlock( "Title", 1, new Block[]{
- new ParagraphBlock( new Block[]{
- new TextBlock( "Some text" )
- } ),
- new HorizontalRuleBlock(),
- new ParagraphBlock( new Block[]{
- new TextBlock( "More text" )
- } ),
- } ),
- };
- blocks = (Block[]) twikiParser.parse( source ).toArray( new Block[]{} );
+ source =
+ new ByLineReaderSource( new StringReader( "" + "---++ Title\n" + "Some text\n"
+ + "----------- More text\n" ) );
+ expected =
+ new Block[] { new SectionBlock( "Title", 1, new Block[] {
+ new ParagraphBlock( new Block[] { new TextBlock( "Some text" ) } ), new HorizontalRuleBlock(),
+ new ParagraphBlock( new Block[] { new TextBlock( "More text" ) } ), } ), };
+ blocks = (Block[]) twikiParser.parse( source ).toArray( new Block[] {} );
assertTrue( Arrays.equals( expected, blocks ) );
}
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TableTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TableTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TableTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TableTest.java Wed Oct 15 14:46:08 2008
@@ -25,14 +25,14 @@
import org.apache.maven.doxia.util.ByLineSource;
import org.apache.maven.doxia.parser.ParseException;
-
/**
* Tests the {@link org.apache.maven.doxia.module.twiki.parser.TableBlockParser}
*
* @author Juan F. Codagnone
* @since Nov 9, 2005
*/
-public class TableTest extends AbstractBlockTestCase
+public class TableTest
+ extends AbstractBlockTestCase
{
/**
@@ -47,26 +47,20 @@
/**
* @throws ParseException on error
*/
- public final void testTable() throws ParseException
+ public final void testTable()
+ throws ParseException
{
- final StringReader sw = new StringReader( ""
- + " |cell1|cell2| \n"
- + "|cell3|cell4|\n"
- );
+ final StringReader sw = new StringReader( "" + " |cell1|cell2| \n" + "|cell3|cell4|\n" );
final ByLineSource source = new ByLineReaderSource( sw );
Block block, expected;
- expected = new TableBlock( new Block[]{
- new TableRowBlock( new Block[]{
- new TableCellBlock( new Block[]{new TextBlock( "cell1" )} ),
- new TableCellBlock( new Block[]{new TextBlock( "cell2" )} ),
- } ),
- new TableRowBlock( new Block[]{
- new TableCellBlock( new Block[]{new TextBlock( "cell3" )} ),
- new TableCellBlock( new Block[]{new TextBlock( "cell4" )} ),
- } ),
- } );
+ expected =
+ new TableBlock( new Block[] {
+ new TableRowBlock( new Block[] { new TableCellBlock( new Block[] { new TextBlock( "cell1" ) } ),
+ new TableCellBlock( new Block[] { new TextBlock( "cell2" ) } ), } ),
+ new TableRowBlock( new Block[] { new TableCellBlock( new Block[] { new TextBlock( "cell3" ) } ),
+ new TableCellBlock( new Block[] { new TextBlock( "cell4" ) } ), } ), } );
block = tableParser.visit( source.getNextLine(), source );
assertEquals( block, expected );
@@ -75,20 +69,18 @@
/**
* @throws ParseException on error
*/
- public final void testTableHeader() throws ParseException
+ public final void testTableHeader()
+ throws ParseException
{
- final StringReader sw = new StringReader( "|*cell1*|*cell2*|\n"
- );
+ final StringReader sw = new StringReader( "|*cell1*|*cell2*|\n" );
final ByLineSource source = new ByLineReaderSource( sw );
Block block, expected;
- expected = new TableBlock( new Block[]{
- new TableRowBlock( new Block[]{
- new TableCellHeaderBlock( new Block[]{new TextBlock( "cell1" )} ),
- new TableCellHeaderBlock( new Block[]{new TextBlock( "cell2" )} ),
- } ),
- } );
+ expected =
+ new TableBlock( new Block[] { new TableRowBlock( new Block[] {
+ new TableCellHeaderBlock( new Block[] { new TextBlock( "cell1" ) } ),
+ new TableCellHeaderBlock( new Block[] { new TextBlock( "cell2" ) } ), } ), } );
block = tableParser.visit( source.getNextLine(), source );
assertEquals( block, expected );
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TitleTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TitleTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TitleTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/TitleTest.java Wed Oct 15 14:46:08 2008
@@ -27,98 +27,104 @@
/**
* Tests for {@link TWikiParser#getTitle(java.util.List)}
- *
- *
+ *
+ *
* @author Juan F. Codagnone
* @since Nov 10, 2007
*/
-public class TitleTest extends AbstractBlockTestCase
+public class TitleTest
+ extends AbstractBlockTestCase
{
- public void testSectionTitle() throws Exception
+ public void testSectionTitle()
+ throws Exception
{
- final ByLineSource source = new ByLineReaderSource(
- new StringReader( "---++ Test\n hello world" ) );
-
+ final ByLineSource source = new ByLineReaderSource( new StringReader( "---++ Test\n hello world" ) );
+
final TWikiParser parser = new TWikiParser();
-
- assertEquals( "Test", parser.getTitle( parser.parse(source), source ) );
+
+ assertEquals( "Test", parser.getTitle( parser.parse( source ), source ) );
}
-
- public void testNoSectionTitle() throws Exception
+
+ public void testNoSectionTitle()
+ throws Exception
{
- final ByLineSource source = new NamedByLineSource(
- new ByLineReaderSource(
- new StringReader( "hello world" )), "testpage" );
-
+ final ByLineSource source =
+ new NamedByLineSource( new ByLineReaderSource( new StringReader( "hello world" ) ), "testpage" );
+
final TWikiParser parser = new TWikiParser();
-
- assertEquals( "testpage", parser.getTitle( parser.parse(source), source ) );
+
+ assertEquals( "testpage", parser.getTitle( parser.parse( source ), source ) );
}
-
- public void testNoSectionTwikiExtensionTitle() throws Exception
+
+ public void testNoSectionTwikiExtensionTitle()
+ throws Exception
{
- final ByLineSource source = new NamedByLineSource(
- new ByLineReaderSource(
- new StringReader( "hello world" )), "testpage.twiki" );
-
+ final ByLineSource source =
+ new NamedByLineSource( new ByLineReaderSource( new StringReader( "hello world" ) ), "testpage.twiki" );
+
final TWikiParser parser = new TWikiParser();
-
- assertEquals( "testpage", parser.getTitle( parser.parse(source), source ) );
+
+ assertEquals( "testpage", parser.getTitle( parser.parse( source ), source ) );
}
-
+
}
-class NamedByLineSource implements ByLineSource
+class NamedByLineSource
+ implements ByLineSource
{
/** reader */
private final ByLineReaderSource reader;
+
/** reader's name */
private final String name;
public NamedByLineSource( final ByLineReaderSource reader, final String name )
{
- if( reader == null || name == null ) {
- throw new IllegalArgumentException("null arguments are not allowed");
+ if ( reader == null || name == null )
+ {
+ throw new IllegalArgumentException( "null arguments are not allowed" );
}
-
+
this.reader = reader;
this.name = name;
}
/** @see ByLineReaderSource#close() */
- public final void close()
+ public final void close()
{
reader.close();
}
/** @see ByLineReaderSource#getLineNumber() */
- public final int getLineNumber()
+ public final int getLineNumber()
{
return reader.getLineNumber();
}
/** @see ByLineReaderSource#getName() */
- public final String getName()
+ public final String getName()
{
return name;
}
/** @see ByLineReaderSource#getNextLine() */
- public final String getNextLine() throws ParseException
+ public final String getNextLine()
+ throws ParseException
{
return reader.getNextLine();
}
-
/** @see ByLineReaderSource#unget(java.lang.String) */
- public final void unget( final String s ) throws IllegalStateException
+ public final void unget( final String s )
+ throws IllegalStateException
{
- reader.unget(s);
+ reader.unget( s );
}
/** @see ByLineReaderSource#ungetLine() */
- public final void ungetLine() throws IllegalStateException
+ public final void ungetLine()
+ throws IllegalStateException
{
reader.ungetLine();
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/VerbatimTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/VerbatimTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/VerbatimTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/VerbatimTest.java Wed Oct 15 14:46:08 2008
@@ -27,15 +27,14 @@
* under the License.
*/
-
-
/**
* Tests the {@link org.apache.maven.doxia.module.twiki.parser.VerbatimBlock}
*
* @author Christian Nardi
* @since Nov 8, 2007
*/
-public class VerbatimTest extends AbstractBlockTestCase
+public class VerbatimTest
+ extends AbstractBlockTestCase
{
/**
@@ -48,89 +47,69 @@
assertTrue( getVerbatimParser().accept( "<verbatim> a word" ) );
assertTrue( getVerbatimParser().accept( "<verbatim> another Word" ) );
}
-
-
+
/**
* @throws ParseException if the parser does not accept the line
- *
+ *
*/
- public void testVerbatim() throws ParseException
+ public void testVerbatim()
+ throws ParseException
{
- final StringReader sw = new StringReader( ""
- + " <verbatim> hello, \n"
- + " this is a verbatim text \n"
- + " which i would like to test \n"
- + " Thanks </verbatim>"
- );
-
- final ByLineSource source = new ByLineReaderSource( sw );
-
- Block block, expected;
- expected = new VerbatimBlock( new Block[]{
- new TextBlock( " hello, \n" ) ,
- new TextBlock( " this is a verbatim text \n" ) ,
- new TextBlock( " which i would like to test \n" ) ,
- new TextBlock( " Thanks \n" ) ,
- } );
+ final StringReader sw =
+ new StringReader( "" + " <verbatim> hello, \n" + " this is a verbatim text \n"
+ + " which i would like to test \n" + " Thanks </verbatim>" );
+
+ final ByLineSource source = new ByLineReaderSource( sw );
- block = getVerbatimParser().visit( source.getNextLine(), source );
- assertEquals( block, expected );
+ Block block, expected;
+ expected =
+ new VerbatimBlock( new Block[] { new TextBlock( " hello, \n" ),
+ new TextBlock( " this is a verbatim text \n" ), new TextBlock( " which i would like to test \n" ),
+ new TextBlock( " Thanks \n" ), } );
+
+ block = getVerbatimParser().visit( source.getNextLine(), source );
+ assertEquals( block, expected );
}
-
+
/**
* @throws Exception .
*/
- public void testTwiki() throws Exception
+ public void testTwiki()
+ throws Exception
{
- final StringReader sw = new StringReader( "hello this is a paragraph \n"
- + " <verbatim> hello, \n"
- + " this is a verbatim text \n"
- + " which i would like to test \n"
- + " Thanks </verbatim>"
- );
+ final StringReader sw =
+ new StringReader( "hello this is a paragraph \n" + " <verbatim> hello, \n"
+ + " this is a verbatim text \n" + " which i would like to test \n" + " Thanks </verbatim>" );
final ByLineSource source = new ByLineReaderSource( sw );
Block[] expected;
- expected = new Block[]{
- new ParagraphBlock( new Block[] {
- new TextBlock( "hello this is a paragraph" ),
- } ),
- new VerbatimBlock( new Block[]{
- new TextBlock( " hello, \n" ) ,
- new TextBlock( " this is a verbatim text \n" ) ,
- new TextBlock( " which i would like to test \n" ) ,
- new TextBlock( " Thanks \n" ) ,
- } )
- };
+ expected =
+ new Block[] {
+ new ParagraphBlock( new Block[] { new TextBlock( "hello this is a paragraph" ), } ),
+ new VerbatimBlock( new Block[] { new TextBlock( " hello, \n" ),
+ new TextBlock( " this is a verbatim text \n" ),
+ new TextBlock( " which i would like to test \n" ), new TextBlock( " Thanks \n" ), } ) };
List block = twikiParser.parse( source );
- assertTrue( Arrays.equals(
- block.toArray(), expected ) );
+ assertTrue( Arrays.equals( block.toArray(), expected ) );
-
}
-
+
/** test
* @throws org.apache.maven.doxia.parser.ParseException
*/
- public void testVerbatimAfterSection() throws ParseException
+ public void testVerbatimAfterSection()
+ throws ParseException
{
- final StringReader sw = new StringReader( "---++ fooo\n"
- + " <verbatim> hello, \n"
- + " Thanks </verbatim>"
- );
+ final StringReader sw =
+ new StringReader( "---++ fooo\n" + " <verbatim> hello, \n" + " Thanks </verbatim>" );
final ByLineSource source = new ByLineReaderSource( sw );
Block[] expected;
- expected = new Block[]{
- new SectionBlock( "foo", 2, new Block[] {
- new VerbatimBlock( new Block[]{
- new TextBlock( " hello, \n" ) ,
- new TextBlock( " Thanks \n" ) ,
- } )
- } ),
- };
-
+ expected =
+ new Block[] { new SectionBlock( "foo", 2, new Block[] { new VerbatimBlock( new Block[] {
+ new TextBlock( " hello, \n" ), new TextBlock( " Thanks \n" ), } ) } ), };
+
List block = twikiParser.parse( source );
assertTrue( Arrays.equals( block.toArray(), expected ) );
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/WordsTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/WordsTest.java?rev=705065&r1=705064&r2=705065&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/WordsTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-twiki/src/test/java/org/apache/maven/doxia/module/twiki/parser/WordsTest.java Wed Oct 15 14:46:08 2008
@@ -21,34 +21,33 @@
import java.util.Arrays;
-
/**
* tests the WikiWord parsing (and things like that)
*
* @author Juan F. Codagnone
* @since Nov 4, 2005
*/
-public class WordsTest extends AbstractBlockTestCase
+public class WordsTest
+ extends AbstractBlockTestCase
{
/**
* used to convert lists to arrays
*/
- private static final Block [] TOARRAY = new Block[]{};
-
+ private static final Block[] TOARRAY = new Block[] {};
+
/**
* Resolves links for wikiWords
*/
- private final WikiWordLinkResolver resolver =
- new XHTMLWikiWordLinkResolver();
+ private final WikiWordLinkResolver resolver = new XHTMLWikiWordLinkResolver();
/**
* ...
*/
public final void testText()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{new TextBlock( " Some text " )};
+ expected = new Block[] { new TextBlock( " Some text " ) };
blocks = (Block[]) textParser.parse( " Some text " ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -58,28 +57,26 @@
*/
public final void testWikiWords()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{new WikiWordBlock( "WikiWord", resolver )};
+ expected = new Block[] { new WikiWordBlock( "WikiWord", resolver ) };
blocks = (Block[]) textParser.parse( "WikiWord" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
// this is not a wiki word
- expected = new Block[]{new TextBlock( "Wiki" )};
+ expected = new Block[] { new TextBlock( "Wiki" ) };
blocks = (Block[]) textParser.parse( "Wiki" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{new TextBlock( "Web." )};
+ expected = new Block[] { new TextBlock( "Web." ) };
blocks = (Block[]) textParser.parse( "Web." ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{new TextBlock( "fooWikiBar" )};
+ expected = new Block[] { new TextBlock( "fooWikiBar" ) };
blocks = (Block[]) textParser.parse( "fooWikiBar" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{
- new WikiWordBlock( "WikiWord", resolver ), new TextBlock( "...." )
- };
+ expected = new Block[] { new WikiWordBlock( "WikiWord", resolver ), new TextBlock( "...." ) };
blocks = (Block[]) textParser.parse( "WikiWord...." ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -89,13 +86,13 @@
*/
public final void testWebWikiWords()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{new WikiWordBlock( "Web.WikiWord", resolver )};
+ expected = new Block[] { new WikiWordBlock( "Web.WikiWord", resolver ) };
blocks = (Block[]) textParser.parse( "Web.WikiWord" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{new WikiWordBlock( "My1Web.WikiWord", resolver )};
+ expected = new Block[] { new WikiWordBlock( "My1Web.WikiWord", resolver ) };
blocks = (Block[]) textParser.parse( "My1Web.WikiWord" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -105,13 +102,13 @@
*/
public final void testWebAnchorWikiWords()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{new WikiWordBlock( "WikiWord#anchor", resolver )};
+ expected = new Block[] { new WikiWordBlock( "WikiWord#anchor", resolver ) };
blocks = (Block[]) textParser.parse( "WikiWord#anchor" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{new WikiWordBlock( "MyWeb.WikiWord#anchor", resolver )};
+ expected = new Block[] { new WikiWordBlock( "MyWeb.WikiWord#anchor", resolver ) };
blocks = (Block[]) textParser.parse( "MyWeb.WikiWord#anchor" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
@@ -122,73 +119,60 @@
*/
public final void testURLSpecificLinks()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
+
+ expected = new Block[] { new LinkBlock( "http://reference.com", new TextBlock( "text" ) ) };
+ blocks = (Block[]) textParser.parse( "[[http://reference.com][text]]" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
+
+ expected =
+ new Block[] { new TextBlock( "foo" ),
+ new LinkBlock( "http://reference.com", new TextBlock( "text" ) ), new TextBlock( "bar" ), };
+ blocks = (Block[]) textParser.parse( "foo[[http://reference.com][text]]bar" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{new LinkBlock( "http://reference.com", new TextBlock( "text" ) )};
- blocks = (Block[]) textParser.parse( "[[http://reference.com][text]]" ).
- toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new TextBlock( "foo" ),
- new LinkBlock( "http://reference.com", new TextBlock( "text" ) ),
- new TextBlock( "bar" ),
- };
- blocks = (Block[]) textParser.parse( "foo[[http://reference.com][text]]bar" ).
- toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new TextBlock( " foo " ),
- new LinkBlock( "http://reference.com", new TextBlock( "text" ) ),
- new TextBlock( " bar " ),
- };
- blocks = (Block[]) textParser.
- parse( " foo [[http://reference.com][text]] bar " ).toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new LinkBlock( "http://www.apache.org/licenses/LICENSE-2.0",
- new TextBlock( "Apache License, version 2.0" ) ),
+ expected =
+ new Block[] { new TextBlock( " foo " ),
+ new LinkBlock( "http://reference.com", new TextBlock( "text" ) ), new TextBlock( " bar " ), };
+ blocks = (Block[]) textParser.parse( " foo [[http://reference.com][text]] bar " ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
+
+ expected =
+ new Block[] {
+ new LinkBlock( "http://www.apache.org/licenses/LICENSE-2.0",
+ new TextBlock( "Apache License, version 2.0" ) ),
new TextBlock( ". You can download it " ),
- new WikiWordBlock( "DoxiaDownload", new TextBlock( "here" ), resolver ),
- };
- blocks = (Block[]) textParser.
- parse( "[[http://www.apache.org/licenses/LICENSE-2.0]"
- + "[Apache License, version 2.0]]. You can download it "
- + "[[DoxiaDownload][here]]" ).toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
+ new WikiWordBlock( "DoxiaDownload", new TextBlock( "here" ), resolver ), };
+ blocks =
+ (Block[]) textParser.parse(
+ "[[http://www.apache.org/licenses/LICENSE-2.0]"
+ + "[Apache License, version 2.0]]. You can download it "
+ + "[[DoxiaDownload][here]]" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
+
}
-
+
/**
* test Specific Links with wikiWords
*/
public final void testWikiSpecificLinks()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
+
+ expected = new Block[] { new WikiWordBlock( "Reference", new TextBlock( "text" ), resolver ) };
+ blocks = (Block[]) textParser.parse( "[[reference][text]]" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
+
+ expected =
+ new Block[] { new TextBlock( "foo" ),
+ new WikiWordBlock( "ReferenceLink", new TextBlock( "text" ), resolver ), new TextBlock( "bar" ), };
+ blocks = (Block[]) textParser.parse( "foo[[referenceLink][text]]bar" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{new WikiWordBlock( "Reference", new TextBlock( "text" ), resolver )};
- blocks = (Block[]) textParser.parse( "[[reference][text]]" ).
- toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new TextBlock( "foo" ),
- new WikiWordBlock( "ReferenceLink", new TextBlock( "text" ), resolver ),
- new TextBlock( "bar" ),
- };
- blocks = (Block[]) textParser.parse( "foo[[referenceLink][text]]bar" ).
- toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new TextBlock( " foo " ),
- new WikiWordBlock( "ReferenceLink", new TextBlock( "text" ), resolver ),
- new TextBlock( " bar " ),
- };
- blocks = (Block[]) textParser.
- parse( " foo [[reference link][text]] bar " ).toArray( TOARRAY );
+ expected =
+ new Block[] { new TextBlock( " foo " ),
+ new WikiWordBlock( "ReferenceLink", new TextBlock( "text" ), resolver ), new TextBlock( " bar " ), };
+ blocks = (Block[]) textParser.parse( " foo [[reference link][text]] bar " ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -197,9 +181,9 @@
*/
public final void testSpecificLinkPrevention()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{new TextBlock( "[[reference][text]]" )};
+ expected = new Block[] { new TextBlock( "[[reference][text]]" ) };
blocks = (Block[]) textParser.parse( "![[reference][text]]" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -209,17 +193,13 @@
*/
public final void testPreventLinkingWikiWord()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new TextBlock( " " ),
- new TextBlock( "WikiWord" ),
- new TextBlock( " " ),
- };
+ expected = new Block[] { new TextBlock( " " ), new TextBlock( "WikiWord" ), new TextBlock( " " ), };
blocks = (Block[]) textParser.parse( " !WikiWord " ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{new TextBlock( " !!WikiWord " )};
+ expected = new Block[] { new TextBlock( " !!WikiWord " ) };
blocks = (Block[]) textParser.parse( " !!WikiWord " ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -229,35 +209,28 @@
*/
public final void testForcedLinks()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new WikiWordBlock( "WikiSyntax", new TextBlock( "wiki syntax" ), resolver ),
- };
+ expected = new Block[] { new WikiWordBlock( "WikiSyntax", new TextBlock( "wiki syntax" ), resolver ), };
blocks = (Block[]) textParser.parse( "[[wiki syntax]]" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{
- new TextBlock( "[[wiki syntax]]" ),
- };
+ expected = new Block[] { new TextBlock( "[[wiki syntax]]" ), };
blocks = (Block[]) textParser.parse( "![[wiki syntax]]" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
- expected = new Block[]{
- new TextBlock( "foo" ),
- new WikiWordBlock( "WikiSyntax", new TextBlock( "wiki syntax" ), resolver ),
- new TextBlock( "bar" ),
- };
+ expected =
+ new Block[] { new TextBlock( "foo" ),
+ new WikiWordBlock( "WikiSyntax", new TextBlock( "wiki syntax" ), resolver ),
+ new TextBlock( "bar" ), };
blocks = (Block[]) textParser.parse( "foo[[wiki syntax]]bar" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new TextBlock( "foo" ),
- new LinkBlock( "http://twiki.com", new TextBlock( "http://twiki.com" ) ),
- new TextBlock( "bar" ),
- };
- blocks = (Block[]) textParser.parse( "foo[[http://twiki.com]]bar" ).toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
+
+ expected =
+ new Block[] { new TextBlock( "foo" ),
+ new LinkBlock( "http://twiki.com", new TextBlock( "http://twiki.com" ) ), new TextBlock( "bar" ), };
+ blocks = (Block[]) textParser.parse( "foo[[http://twiki.com]]bar" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
}
/**
@@ -265,11 +238,9 @@
*/
public final void testMailtoForcedLinks()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new LinkBlock( "mailto:a@z.com", new TextBlock( "Mail" ) ),
- };
+ expected = new Block[] { new LinkBlock( "mailto:a@z.com", new TextBlock( "Mail" ) ), };
blocks = (Block[]) textParser.parse( "[[mailto:a@z.com Mail]]" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -279,29 +250,20 @@
*/
public final void testAnchors()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new TextBlock( "mary has #anchor a little lamb" ),
- };
- blocks = (Block[]) textParser.parse( "mary has #anchor a little lamb" ).toArray(
- TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new TextBlock( "mary has " ),
- new AnchorBlock( "AnchorName" ),
- new TextBlock( " a little lamb" ),
- };
- blocks = (Block[]) textParser.parse( "mary has #AnchorName a little lamb" )
- .toArray( TOARRAY );
- assertTrue( Arrays.equals( expected, blocks ) );
-
- expected = new Block[]{
- new TextBlock( "mary has #AnchorName1233 a little lamb" ),
- };
- blocks = (Block[]) textParser.parse( "mary has #AnchorName1233 a little lamb" )
- .toArray( TOARRAY );
+ expected = new Block[] { new TextBlock( "mary has #anchor a little lamb" ), };
+ blocks = (Block[]) textParser.parse( "mary has #anchor a little lamb" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
+
+ expected =
+ new Block[] { new TextBlock( "mary has " ), new AnchorBlock( "AnchorName" ),
+ new TextBlock( " a little lamb" ), };
+ blocks = (Block[]) textParser.parse( "mary has #AnchorName a little lamb" ).toArray( TOARRAY );
+ assertTrue( Arrays.equals( expected, blocks ) );
+
+ expected = new Block[] { new TextBlock( "mary has #AnchorName1233 a little lamb" ), };
+ blocks = (Block[]) textParser.parse( "mary has #AnchorName1233 a little lamb" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -310,47 +272,38 @@
*/
public final void testAutomaticLink()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new TextBlock( "Go to " ),
- new LinkBlock( "http://twiki.com", new TextBlock( "http://twiki.com" ) ),
- new TextBlock( " and ..." ),
- };
- blocks = (Block[]) textParser.parse( "Go to http://twiki.com and ..." ).toArray(
- TOARRAY );
+ expected =
+ new Block[] { new TextBlock( "Go to " ),
+ new LinkBlock( "http://twiki.com", new TextBlock( "http://twiki.com" ) ),
+ new TextBlock( " and ..." ), };
+ blocks = (Block[]) textParser.parse( "Go to http://twiki.com and ..." ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
-
+
/** unit test */
public final void testAutomaticImage()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new LinkBlock( "http://twiki.org",
- new ImageBlock( "http://twiki.org/logo.png" )),
- };
- blocks = (Block[]) textParser.parse(
- "[[http://twiki.org][http://twiki.org/logo.png]]").toArray( TOARRAY );
+ expected =
+ new Block[] { new LinkBlock( "http://twiki.org", new ImageBlock( "http://twiki.org/logo.png" ) ), };
+ blocks = (Block[]) textParser.parse( "[[http://twiki.org][http://twiki.org/logo.png]]" ).toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
-
-
/** unit test */
public final void testLinkImage()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new TextBlock( "Go to " ),
- new ImageBlock( "http://twiki.com/image.png" ),
- new TextBlock( " thisisnotanimage.png and ..." ),
- };
- blocks = (Block[]) textParser.parse( "Go to http://twiki.com/image.png "
- + "thisisnotanimage.png and ..." ).toArray(
- TOARRAY );
+ expected =
+ new Block[] { new TextBlock( "Go to " ), new ImageBlock( "http://twiki.com/image.png" ),
+ new TextBlock( " thisisnotanimage.png and ..." ), };
+ blocks =
+ (Block[]) textParser.parse( "Go to http://twiki.com/image.png " + "thisisnotanimage.png and ..." )
+ .toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
@@ -359,15 +312,16 @@
*/
public final void testRelativeImage()
{
- Block [] blocks, expected;
+ Block[] blocks, expected;
- expected = new Block[]{
- new TextBlock( "My summer house: " ),
- new ImageBlock( "images/summerhouse.png" ),
- new TextBlock( " isn't it great?!" ),
- };
- blocks = (Block[]) textParser.parse(
- "My summer house: <img class=\"some_class\" src=\"images/summerhouse.png\"/> isn't it great?!").toArray( TOARRAY );
+ expected =
+ new Block[] { new TextBlock( "My summer house: " ), new ImageBlock( "images/summerhouse.png" ),
+ new TextBlock( " isn't it great?!" ), };
+ blocks =
+ (Block[]) textParser
+ .parse(
+ "My summer house: <img class=\"some_class\" src=\"images/summerhouse.png\"/> isn't it great?!" )
+ .toArray( TOARRAY );
assertTrue( Arrays.equals( expected, blocks ) );
}
}