001: /**
002: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
003: *
004: * This program is free software; you can redistribute it and/or modify
005: * it under the terms of the latest version of the GNU Lesser General
006: * Public License as published by the Free Software Foundation;
007: *
008: * This program is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: * GNU Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public License
014: * along with this program (LICENSE.txt); if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
016: *
017: * Based on code generated by Agitar build: Agitator Version 1.0.2.000071 (Build date: Jan 12, 2007) [1.0.2.000071]
018: */package org.jamwiki;
019:
020: import junit.framework.TestCase;
021:
022: public class WikiMessageTest extends TestCase {
023:
024: /**
025: *
026: */
027: public void testConstructor() throws Throwable {
028: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey");
029: assertEquals("wikiMessage.getKey()", "testWikiMessageKey",
030: wikiMessage.getKey());
031: assertNull("wikiMessage.getParams()", wikiMessage.getParams());
032: }
033:
034: /**
035: *
036: */
037: public void testConstructor1() throws Throwable {
038: String[] strings = new String[1];
039: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey",
040: strings);
041: assertEquals("wikiMessage.getKey()", "testWikiMessageKey",
042: wikiMessage.getKey());
043: assertEquals("wikiMessage.getParams().length", 1, wikiMessage
044: .getParams().length);
045: }
046:
047: /**
048: *
049: */
050: public void testConstructor2() throws Throwable {
051: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey",
052: (String[]) null);
053: assertEquals("wikiMessage.getKey()", "testWikiMessageKey",
054: wikiMessage.getKey());
055: assertNull("wikiMessage.getParams()", wikiMessage.getParams());
056: }
057:
058: /**
059: *
060: */
061: public void testConstructor3() throws Throwable {
062: String[] strings = new String[0];
063: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey",
064: strings);
065: assertEquals("wikiMessage.getKey()", "testWikiMessageKey",
066: wikiMessage.getKey());
067: assertEquals("wikiMessage.getParams().length", 0, wikiMessage
068: .getParams().length);
069: }
070:
071: /**
072: *
073: */
074: public void testConstructor4() throws Throwable {
075: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey",
076: "testWikiMessageParam1");
077: assertEquals("wikiMessage.getKey()", "testWikiMessageKey",
078: wikiMessage.getKey());
079: assertEquals("wikiMessage.getParams().length", 1, wikiMessage
080: .getParams().length);
081: }
082:
083: /**
084: *
085: */
086: public void testConstructor5() throws Throwable {
087: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey",
088: "testWikiMessageParam1", "testWikiMessageParam2");
089: assertEquals("wikiMessage.getKey()", "testWikiMessageKey",
090: wikiMessage.getKey());
091: assertEquals("wikiMessage.getParams().length", 2, wikiMessage
092: .getParams().length);
093: }
094:
095: /**
096: *
097: */
098: public void testGetKey() throws Throwable {
099: String result = new WikiMessage("testWikiMessageKey").getKey();
100: assertSame("result", "testWikiMessageKey", result);
101: }
102:
103: /**
104: *
105: */
106: public void testGetParams() throws Throwable {
107: String[] strings = new String[3];
108: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey");
109: wikiMessage.setParamsWithoutEscaping(strings);
110: String[] result = wikiMessage.getParams();
111: assertSame("result", strings, result);
112: assertNull("strings[0]", strings[0]);
113: }
114:
115: /**
116: *
117: */
118: public void testSetParamsWithoutEscaping() throws Throwable {
119: String[] strings = new String[3];
120: WikiMessage wikiMessage = new WikiMessage("testWikiMessageKey");
121: wikiMessage.setParamsWithoutEscaping(strings);
122: assertSame("wikiMessage.getParams()", strings, wikiMessage
123: .getParams());
124: }
125: }
|