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 WikiVersionTest extends TestCase {
023:
024: /**
025: *
026: */
027: public void testConstructor() throws Throwable {
028: WikiVersion wikiVersion = new WikiVersion("0.5.1");
029: assertFalse("Constructor failed to properly set up version",
030: wikiVersion.before(0, 5, 1));
031: assertFalse("Constructor failed to properly set up version",
032: wikiVersion.before(0, 5, 0));
033: assertTrue("Constructor failed to properly set up version",
034: wikiVersion.before(0, 5, 2));
035: }
036:
037: /**
038: *
039: */
040: public void testBefore() throws Throwable {
041: WikiVersion version = new WikiVersion("0.5.1");
042: boolean result = version.before(version);
043: assertFalse("result", result);
044: }
045:
046: /**
047: *
048: */
049: public void testBefore1() throws Throwable {
050: boolean result = new WikiVersion("0.5.1").before(100, 1000, 0);
051: assertTrue("result", result);
052: }
053:
054: /**
055: *
056: */
057: public void testBefore2() throws Throwable {
058: boolean result = new WikiVersion("0.5.1").before(0, 100, 1000);
059: assertTrue("result", result);
060: }
061:
062: /**
063: *
064: */
065: public void testBefore3() throws Throwable {
066: boolean result = new WikiVersion("0.5.1").before(0, 5, 100);
067: assertTrue("result", result);
068: }
069:
070: /**
071: *
072: */
073: public void testBefore4() throws Throwable {
074: boolean result = new WikiVersion("0.5.1").before(0, -1, 100);
075: assertFalse("result", result);
076: }
077:
078: /**
079: *
080: */
081: public void testConstructorThrowsException() throws Throwable {
082: try {
083: new WikiVersion(".LLx]FUAw,.4LvE$e$XNmc 0<P.SL;nQfRQO.4UXw");
084: fail("Expected Exception to be thrown");
085: } catch (Exception ex) {
086: assertNotNull("Invalid exception message", ex.getMessage());
087: }
088: }
089:
090: /**
091: *
092: */
093: public void testConstructorThrowsException1() throws Throwable {
094: try {
095: new WikiVersion("0.5.u1");
096: fail("Expected Exception to be thrown");
097: } catch (Exception ex) {
098: assertNotNull("Invalid exception message", ex.getMessage());
099: }
100: }
101:
102: /**
103: *
104: */
105: public void testConstructorThrowsException2() throws Throwable {
106: try {
107: new WikiVersion(
108: "X\u0006Fl\\s\u000E6T\u000Ec>\fiS.\u00049gk\u00050'n$<y%](o\u0000!@2\u001A\u0016P%");
109: fail("Expected Exception to be thrown");
110: } catch (Exception ex) {
111: assertNotNull("Invalid exception message", ex.getMessage());
112: }
113: }
114:
115: /**
116: *
117: */
118: public void testConstructorThrowsException3() throws Throwable {
119: try {
120: new WikiVersion("");
121: fail("Expected Exception to be thrown");
122: } catch (Exception ex) {
123: assertNotNull("Invalid exception message", ex.getMessage());
124: }
125: }
126:
127: /**
128: *
129: */
130: public void testConstructorThrowsNumberFormatException()
131: throws Throwable {
132: try {
133: new WikiVersion("')_.g|R.?'bx$||7,v`FvmpuUBNy,$C,/mvi^M[}@");
134: fail("Expected NumberFormatException to be thrown");
135: } catch (NumberFormatException ex) {
136: assertNotNull("Invalid exception message", ex.getMessage());
137: }
138: }
139:
140: /**
141: *
142: */
143: public void testConstructorThrowsNumberFormatException1()
144: throws Throwable {
145: try {
146: new WikiVersion("0.B5.1");
147: fail("Expected NumberFormatException to be thrown");
148: } catch (NumberFormatException ex) {
149: assertNotNull("Invalid exception message", ex.getMessage());
150: }
151: }
152:
153: /**
154: *
155: */
156: public void testBeforeThrowsNullPointerException() throws Throwable {
157: try {
158: new WikiVersion("0.5.1").before(null);
159: fail("Expected NullPointerException to be thrown");
160: } catch (NullPointerException ex) {
161: // FIXME - do something here
162: }
163: }
164: }
|