123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
-
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class CalendarTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class CalendarTest
- {
- Calendar test;
-
- @Test
- public void addDayTest() {
- try{test = new Calendar(8,2,1985);}
- catch(DateException de){};
-
- test.addDay();
- assertTrue(test.day == 9);
-
- }
-
- @Test
- public void subDayTest() {
- try{test = new Calendar(8,2,1985);}
- catch(DateException de){};
-
- test.subDay();
- assertTrue(test.day == 7);
-
- }
-
- @Test
- public void addMonthTest() {
- try{test = new Calendar(8,2,1985);}
- catch(DateException de){};
-
- test.addMonth();
- assertTrue(test.month == 3);
-
- }
-
- @Test
- public void subMonthTest() {
- try{test = new Calendar(8,2,1985);}
- catch(DateException de){};
-
- test.subMonth();
- assertTrue(test.month == 1);
-
- }
-
- @Test
- public void addyearTest() {
- try{test = new Calendar(8,2,1985);}
- catch(DateException de){};
-
- test.addYear();
- assertTrue(test.year == 1986);
-
- }
-
- @Test
- public void subyearTest() {
- try{test = new Calendar(8,2,1985);}
- catch(DateException de){};
-
- test.subYear();
- assertTrue(test.year == 1984);
-
- }
- }
|