001: package org.springunit.examples;
002:
003: import junit.framework.TestCase;
004:
005: public class CompositeDateJUnitTest extends TestCase {
006:
007: public void testConstructor20060101() throws Exception {
008: int expectedDay = 1;
009: int expectedMonth = 1;
010: int expectedYear = 2006;
011: CompositeDate subject = new CompositeDate(2006, 1, 1);
012: assertTrue(expectedMonth == subject.getMonth());
013: assertTrue(expectedDay == subject.getDay());
014: assertTrue(expectedYear == subject.getYear());
015: }
016:
017: public void testConstructor20061231() throws Exception {
018: int expectedDay = 31;
019: int expectedMonth = 12;
020: int expectedYear = 2006;
021: CompositeDate subject = new CompositeDate(2006, 12, 31);
022: assertTrue(expectedMonth == subject.getMonth());
023: assertTrue(expectedDay == subject.getDay());
024: assertTrue(expectedYear == subject.getYear());
025: }
026:
027: public void testConstructor20060431() throws Exception {
028: try {
029: new CompositeDate(2006, 4, 31);
030: fail("Exception not thrown");
031: } catch (InvalidDateException ex) {
032: }
033: }
034:
035: public void testConstructor20060631() throws Exception {
036: try {
037: new CompositeDate(2006, 6, 31);
038: fail("Exception not thrown");
039: } catch (InvalidDateException ex) {
040: }
041: }
042:
043: public void testConstructor20060931() throws Exception {
044: try {
045: new CompositeDate(2006, 9, 31);
046: fail("Exception not thrown");
047: } catch (InvalidDateException ex) {
048: }
049: }
050:
051: public void testConstructor20061131() throws Exception {
052: try {
053: new CompositeDate(2006, 11, 31);
054: fail("Exception not thrown");
055: } catch (InvalidDateException ex) {
056: }
057: }
058:
059: public void testConstructor20060231() throws Exception {
060: try {
061: new CompositeDate(2006, 2, 31);
062: fail("Exception not thrown");
063: } catch (InvalidDateException ex) {
064: }
065: }
066:
067: public void testConstructor20060230() throws Exception {
068: try {
069: new CompositeDate(2006, 2, 30);
070: fail("Exception not thrown");
071: } catch (InvalidDateException ex) {
072: }
073: }
074:
075: public void testConstructor20030229() throws Exception {
076: try {
077: new CompositeDate(2003, 2, 29);
078: fail("Exception not thrown");
079: } catch (InvalidDateException ex) {
080: }
081: }
082:
083: public void testConstructor19000229() throws Exception {
084: try {
085: new CompositeDate(1900, 2, 29);
086: fail("Exception not thrown");
087: } catch (InvalidDateException ex) {
088: }
089: }
090:
091: public void testConstructor20000229() throws Exception {
092: int expectedDay = 29;
093: int expectedMonth = 2;
094: int expectedYear = 2000;
095: CompositeDate subject = new CompositeDate(2000, 2, 29);
096: assertTrue(expectedMonth == subject.getMonth());
097: assertTrue(expectedDay == subject.getDay());
098: assertTrue(expectedYear == subject.getYear());
099: }
100:
101: public void testConstructor20040229() throws Exception {
102: int expectedDay = 29;
103: int expectedMonth = 2;
104: int expectedYear = 2004;
105: CompositeDate subject = new CompositeDate(2004, 2, 29);
106: assertTrue(expectedMonth == subject.getMonth());
107: assertTrue(expectedDay == subject.getDay());
108: assertTrue(expectedYear == subject.getYear());
109: }
110:
111: public void testSetDay200601xx_01() throws Exception {
112: int day = 1;
113: CompositeDate subject = new CompositeDate(2006, 1, 15);
114: subject.setDay(day);
115: CompositeDate expected = new CompositeDate(2006, 1, 1);
116: assertEquals(expected, subject);
117: }
118:
119: public void testSetDay200612xx_01() throws Exception {
120: int day = 31;
121: CompositeDate subject = new CompositeDate(2006, 12, 15);
122: subject.setDay(day);
123: CompositeDate expected = new CompositeDate(2006, 12, 31);
124: assertEquals(expected, subject);
125: }
126:
127: public void testSetDay200604xx_31() throws Exception {
128: int day = 31;
129: CompositeDate subject = new CompositeDate(2006, 4, 15);
130: try {
131: subject.setDay(day);
132: fail("Exception not thrown");
133: } catch (InvalidDateException ex) {
134: }
135: }
136:
137: public void testSetDay200606xx_31() throws Exception {
138: int day = 31;
139: CompositeDate subject = new CompositeDate(2006, 6, 15);
140: try {
141: subject.setDay(day);
142: fail("Exception not thrown");
143: } catch (InvalidDateException ex) {
144: }
145: }
146:
147: public void testSetDay200609xx_31() throws Exception {
148: int day = 31;
149: CompositeDate subject = new CompositeDate(2006, 9, 15);
150: try {
151: subject.setDay(day);
152: fail("Exception not thrown");
153: } catch (InvalidDateException ex) {
154: }
155: }
156:
157: public void testSetDay200611xx_31() throws Exception {
158: int day = 31;
159: CompositeDate subject = new CompositeDate(2006, 11, 15);
160: try {
161: subject.setDay(day);
162: fail("Exception not thrown");
163: } catch (InvalidDateException ex) {
164: }
165: }
166:
167: public void testSetDay200602xx_31() throws Exception {
168: int day = 31;
169: CompositeDate subject = new CompositeDate(2006, 2, 15);
170: try {
171: subject.setDay(day);
172: fail("Exception not thrown");
173: } catch (InvalidDateException ex) {
174: }
175: }
176:
177: public void testSetDay200602xx_30() throws Exception {
178: int day = 30;
179: CompositeDate subject = new CompositeDate(2006, 2, 15);
180: try {
181: subject.setDay(day);
182: fail("Exception not thrown");
183: } catch (InvalidDateException ex) {
184: }
185: }
186:
187: public void testSetDay200302xx_29() throws Exception {
188: int day = 29;
189: CompositeDate subject = new CompositeDate(2003, 2, 15);
190: try {
191: subject.setDay(day);
192: fail("Exception not thrown");
193: } catch (InvalidDateException ex) {
194: }
195: }
196:
197: public void testSetDay190002xx_29() throws Exception {
198: int day = 29;
199: CompositeDate subject = new CompositeDate(1900, 2, 15);
200: try {
201: subject.setDay(day);
202: fail("Exception not thrown");
203: } catch (InvalidDateException ex) {
204: }
205: }
206:
207: public void testSetDay200002xx_29() throws Exception {
208: int day = 29;
209: CompositeDate subject = new CompositeDate(2000, 2, 15);
210: subject.setDay(day);
211: CompositeDate expected = new CompositeDate(2000, 2, 29);
212: assertEquals(expected, subject);
213: }
214:
215: public void testSetDay200402xx_29() throws Exception {
216: int day = 29;
217: CompositeDate subject = new CompositeDate(2004, 2, 15);
218: subject.setDay(day);
219: CompositeDate expected = new CompositeDate(2004, 2, 29);
220: assertEquals(expected, subject);
221: }
222:
223: public void testSetMonth2006xx01_01() throws Exception {
224: int month = 1;
225: CompositeDate subject = new CompositeDate(2006, 7, 1);
226: subject.setMonth(month);
227: CompositeDate expected = new CompositeDate(2006, 1, 1);
228: assertEquals(expected, subject);
229: }
230:
231: public void testSetMonth2006xx31_12() throws Exception {
232: int month = 12;
233: CompositeDate subject = new CompositeDate(2006, 7, 31);
234: subject.setMonth(month);
235: CompositeDate expected = new CompositeDate(2006, 12, 31);
236: assertEquals(expected, subject);
237: }
238:
239: public void testSetMonth2006xx31_04() throws Exception {
240: int month = 4;
241: CompositeDate subject = new CompositeDate(2006, 7, 31);
242: try {
243: subject.setMonth(month);
244: fail("Exception not thrown");
245: } catch (InvalidDateException ex) {
246: }
247: }
248:
249: public void testSetMonth2006xx31_06() throws Exception {
250: int month = 6;
251: CompositeDate subject = new CompositeDate(2006, 7, 31);
252: try {
253: subject.setMonth(month);
254: fail("Exception not thrown");
255: } catch (InvalidDateException ex) {
256: }
257: }
258:
259: public void testSetMonth2006xx31_09() throws Exception {
260: int month = 9;
261: CompositeDate subject = new CompositeDate(2006, 7, 31);
262: try {
263: subject.setMonth(month);
264: fail("Exception not thrown");
265: } catch (InvalidDateException ex) {
266: }
267: }
268:
269: public void testSetMonth2006xx31_11() throws Exception {
270: int month = 11;
271: CompositeDate subject = new CompositeDate(2006, 7, 31);
272: try {
273: subject.setMonth(month);
274: fail("Exception not thrown");
275: } catch (InvalidDateException ex) {
276: }
277: }
278:
279: public void testSetMonth2006xx31_02() throws Exception {
280: int month = 2;
281: CompositeDate subject = new CompositeDate(2006, 7, 31);
282: try {
283: subject.setMonth(month);
284: fail("Exception not thrown");
285: } catch (InvalidDateException ex) {
286: }
287: }
288:
289: public void testSetMonth2006xx30_02() throws Exception {
290: int month = 2;
291: CompositeDate subject = new CompositeDate(2006, 7, 30);
292: try {
293: subject.setMonth(month);
294: fail("Exception not thrown");
295: } catch (InvalidDateException ex) {
296: }
297: }
298:
299: public void testSetMonth2003xx29_02() throws Exception {
300: int month = 2;
301: CompositeDate subject = new CompositeDate(2003, 7, 29);
302: try {
303: subject.setMonth(month);
304: fail("Exception not thrown");
305: } catch (InvalidDateException ex) {
306: }
307: }
308:
309: public void testSetMonth1900xx29_02() throws Exception {
310: int month = 2;
311: CompositeDate subject = new CompositeDate(1900, 7, 29);
312: try {
313: subject.setMonth(month);
314: fail("Exception not thrown");
315: } catch (InvalidDateException ex) {
316: }
317: }
318:
319: public void testSetMonth2000xx29_02() throws Exception {
320: int month = 2;
321: CompositeDate subject = new CompositeDate(2000, 7, 29);
322: subject.setMonth(month);
323: CompositeDate expected = new CompositeDate(2000, 2, 29);
324: assertEquals(expected, subject);
325: }
326:
327: public void testSetMonth2004xx29_02() throws Exception {
328: int month = 2;
329: CompositeDate subject = new CompositeDate(2004, 7, 29);
330: subject.setMonth(month);
331: CompositeDate expected = new CompositeDate(2004, 2, 29);
332: assertEquals(expected, subject);
333: }
334:
335: public void testSetYear20060101_yyyy() throws Exception {
336: int year = 2007;
337: CompositeDate subject = new CompositeDate(2006, 1, 1);
338: subject.setYear(year);
339: CompositeDate expected = new CompositeDate(2007, 1, 1);
340: assertEquals(expected, subject);
341: }
342:
343: public void testSetYear20061231_yyyy() throws Exception {
344: int year = 2007;
345: CompositeDate subject = new CompositeDate(2006, 12, 31);
346: subject.setYear(year);
347: CompositeDate expected = new CompositeDate(2007, 12, 31);
348: assertEquals(expected, subject);
349: }
350:
351: public void testSetYear20040229_2003() throws Exception {
352: int year = 2003;
353: CompositeDate subject = new CompositeDate(2004, 2, 29);
354: try {
355: subject.setYear(year);
356: fail("Exception not thrown");
357: } catch (InvalidDateException ex) {
358: }
359: }
360:
361: public void testSetYear20040229_1900() throws Exception {
362: int year = 1900;
363: CompositeDate subject = new CompositeDate(2004, 2, 29);
364: try {
365: subject.setYear(year);
366: fail("Exception not thrown");
367: } catch (InvalidDateException ex) {
368: }
369: }
370:
371: public void testSetYear20040229_2000() throws Exception {
372: int year = 2000;
373: CompositeDate subject = new CompositeDate(2004, 2, 29);
374: subject.setYear(year);
375: CompositeDate expected = new CompositeDate(2000, 2, 29);
376: assertEquals(expected, subject);
377: }
378:
379: public void testSetYear20040229_1996() throws Exception {
380: int year = 1996;
381: CompositeDate subject = new CompositeDate(2004, 2, 29);
382: subject.setYear(year);
383: CompositeDate expected = new CompositeDate(1996, 2, 29);
384: assertEquals(expected, subject);
385: }
386:
387: public void testIncrementDay20060101() throws Exception {
388: CompositeDate subject = new CompositeDate(2006, 1, 1);
389: subject.incrementDay();
390: CompositeDate expected = new CompositeDate(2006, 1, 2);
391: assertEquals(expected, subject);
392: }
393:
394: public void testIncrementDay20060131() throws Exception {
395: CompositeDate subject = new CompositeDate(2006, 1, 31);
396: subject.incrementDay();
397: CompositeDate expected = new CompositeDate(2006, 2, 1);
398: assertEquals(expected, subject);
399: }
400:
401: public void testIncrementDay20060331() throws Exception {
402: CompositeDate subject = new CompositeDate(2006, 3, 31);
403: subject.incrementDay();
404: CompositeDate expected = new CompositeDate(2006, 4, 1);
405: assertEquals(expected, subject);
406: }
407:
408: public void testIncrementDay20060430() throws Exception {
409: CompositeDate subject = new CompositeDate(2006, 4, 30);
410: subject.incrementDay();
411: CompositeDate expected = new CompositeDate(2006, 5, 1);
412: assertEquals(expected, subject);
413: }
414:
415: public void testIncrementDay20060531() throws Exception {
416: CompositeDate subject = new CompositeDate(2006, 5, 31);
417: subject.incrementDay();
418: CompositeDate expected = new CompositeDate(2006, 6, 1);
419: assertEquals(expected, subject);
420: }
421:
422: public void testIncrementDay20060630() throws Exception {
423: CompositeDate subject = new CompositeDate(2006, 6, 30);
424: subject.incrementDay();
425: CompositeDate expected = new CompositeDate(2006, 7, 1);
426: assertEquals(expected, subject);
427: }
428:
429: public void testIncrementDay20060731() throws Exception {
430: CompositeDate subject = new CompositeDate(2006, 7, 31);
431: subject.incrementDay();
432: CompositeDate expected = new CompositeDate(2006, 8, 1);
433: assertEquals(expected, subject);
434: }
435:
436: public void testIncrementDay20060831() throws Exception {
437: CompositeDate subject = new CompositeDate(2006, 8, 31);
438: subject.incrementDay();
439: CompositeDate expected = new CompositeDate(2006, 9, 1);
440: assertEquals(expected, subject);
441: }
442:
443: public void testIncrementDay20060930() throws Exception {
444: CompositeDate subject = new CompositeDate(2006, 9, 30);
445: subject.incrementDay();
446: CompositeDate expected = new CompositeDate(2006, 10, 1);
447: assertEquals(expected, subject);
448: }
449:
450: public void testIncrementDay20061031() throws Exception {
451: CompositeDate subject = new CompositeDate(2006, 10, 31);
452: subject.incrementDay();
453: CompositeDate expected = new CompositeDate(2006, 11, 1);
454: assertEquals(expected, subject);
455: }
456:
457: public void testIncrementDay20061130() throws Exception {
458: CompositeDate subject = new CompositeDate(2006, 11, 30);
459: subject.incrementDay();
460: CompositeDate expected = new CompositeDate(2006, 12, 1);
461: assertEquals(expected, subject);
462: }
463:
464: public void testIncrementDay20061231() throws Exception {
465: CompositeDate subject = new CompositeDate(2006, 12, 31);
466: subject.incrementDay();
467: CompositeDate expected = new CompositeDate(2007, 1, 1);
468: assertEquals(expected, subject);
469: }
470:
471: public void testIncrementDayMaxValue1231() throws Exception {
472: CompositeDate subject = new CompositeDate(2147483647, 12, 31);
473: try {
474: subject.incrementDay();
475: fail("Exception not thrown");
476: } catch (DateOverflowException ex) {
477: }
478: }
479:
480: public void testIncrementDay20040229() throws Exception {
481: CompositeDate subject = new CompositeDate(2004, 2, 29);
482: subject.incrementDay();
483: CompositeDate expected = new CompositeDate(2004, 3, 1);
484: assertEquals(expected, subject);
485: }
486:
487: public void testIncrementDay20040228() throws Exception {
488: CompositeDate subject = new CompositeDate(2004, 2, 28);
489: subject.incrementDay();
490: CompositeDate expected = new CompositeDate(2004, 2, 29);
491: assertEquals(expected, subject);
492: }
493:
494: public void testIncrementDay20030228() throws Exception {
495: CompositeDate subject = new CompositeDate(2003, 2, 28);
496: subject.incrementDay();
497: CompositeDate expected = new CompositeDate(2003, 3, 1);
498: assertEquals(expected, subject);
499: }
500:
501: public void testIncrementDay20000228() throws Exception {
502: CompositeDate subject = new CompositeDate(2000, 2, 28);
503: subject.incrementDay();
504: CompositeDate expected = new CompositeDate(2000, 2, 29);
505: assertEquals(expected, subject);
506: }
507:
508: public void testIncrementDay19000228() throws Exception {
509: CompositeDate subject = new CompositeDate(1900, 2, 28);
510: subject.incrementDay();
511: CompositeDate expected = new CompositeDate(1900, 3, 1);
512: assertEquals(expected, subject);
513: }
514:
515: public void testIncrementMonth20060101() throws Exception {
516: CompositeDate subject = new CompositeDate(2006, 1, 1);
517: subject.incrementMonth();
518: CompositeDate expected = new CompositeDate(2006, 2, 1);
519: assertEquals(expected, subject);
520: }
521:
522: public void testIncrementMonth20060129() throws Exception {
523: CompositeDate subject = new CompositeDate(2006, 1, 29);
524: subject.incrementMonth();
525: CompositeDate expected = new CompositeDate(2006, 2, 28);
526: assertEquals(expected, subject);
527: }
528:
529: public void testIncrementMonth20060130() throws Exception {
530: CompositeDate subject = new CompositeDate(2006, 1, 30);
531: subject.incrementMonth();
532: CompositeDate expected = new CompositeDate(2006, 2, 28);
533: assertEquals(expected, subject);
534: }
535:
536: public void testIncrementMonth20060131() throws Exception {
537: CompositeDate subject = new CompositeDate(2006, 1, 31);
538: subject.incrementMonth();
539: CompositeDate expected = new CompositeDate(2006, 2, 28);
540: assertEquals(expected, subject);
541: }
542:
543: public void testIncrementMonth20040228() throws Exception {
544: CompositeDate subject = new CompositeDate(2004, 2, 28);
545: subject.incrementMonth();
546: CompositeDate expected = new CompositeDate(2004, 3, 28);
547: assertEquals(expected, subject);
548: }
549:
550: public void testIncrementMonth20040229() throws Exception {
551: CompositeDate subject = new CompositeDate(2004, 2, 29);
552: subject.incrementMonth();
553: CompositeDate expected = new CompositeDate(2004, 3, 29);
554: assertEquals(expected, subject);
555: }
556:
557: public void testIncrementMonth20060331() throws Exception {
558: CompositeDate subject = new CompositeDate(2006, 3, 31);
559: subject.incrementMonth();
560: CompositeDate expected = new CompositeDate(2006, 4, 30);
561: assertEquals(expected, subject);
562: }
563:
564: public void testIncrementMonth20060430() throws Exception {
565: CompositeDate subject = new CompositeDate(2006, 4, 30);
566: subject.incrementMonth();
567: CompositeDate expected = new CompositeDate(2006, 5, 30);
568: assertEquals(expected, subject);
569: }
570:
571: public void testIncrementMonth20060531() throws Exception {
572: CompositeDate subject = new CompositeDate(2006, 5, 31);
573: subject.incrementMonth();
574: CompositeDate expected = new CompositeDate(2006, 6, 30);
575: assertEquals(expected, subject);
576: }
577:
578: public void testIncrementMonth20060630() throws Exception {
579: CompositeDate subject = new CompositeDate(2006, 6, 30);
580: subject.incrementMonth();
581: CompositeDate expected = new CompositeDate(2006, 7, 30);
582: assertEquals(expected, subject);
583: }
584:
585: public void testIncrementMonth20060731() throws Exception {
586: CompositeDate subject = new CompositeDate(2006, 7, 31);
587: subject.incrementMonth();
588: CompositeDate expected = new CompositeDate(2006, 8, 31);
589: assertEquals(expected, subject);
590: }
591:
592: public void testIncrementMonth20060831() throws Exception {
593: CompositeDate subject = new CompositeDate(2006, 8, 31);
594: subject.incrementMonth();
595: CompositeDate expected = new CompositeDate(2006, 9, 30);
596: assertEquals(expected, subject);
597: }
598:
599: public void testIncrementMonth20060930() throws Exception {
600: CompositeDate subject = new CompositeDate(2006, 9, 30);
601: subject.incrementMonth();
602: CompositeDate expected = new CompositeDate(2006, 10, 30);
603: assertEquals(expected, subject);
604: }
605:
606: public void testIncrementMonth20061031() throws Exception {
607: CompositeDate subject = new CompositeDate(2006, 10, 31);
608: subject.incrementMonth();
609: CompositeDate expected = new CompositeDate(2006, 11, 30);
610: assertEquals(expected, subject);
611: }
612:
613: public void testIncrementMonth20061130() throws Exception {
614: CompositeDate subject = new CompositeDate(2006, 11, 30);
615: subject.incrementMonth();
616: CompositeDate expected = new CompositeDate(2006, 12, 30);
617: assertEquals(expected, subject);
618: }
619:
620: public void testIncrementMonth20061231() throws Exception {
621: CompositeDate subject = new CompositeDate(2006, 12, 31);
622: subject.incrementMonth();
623: CompositeDate expected = new CompositeDate(2007, 1, 31);
624: assertEquals(expected, subject);
625: }
626:
627: public void testIncrementMonthMaxValue1201() throws Exception {
628: CompositeDate subject = new CompositeDate(2147483647, 12, 1);
629: try {
630: subject.incrementMonth();
631: fail("Exception not thrown");
632: } catch (DateOverflowException ex) {
633: }
634: }
635:
636: public void testIncrementYear20060101() throws Exception {
637: CompositeDate subject = new CompositeDate(2006, 1, 1);
638: subject.incrementYear();
639: CompositeDate expected = new CompositeDate(2007, 1, 1);
640: assertEquals(expected, subject);
641: }
642:
643: public void testIncrementYear20061231() throws Exception {
644: CompositeDate subject = new CompositeDate(2006, 12, 31);
645: subject.incrementYear();
646: CompositeDate expected = new CompositeDate(2007, 12, 31);
647: assertEquals(expected, subject);
648: }
649:
650: public void testIncrementYear20040229() throws Exception {
651: CompositeDate subject = new CompositeDate(2004, 2, 29);
652: subject.incrementYear();
653: CompositeDate expected = new CompositeDate(2005, 2, 28);
654: assertEquals(expected, subject);
655: }
656:
657: public void testIncrementYearMaxValue0101() throws Exception {
658: CompositeDate subject = new CompositeDate(2147483647, 1, 1);
659: try {
660: subject.incrementYear();
661: fail("Exception not thrown");
662: } catch (DateOverflowException ex) {
663: }
664: }
665:
666: public void testDecrementDay20060101() throws Exception {
667: CompositeDate subject = new CompositeDate(2006, 1, 1);
668: subject.decrementDay();
669: CompositeDate expected = new CompositeDate(2005, 12, 31);
670: assertEquals(expected, subject);
671: }
672:
673: public void testDecrementDay20063112() throws Exception {
674: CompositeDate subject = new CompositeDate(2006, 12, 31);
675: subject.decrementDay();
676: CompositeDate expected = new CompositeDate(2006, 12, 30);
677: assertEquals(expected, subject);
678: }
679:
680: public void testDecrementDayMinValue0101() throws Exception {
681: CompositeDate subject = new CompositeDate(-2147483648, 1, 1);
682: try {
683: subject.decrementDay();
684: fail("Exception not thrown");
685: } catch (DateUnderflowException ex) {
686: }
687: }
688:
689: public void testDecrementDay20060201() throws Exception {
690: CompositeDate subject = new CompositeDate(2006, 2, 1);
691: subject.decrementDay();
692: CompositeDate expected = new CompositeDate(2006, 1, 31);
693: assertEquals(expected, subject);
694: }
695:
696: public void testDecrementDay20060401() throws Exception {
697: CompositeDate subject = new CompositeDate(2006, 4, 1);
698: subject.decrementDay();
699: CompositeDate expected = new CompositeDate(2006, 3, 31);
700: assertEquals(expected, subject);
701: }
702:
703: public void testDecrementDay20060501() throws Exception {
704: CompositeDate subject = new CompositeDate(2006, 5, 1);
705: subject.decrementDay();
706: CompositeDate expected = new CompositeDate(2006, 4, 30);
707: assertEquals(expected, subject);
708: }
709:
710: public void testDecrementDay20060601() throws Exception {
711: CompositeDate subject = new CompositeDate(2006, 6, 1);
712: subject.decrementDay();
713: CompositeDate expected = new CompositeDate(2006, 5, 31);
714: assertEquals(expected, subject);
715: }
716:
717: public void testDecrementDay20060701() throws Exception {
718: CompositeDate subject = new CompositeDate(2006, 7, 1);
719: subject.decrementDay();
720: CompositeDate expected = new CompositeDate(2006, 6, 30);
721: assertEquals(expected, subject);
722: }
723:
724: public void testDecrementDay20060801() throws Exception {
725: CompositeDate subject = new CompositeDate(2006, 8, 1);
726: subject.decrementDay();
727: CompositeDate expected = new CompositeDate(2006, 7, 31);
728: assertEquals(expected, subject);
729: }
730:
731: public void testDecrementDay20060901() throws Exception {
732: CompositeDate subject = new CompositeDate(2006, 9, 1);
733: subject.decrementDay();
734: CompositeDate expected = new CompositeDate(2006, 8, 31);
735: assertEquals(expected, subject);
736: }
737:
738: public void testDecrementDay20061001() throws Exception {
739: CompositeDate subject = new CompositeDate(2006, 10, 1);
740: subject.decrementDay();
741: CompositeDate expected = new CompositeDate(2006, 9, 30);
742: assertEquals(expected, subject);
743: }
744:
745: public void testDecrementDay20061101() throws Exception {
746: CompositeDate subject = new CompositeDate(2006, 11, 1);
747: subject.decrementDay();
748: CompositeDate expected = new CompositeDate(2006, 10, 31);
749: assertEquals(expected, subject);
750: }
751:
752: public void testDecrementDay20061201() throws Exception {
753: CompositeDate subject = new CompositeDate(2006, 12, 1);
754: subject.decrementDay();
755: CompositeDate expected = new CompositeDate(2006, 11, 30);
756: assertEquals(expected, subject);
757: }
758:
759: public void testDecrementDay20040229() throws Exception {
760: CompositeDate subject = new CompositeDate(2004, 2, 29);
761: subject.decrementDay();
762: CompositeDate expected = new CompositeDate(2004, 2, 28);
763: assertEquals(expected, subject);
764: }
765:
766: public void testDecrementDay20040301() throws Exception {
767: CompositeDate subject = new CompositeDate(2004, 3, 1);
768: subject.decrementDay();
769: CompositeDate expected = new CompositeDate(2004, 2, 29);
770: assertEquals(expected, subject);
771: }
772:
773: public void testDecrementDay20030301() throws Exception {
774: CompositeDate subject = new CompositeDate(2003, 3, 1);
775: subject.decrementDay();
776: CompositeDate expected = new CompositeDate(2003, 2, 28);
777: assertEquals(expected, subject);
778: }
779:
780: public void testDecrementDay20000301() throws Exception {
781: CompositeDate subject = new CompositeDate(2000, 3, 1);
782: subject.decrementDay();
783: CompositeDate expected = new CompositeDate(2000, 2, 29);
784: assertEquals(expected, subject);
785: }
786:
787: public void testDecrementDay19000301() throws Exception {
788: CompositeDate subject = new CompositeDate(1900, 3, 1);
789: subject.decrementDay();
790: CompositeDate expected = new CompositeDate(1900, 2, 28);
791: assertEquals(expected, subject);
792: }
793:
794: public void testDecrementMonth20060101() throws Exception {
795: CompositeDate subject = new CompositeDate(2006, 1, 1);
796: subject.decrementMonth();
797: CompositeDate expected = new CompositeDate(2005, 12, 1);
798: assertEquals(expected, subject);
799: }
800:
801: public void testDecrementMonth20060131() throws Exception {
802: CompositeDate subject = new CompositeDate(2006, 1, 31);
803: subject.decrementMonth();
804: CompositeDate expected = new CompositeDate(2005, 12, 31);
805: assertEquals(expected, subject);
806: }
807:
808: public void testDecrementMonthMinValue0131() throws Exception {
809: CompositeDate subject = new CompositeDate(-2147483648, 1, 31);
810: try {
811: subject.decrementMonth();
812: fail("Exception not thrown");
813: } catch (DateUnderflowException ex) {
814: }
815: }
816:
817: public void testDecrementMonth20040229() throws Exception {
818: CompositeDate subject = new CompositeDate(2004, 2, 29);
819: subject.decrementMonth();
820: CompositeDate expected = new CompositeDate(2004, 1, 29);
821: assertEquals(expected, subject);
822: }
823:
824: public void testDecrementMonth20060228() throws Exception {
825: CompositeDate subject = new CompositeDate(2006, 2, 28);
826: subject.decrementMonth();
827: CompositeDate expected = new CompositeDate(2006, 1, 28);
828: assertEquals(expected, subject);
829: }
830:
831: public void testDecrementMonth20060331() throws Exception {
832: CompositeDate subject = new CompositeDate(2006, 3, 31);
833: subject.decrementMonth();
834: CompositeDate expected = new CompositeDate(2006, 2, 28);
835: assertEquals(expected, subject);
836: }
837:
838: public void testDecrementMonth20060330() throws Exception {
839: CompositeDate subject = new CompositeDate(2006, 3, 30);
840: subject.decrementMonth();
841: CompositeDate expected = new CompositeDate(2006, 2, 28);
842: assertEquals(expected, subject);
843: }
844:
845: public void testDecrementMonth20060329() throws Exception {
846: CompositeDate subject = new CompositeDate(2006, 3, 29);
847: subject.decrementMonth();
848: CompositeDate expected = new CompositeDate(2006, 2, 28);
849: assertEquals(expected, subject);
850: }
851:
852: public void testDecrementMonth20060430() throws Exception {
853: CompositeDate subject = new CompositeDate(2006, 4, 30);
854: subject.decrementMonth();
855: CompositeDate expected = new CompositeDate(2006, 3, 30);
856: assertEquals(expected, subject);
857: }
858:
859: public void testDecrementMonth20060531() throws Exception {
860: CompositeDate subject = new CompositeDate(2006, 5, 31);
861: subject.decrementMonth();
862: CompositeDate expected = new CompositeDate(2006, 4, 30);
863: assertEquals(expected, subject);
864: }
865:
866: public void testDecrementMonth20060630() throws Exception {
867: CompositeDate subject = new CompositeDate(2006, 6, 30);
868: subject.decrementMonth();
869: CompositeDate expected = new CompositeDate(2006, 5, 30);
870: assertEquals(expected, subject);
871: }
872:
873: public void testDecrementMonth20060731() throws Exception {
874: CompositeDate subject = new CompositeDate(2006, 7, 31);
875: subject.decrementMonth();
876: CompositeDate expected = new CompositeDate(2006, 6, 30);
877: assertEquals(expected, subject);
878: }
879:
880: public void testDecrementMonth20060831() throws Exception {
881: CompositeDate subject = new CompositeDate(2006, 8, 31);
882: subject.decrementMonth();
883: CompositeDate expected = new CompositeDate(2006, 7, 31);
884: assertEquals(expected, subject);
885: }
886:
887: public void testDecrementMonth20060930() throws Exception {
888: CompositeDate subject = new CompositeDate(2006, 9, 30);
889: subject.decrementMonth();
890: CompositeDate expected = new CompositeDate(2006, 8, 30);
891: assertEquals(expected, subject);
892: }
893:
894: public void testDecrementMonth20061031() throws Exception {
895: CompositeDate subject = new CompositeDate(2006, 10, 31);
896: subject.decrementMonth();
897: CompositeDate expected = new CompositeDate(2006, 9, 30);
898: assertEquals(expected, subject);
899: }
900:
901: public void testDecrementMonth20061130() throws Exception {
902: CompositeDate subject = new CompositeDate(2006, 11, 30);
903: subject.decrementMonth();
904: CompositeDate expected = new CompositeDate(2006, 10, 30);
905: assertEquals(expected, subject);
906: }
907:
908: public void testDecrementMonth20061231() throws Exception {
909: CompositeDate subject = new CompositeDate(2006, 12, 31);
910: subject.decrementMonth();
911: CompositeDate expected = new CompositeDate(2006, 11, 30);
912: assertEquals(expected, subject);
913: }
914:
915: public void testDecrementYear20060101() throws Exception {
916: CompositeDate subject = new CompositeDate(2006, 1, 1);
917: subject.decrementYear();
918: CompositeDate expected = new CompositeDate(2005, 1, 1);
919: assertEquals(expected, subject);
920: }
921:
922: public void testDecrementYear20061231() throws Exception {
923: CompositeDate subject = new CompositeDate(2006, 12, 31);
924: subject.decrementYear();
925: CompositeDate expected = new CompositeDate(2005, 12, 31);
926: assertEquals(expected, subject);
927: }
928:
929: public void testDecrementYearMinValue1231() throws Exception {
930: CompositeDate subject = new CompositeDate(-2147483648, 12, 31);
931: try {
932: subject.decrementYear();
933: fail("Exception not thrown");
934: } catch (DateUnderflowException ex) {
935: }
936: }
937:
938: public void testDecrementYear20040229() throws Exception {
939: CompositeDate subject = new CompositeDate(2004, 2, 29);
940: subject.decrementYear();
941: CompositeDate expected = new CompositeDate(2003, 2, 28);
942: assertEquals(expected, subject);
943: }
944:
945: }
|