--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/junit.jar"/>
+ <classpathentry kind="src" path="/org.plog4u.wiki"/>
+ <classpathentry kind="lib" path="/net.sourceforge.phpeclipse.wiki/lib/radeox.jar"/>
+ <classpathentry kind="lib" path="/net.sourceforge.phpeclipse.wiki/lib/commons-logging.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.plog4u.wiki.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+package org.plog4u.wiki.test.filter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.plog4u.wiki.filter.WikipediaFilter;
+
+public class BoldFilterTest extends FilterTestSupport {
+ public BoldFilterTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ filter = new WikipediaFilter();
+ super.setUp();
+ }
+
+ public static Test suite() {
+ return new TestSuite(BoldFilterTest.class);
+ }
+
+ public void testBold() {
+ assertEquals("<strong>Text</strong>", filter.filter("'''Text'''", context));
+ }
+
+ public void testBold2() {
+ // close tags if user forget it:
+ assertEquals("<strong>Text<em></em></strong>", filter.filter("'''Text''", context));
+ }
+
+ public void testBoldItalicStack() {
+ // close tags if user forget it:
+ assertEquals("<b>Text<i>hallo</i></b>", filter.filter("<b>Text<i>hallo", context));
+ }
+
+ public void testBoldWithPunctuation() {
+ assertEquals("<strong>Text</strong>:", filter.filter("'''Text''':", context));
+ }
+}
\ No newline at end of file
--- /dev/null
+package org.plog4u.wiki.test.filter;
+
+import junit.framework.TestCase;
+import org.radeox.engine.context.BaseInitialRenderContext;
+import org.radeox.engine.context.BaseRenderContext;
+import org.radeox.filter.Filter;
+import org.radeox.filter.context.BaseFilterContext;
+import org.radeox.filter.context.FilterContext;
+
+/**
+ * Support class for defning JUnit FilterTests.
+ *
+ */
+
+public class FilterTestSupport extends TestCase {
+ protected Filter filter;
+ protected FilterContext context;
+
+ public FilterTestSupport(String s) {
+ super(s);
+ context = new BaseFilterContext();
+ context.setRenderContext(new BaseRenderContext());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (null != filter) {
+ filter.setInitialContext(new BaseInitialRenderContext());
+ }
+ }
+}
--- /dev/null
+package org.plog4u.wiki.test.filter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.plog4u.wiki.filter.WikipediaFilter;
+
+public class HRBRTest extends FilterTestSupport {
+ public HRBRTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ filter = new WikipediaFilter();
+ super.setUp();
+ }
+
+ public static Test suite() {
+ return new TestSuite(HRBRTest.class);
+ }
+
+ public void testNewline0() {
+ assertEquals("<br ===", filter.filter("<br ===", context));
+ }
+
+ public void testNewline1() {
+ assertEquals("<br />", filter.filter("<br>", context));
+ }
+ public void testNewline2() {
+ assertEquals("<br />", filter.filter("<br/>", context));
+ }
+ public void testNewline3() {
+ assertEquals("< br >", filter.filter("< br >", context));
+ }
+ public void testNewline4() {
+ assertEquals("< br / >", filter.filter("< br / >", context));
+ }
+
+
+}
\ No newline at end of file
--- /dev/null
+package org.plog4u.wiki.test.filter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.plog4u.wiki.filter.WikipediaFilter;
+
+public class HeaderFilterTest extends FilterTestSupport {
+ public HeaderFilterTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ filter = new WikipediaFilter();
+ super.setUp();
+ }
+
+ public static Test suite() {
+ return new TestSuite(HeaderFilterTest.class);
+ }
+
+ public void testH2() {
+ assertEquals("<h2><a name=\"aText\">Text</a></h2>", filter.filter("==Text==", context));
+ }
+
+ public void testH2WithPunctuation() {
+ assertEquals("<h2><a name=\"aText\">Text</a></h2>:", filter.filter("==Text==:", context));
+ }
+}
--- /dev/null
+package org.plog4u.wiki.test.filter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.plog4u.wiki.filter.WikipediaFilter;
+
+public class ItalicFilterTest extends FilterTestSupport {
+ public ItalicFilterTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ filter = new WikipediaFilter();
+ super.setUp();
+ }
+
+ public static Test suite() {
+ return new TestSuite(ItalicFilterTest.class);
+ }
+
+ public void testItalic() {
+ assertEquals("<em>Text</em>", filter.filter("''Text''", context));
+ }
+
+ public void testItalicWithPunctuation() {
+ assertEquals("<em>Text</em>:", filter.filter("''Text'':", context));
+ }
+}