001: /*
002: * ====================================================================
003: * JAFFA - Java Application Framework For All
004: *
005: * Copyright (C) 2002 JAFFA Development Group
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: * Redistribution and use of this software and associated documentation ("Software"),
022: * with or without modification, are permitted provided that the following conditions are met:
023: * 1. Redistributions of source code must retain copyright statements and notices.
024: * Redistributions must also contain a copy of this document.
025: * 2. Redistributions in binary form must reproduce the above copyright notice,
026: * this list of conditions and the following disclaimer in the documentation
027: * and/or other materials provided with the distribution.
028: * 3. The name "JAFFA" must not be used to endorse or promote products derived from
029: * this Software without prior written permission. For written permission,
030: * please contact mail to: jaffagroup@yahoo.com.
031: * 4. Products derived from this Software may not be called "JAFFA" nor may "JAFFA"
032: * appear in their names without prior written permission.
033: * 5. Due credit should be given to the JAFFA Project (http://jaffa.sourceforge.net).
034: *
035: * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
036: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
037: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
038: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
039: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
040: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
041: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
042: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
043: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
044: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
045: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
046: * SUCH DAMAGE.
047: * ====================================================================
048: */
049:
050: package org.jaffa.datatypes;
051:
052: import java.io.Serializable;
053: import java.util.Date;
054: import java.util.Calendar;
055: import java.util.GregorianCalendar;
056: import java.sql.Time;
057: import java.sql.Timestamp;
058: import java.text.ParseException;
059: import junit.framework.*;
060:
061: public class DateTimeTest extends TestCase {
062:
063: public DateTimeTest(java.lang.String testName) {
064: super (testName);
065: }
066:
067: public static void main(java.lang.String[] args) {
068: junit.textui.TestRunner.run(suite());
069: }
070:
071: public static Test suite() {
072: //TestSuite suite = new TestSuite(DateOnlyTest.class);
073: TestSuite suite = new TestSuite();
074: suite.addTest(new DateTimeTest("testParse"));
075:
076: return suite;
077: }
078:
079: /** Test of clone method, of class org.jaffa.datatypes.DateTime. */
080: public void testClone() {
081: System.out.println("testClone");
082:
083: // Add your test code below by replacing the default call to fail.
084: fail("The test case is empty.");
085: }
086:
087: /** Test of compareTo method, of class org.jaffa.datatypes.DateTime. */
088: public void testCompareTo() {
089: System.out.println("testCompareTo");
090:
091: // Add your test code below by replacing the default call to fail.
092: fail("The test case is empty.");
093: }
094:
095: /** Test of equals method, of class org.jaffa.datatypes.DateTime. */
096: public void testEquals() {
097: System.out.println("testEquals");
098:
099: // Add your test code below by replacing the default call to fail.
100: fail("The test case is empty.");
101: }
102:
103: /** Test of hashCode method, of class org.jaffa.datatypes.DateTime. */
104: public void testHashCode() {
105: System.out.println("testHashCode");
106:
107: // Add your test code below by replacing the default call to fail.
108: fail("The test case is empty.");
109: }
110:
111: /** Test of toString method, of class org.jaffa.datatypes.DateTime. */
112: public void testToString() {
113: System.out.println("testToString");
114:
115: // Add your test code below by replacing the default call to fail.
116: fail("The test case is empty.");
117: }
118:
119: /** Test of getTime method, of class org.jaffa.datatypes.DateTime. */
120: public void testGetTime() {
121: System.out.println("testGetTime");
122:
123: // Add your test code below by replacing the default call to fail.
124: fail("The test case is empty.");
125: }
126:
127: /** Test of getUtilDate method, of class org.jaffa.datatypes.DateTime. */
128: public void testGetUtilDate() {
129: System.out.println("testGetUtilDate");
130:
131: // Add your test code below by replacing the default call to fail.
132: fail("The test case is empty.");
133: }
134:
135: /** Test of getCalendar method, of class org.jaffa.datatypes.DateTime. */
136: public void testGetCalendar() {
137: System.out.println("testGetCalendar");
138:
139: // Add your test code below by replacing the default call to fail.
140: fail("The test case is empty.");
141: }
142:
143: /** Test of getSQLDate method, of class org.jaffa.datatypes.DateTime. */
144: public void testGetSQLDate() {
145: System.out.println("testGetSQLDate");
146:
147: // Add your test code below by replacing the default call to fail.
148: fail("The test case is empty.");
149: }
150:
151: /** Test of getSQLTime method, of class org.jaffa.datatypes.DateTime. */
152: public void testGetSQLTime() {
153: System.out.println("testGetSQLTime");
154:
155: // Add your test code below by replacing the default call to fail.
156: fail("The test case is empty.");
157: }
158:
159: /** Test of getTimestamp method, of class org.jaffa.datatypes.DateTime. */
160: public void testGetTimestamp() {
161: System.out.println("testGetTimestamp");
162:
163: // Add your test code below by replacing the default call to fail.
164: fail("The test case is empty.");
165: }
166:
167: /** Test of getYear method, of class org.jaffa.datatypes.DateTime. */
168: public void testGetYear() {
169: System.out.println("testGetYear");
170:
171: // Add your test code below by replacing the default call to fail.
172: fail("The test case is empty.");
173: }
174:
175: /** Test of getMonth method, of class org.jaffa.datatypes.DateTime. */
176: public void testGetMonth() {
177: System.out.println("testGetMonth");
178:
179: // Add your test code below by replacing the default call to fail.
180: fail("The test case is empty.");
181: }
182:
183: /** Test of getDay method, of class org.jaffa.datatypes.DateTime. */
184: public void testGetDay() {
185: System.out.println("testGetDay");
186:
187: // Add your test code below by replacing the default call to fail.
188: fail("The test case is empty.");
189: }
190:
191: /** Test of getDayOfWeek method, of class org.jaffa.datatypes.DateTime. */
192: public void testGetDayOfWeek() {
193: System.out.println("testGetDayOfWeek");
194:
195: // Add your test code below by replacing the default call to fail.
196: fail("The test case is empty.");
197: }
198:
199: /** Test of getDayOfWeekInMonth method, of class org.jaffa.datatypes.DateTime. */
200: public void testGetDayOfWeekInMonth() {
201: System.out.println("testGetDayOfWeekInMonth");
202:
203: // Add your test code below by replacing the default call to fail.
204: fail("The test case is empty.");
205: }
206:
207: /** Test of getDayOfYear method, of class org.jaffa.datatypes.DateTime. */
208: public void testGetDayOfYear() {
209: System.out.println("testGetDayOfYear");
210:
211: // Add your test code below by replacing the default call to fail.
212: fail("The test case is empty.");
213: }
214:
215: /** Test of getWeekOfMonth method, of class org.jaffa.datatypes.DateTime. */
216: public void testGetWeekOfMonth() {
217: System.out.println("testGetWeekOfMonth");
218:
219: // Add your test code below by replacing the default call to fail.
220: fail("The test case is empty.");
221: }
222:
223: /** Test of getWeekOfYear method, of class org.jaffa.datatypes.DateTime. */
224: public void testGetWeekOfYear() {
225: System.out.println("testGetWeekOfYear");
226:
227: // Add your test code below by replacing the default call to fail.
228: fail("The test case is empty.");
229: }
230:
231: /** Test of getHour method, of class org.jaffa.datatypes.DateTime. */
232: public void testGetHour() {
233: System.out.println("testGetHour");
234:
235: // Add your test code below by replacing the default call to fail.
236: fail("The test case is empty.");
237: }
238:
239: /** Test of getHourOfDay method, of class org.jaffa.datatypes.DateTime. */
240: public void testGetHourOfDay() {
241: System.out.println("testGetHourOfDay");
242:
243: // Add your test code below by replacing the default call to fail.
244: fail("The test case is empty.");
245: }
246:
247: /** Test of getMinute method, of class org.jaffa.datatypes.DateTime. */
248: public void testGetMinute() {
249: System.out.println("testGetMinute");
250:
251: // Add your test code below by replacing the default call to fail.
252: fail("The test case is empty.");
253: }
254:
255: /** Test of getSecond method, of class org.jaffa.datatypes.DateTime. */
256: public void testGetSecond() {
257: System.out.println("testGetSecond");
258:
259: // Add your test code below by replacing the default call to fail.
260: fail("The test case is empty.");
261: }
262:
263: /** Test of getMilli method, of class org.jaffa.datatypes.DateTime. */
264: public void testGetMilli() {
265: System.out.println("testGetMilli");
266:
267: // Add your test code below by replacing the default call to fail.
268: fail("The test case is empty.");
269: }
270:
271: /** Test of isAM method, of class org.jaffa.datatypes.DateTime. */
272: public void testIsAM() {
273: System.out.println("testIsAM");
274:
275: // Add your test code below by replacing the default call to fail.
276: fail("The test case is empty.");
277: }
278:
279: /** Test of isPM method, of class org.jaffa.datatypes.DateTime. */
280: public void testIsPM() {
281: System.out.println("testIsPM");
282:
283: // Add your test code below by replacing the default call to fail.
284: fail("The test case is empty.");
285: }
286:
287: /** Test of getFirstDayOfWeek method, of class org.jaffa.datatypes.DateTime. */
288: public void testGetFirstDayOfWeek() {
289: System.out.println("testGetFirstDayOfWeek");
290:
291: // Add your test code below by replacing the default call to fail.
292: fail("The test case is empty.");
293: }
294:
295: /** Test of isAfter method, of class org.jaffa.datatypes.DateTime. */
296: public void testIsAfter() {
297: System.out.println("testIsAfter");
298:
299: // Add your test code below by replacing the default call to fail.
300: fail("The test case is empty.");
301: }
302:
303: /** Test of isBefore method, of class org.jaffa.datatypes.DateTime. */
304: public void testIsBefore() {
305: System.out.println("testIsBefore");
306:
307: // Add your test code below by replacing the default call to fail.
308: fail("The test case is empty.");
309: }
310:
311: /** Test of getJulian method, of class org.jaffa.datatypes.DateTime. */
312: public void testGetJulian() {
313: System.out.println("testGetJulian");
314:
315: // Add your test code below by replacing the default call to fail.
316: fail("The test case is empty.");
317: }
318:
319: /** Test of addYear method, of class org.jaffa.datatypes.DateTime. */
320: public void testAddYear() {
321: System.out.println("testAddYear");
322:
323: // Add your test code below by replacing the default call to fail.
324: fail("The test case is empty.");
325: }
326:
327: /** Test of addMonth method, of class org.jaffa.datatypes.DateTime. */
328: public void testAddMonth() {
329: System.out.println("testAddMonth");
330:
331: // Add your test code below by replacing the default call to fail.
332: fail("The test case is empty.");
333: }
334:
335: /** Test of addDay method, of class org.jaffa.datatypes.DateTime. */
336: public void testAddDay() {
337: System.out.println("testAddDay");
338:
339: // Add your test code below by replacing the default call to fail.
340: fail("The test case is empty.");
341: }
342:
343: /** Test of addHour method, of class org.jaffa.datatypes.DateTime. */
344: public void testAddHour() {
345: System.out.println("testAddHour");
346:
347: // Add your test code below by replacing the default call to fail.
348: fail("The test case is empty.");
349: }
350:
351: /** Test of addMinute method, of class org.jaffa.datatypes.DateTime. */
352: public void testAddMinute() {
353: System.out.println("testAddMinute");
354:
355: // Add your test code below by replacing the default call to fail.
356: fail("The test case is empty.");
357: }
358:
359: /** Test of addSecond method, of class org.jaffa.datatypes.DateTime. */
360: public void testAddSecond() {
361: System.out.println("testAddSecond");
362:
363: // Add your test code below by replacing the default call to fail.
364: fail("The test case is empty.");
365: }
366:
367: /** Test of addMilli method, of class org.jaffa.datatypes.DateTime. */
368: public void testAddMilli() {
369: System.out.println("testAddMilli");
370:
371: // Add your test code below by replacing the default call to fail.
372: fail("The test case is empty.");
373: }
374:
375: /** Test of daysBetween method, of class org.jaffa.datatypes.DateTime. */
376: public void testDaysBetween() {
377: System.out.println("testDaysBetween");
378:
379: // Add your test code below by replacing the default call to fail.
380: fail("The test case is empty.");
381: }
382:
383: /** Test of clearTime method, of class org.jaffa.datatypes.DateTime. */
384: public void testClearTime() {
385: System.out.println("testClearTime");
386:
387: // Add your test code below by replacing the default call to fail.
388: fail("The test case is empty.");
389: }
390:
391: /** Test of toDateOnly method, of class org.jaffa.datatypes.DateTime. */
392: public void testToDateOnly() {
393: System.out.println("testToDateOnly");
394:
395: // Add your test code below by replacing the default call to fail.
396: fail("The test case is empty.");
397: }
398:
399: /** Test of parse method, of class org.jaffa.datatypes.DateOnly. */
400: public void testParse() {
401: System.out.println("testParse");
402:
403: try {
404: System.out.println("t: " + DateTime.parse("t"));
405: System.out.println("n: " + DateTime.parse("n"));
406: System.out.println("n + 1 : "
407: + DateTime.parse("n + 1 "));
408: System.out.println("n-1: " + DateTime.parse("n-1"));
409: System.out.println("t-1m10: " + DateTime.parse("t-1m10"));
410: System.out.println("n+1m1d-1y: "
411: + DateTime.parse("n+1m1d-1y"));
412: System.out.println("n-1y-1m-10h: "
413: + DateTime.parse("n-1y-1m-10h"));
414: System.out.println("t + 1m 11 1: "
415: + DateTime.parse("t + 1m 11 1"));
416: System.out.println("t - 1m 1: "
417: + DateTime.parse("t - 1m 1"));
418: System.out.println("null: " + DateOnly.parse(null));
419: System.out.println("Empty String: " + DateOnly.parse(""));
420: } catch (Exception e) {
421: e.printStackTrace();
422: fail();
423: }
424:
425: // Add your test code below by replacing the default call to fail.
426: //fail("The test case is empty.");
427: }
428:
429: }
|