|
Friki example source code file (ClassicFilterTest.java)
The Friki ClassicFilterTest.java source codepackage tests; import java.util.*; import org.stringtree.factory.memory.MapStringRepository; import org.stringtree.util.ResourceUtils; import com.efsol.friki.*; public class ClassicFilterTest extends FilterTest { MapStringRepository context; Map remoteNames; public ClassicFilterTest(String name) { super(name); } public void setUp() { super.setUp(); context = new MapStringRepository(); remoteNames = new HashMap(); remoteNames.put("ALife", "http://news.alife.org/wiki/index.php?"); remoteNames.put("Wiki", "http://c2.com/cgi/wiki?"); setFilter(new ClassicToHTMLFilter(context, rep, remoteNames, ResourceUtils.readResource("wiki.transform"))); } public void testPlainText() { check("ClassicFilterTest.plain text 1", "hello, there", "hello, there"); check("ClassicFilterTest.plain text 2", "then run c:\\bin\\rsync.exe", "then run c:\\bin\\rsync.exe"); } public void testItalics() { check("ClassicFilterTest.italic 1", "uh<i>hello there", "uh''hello'' there"); } public void testBold() { check("ClassicFilterTest.bold 1", "uh<b>hello there", "uh'''hello''' there"); } public void testBoldItalic() { check("ClassicFilterTest.bolditalic 1", "uh<i>hello there", "uh'''''hello''''' there"); check("ClassicFilterTest.bolditalic 2", "uh<i>humhello there", "uh''hum'''hello''''' there"); } public void testRuler() { check("ClassicFilterTest.ruler 1", "\n<hr/>", "----"); check("ClassicFilterTest.ruler 2", "\n<hr/>", "-----"); check("ClassicFilterTest.ruler 3", "\n<hr/>", "------"); check("ClassicFilterTest.ruler 4", "---", "---"); } public void testExternalLinks() { check("ClassicFilterTest.ext 1", "<a href='http://www.efsol.com/'>http://www.efsol.com/", "http://www.efsol.com/"); check("ClassicFilterTest.ext 2", "<a href='http://www.efsol.com/friki?JustLink'>http://www.efsol.com/friki?JustLink", "http://www.efsol.com/friki?JustLink"); check("ClassicFilterTest.ext 3", "<a href='mailto:test@efsol.com'>mailto:test@efsol.com", "mailto:test@efsol.com"); check("ClassicFilterTest.ext 4", "<a href='mailto:test@efsol.gif'>mailto:test@efsol.gif", "mailto:test@efsol.gif"); check("ClassicFilterTest.ext 5", "<a href='mailto:test@172.16.1.254'>mailto:test@172.16.1.254", "mailto:test@172.16.1.254"); check("ClassicFilterTest.ext 6", "<a href='http://www.efsol.com/friki?JustLink&x=2'>http://www.efsol.com/friki?JustLink&x=2.", "http://www.efsol.com/friki?JustLink&x=2."); check("ClassicFilterTest.ext 7", "<b>http://www.efsol.com/friki?JustLink&x=2", "'''http://www.efsol.com/friki?JustLink&x=2'''"); check("ClassicFilterTest.ext 8", "<a href='http://www.efsol.com/FrankCarver.html'>http://www.efsol.com/FrankCarver.html", "http://www.efsol.com/FrankCarver.html"); } public void testInlinedLinks() { check("ClassicFilterTest.inlined 1", "<img src='http://www.efsol.com/images/efsol-logo.gif'/>", "http://www.efsol.com/images/efsol-logo.gif"); check("ClassicFilterTest.inlined 2", "<img src='ftp://www.efsol.com/images/efsol-logo.jpg'/>", "ftp://www.efsol.com/images/efsol-logo.jpg"); check("ClassicFilterTest.inlined 3", "<img src='http://www.efsol.com/images/efsol-logo.gif?ugh=x'/>", "http://www.efsol.com/images/efsol-logo.gif?ugh=x"); } public void testUnorderedList() { check("ClassicFilterTest.unordered 1", "\n<ul>\n
abc\ndef", "\t* first\n\t*second\n abc\n def"); check("ClassicFilterTest.unordered 6", "\n\t*\n<ul>\n
| |
hello |
hello | world |
there | their |
first\nsecond \nthird", "aa\n[\r\nfirst\r\nsecond \r\nthird\r\n]\r\nbb\r\n[\r\nfirst\r\nsecond \r\nthird\r\n]"); check("ClassicFilterTest.block spacey 1", "aa\n<pre>\nfirst", "aa\n[\n\nfirst\n]"); check("ClassicFilterTest.block spacey 2", "aa\n<pre>first\n", "aa\n[\nfirst\n\n]"); check("ClassicFilterTest.block spacey 3", "aa\n<pre>\nfirst\n", "aa\n[\n\nfirst\n\n]"); check("ClassicFilterTest.block spacey 4", "aa\n<pre>\nfirst\n\nsecond", "aa\n[\n\nfirst\n\nsecond\n]"); } public void testBlockTable() { check("ClassicFilterTest.blocktable 1", "<table BORDER CELLSPACING='0' CELLPADDING='3'>\n
first\nsecond \nthird\n", "|[\nfirst\nsecond \nthird\n]|"); check("ClassicFilterTest.blocktable 2", "<table BORDER CELLSPACING='0' CELLPADDING='3'>\n
first\nsecond \nthird\n", "||[\nfirst\nsecond \nthird\n]|"); } public void testDollarProtection() { check("ClassicFilterTest.dollar 1", "<table BORDER CELLSPACING='0' CELLPADDING='3'>\n$\n", "|$|"); } }
Here is a short list of links related to this Friki ClassicFilterTest.java source code file:
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.