01: /**
02: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
03: *
04: * This program is free software; you can redistribute it and/or modify
05: * it under the terms of the latest version of the GNU Lesser General
06: * Public License as published by the Free Software Foundation;
07: *
08: * This program is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: * GNU Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public License
14: * along with this program (LICENSE.txt); if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16: *
17: * Based on code generated by Agitar build: Agitator Version 1.0.2.000071 (Build date: Jan 12, 2007) [1.0.2.000071]
18: */package org.jamwiki.utils;
19:
20: import junit.framework.TestCase;
21:
22: public class TiddlyWiki2MediaWikiTranslatorTest extends TestCase {
23:
24: /*
25: // FIXME - failing, re-enabled later
26: public void testHeader() throws Exception {
27: TiddlyWiki2MediaWikiTranslator t = new TiddlyWiki2MediaWikiTranslator();
28: assertEquals("=test=", t.translate("!test"));
29: assertEquals("==test==", t.translate("!!test"));
30: assertEquals("===test===", t.translate("!!!test"));
31: assertEquals("=test=\n=test2=", t.translate("!test\n!test2"));
32: }
33: */
34: /*
35: // FIXME - failing, re-enabled later
36: public void testTables() throws Exception {
37: TiddlyWiki2MediaWikiTranslator t = new TiddlyWiki2MediaWikiTranslator();
38: assertEquals("{|\n|a||b\n|}", t.translate("|a|b|"));
39: assertEquals("notab\n{|\n|a||b||c\n|}\nnotab", t.translate("notab\n|a|b|c|\nnotab"));
40: //two rows
41: assertEquals("{|\n|a||b\n|-\n|d||e\n|}", t.translate("|a|b|\n|d|e|"));
42: }
43: */
44:
45: /*
46: // FIXME - failing, re-enabled later
47: public void testNewLine() throws Exception {
48: TiddlyWiki2MediaWikiTranslator t = new TiddlyWiki2MediaWikiTranslator();
49: //if first character is letter -> <br/> included
50: assertEquals("*first\n*second\n*third", t.translate("*first\\n*second\\n*third"));
51: }
52: */
53:
54: public void testWikiLinks() throws Exception {
55: TiddlyWiki2MediaWikiTranslator t = new TiddlyWiki2MediaWikiTranslator();
56: assertEquals("abc [[WikiLink]] def", t
57: .translate("abc WikiLink def"));
58: }
59:
60: public void testInsertBreaks() throws Exception {
61: TiddlyWiki2MediaWikiTranslator t = new TiddlyWiki2MediaWikiTranslator();
62: //assertEquals("abc<br/>\ndef<br/>\nghi", t.translate("abc\ndef\nghi"));
63: }
64: }
|