@@ -56,14 +56,6 @@ public void test_Getting_Calendar_information() {
5656
5757 @ Test
5858 public void test_Compare_Date_FirstDate_Greater_SecondDate () {
59- GregorianCalendarExample calendarDemo = new GregorianCalendarExample ();
60- GregorianCalendar firstDate = new GregorianCalendar (2018 , 6 , 28 );
61- GregorianCalendar secondDate = new GregorianCalendar (2018 , 5 , 28 );
62- assertTrue (1 == calendarDemo .compareDates (firstDate , secondDate ));
63- }
64-
65- @ Test
66- public void test_CompareFirstDateGreaterSecondDate () {
6759 GregorianCalendar firstDate = new GregorianCalendar (2018 , 6 , 28 );
6860 GregorianCalendar secondDate = new GregorianCalendar (2018 , 5 , 28 );
6961 assertTrue (1 == firstDate .compareTo (secondDate ));
@@ -72,29 +64,13 @@ public void test_CompareFirstDateGreaterSecondDate() {
7264
7365 @ Test
7466 public void test_Compare_Date_FirstDate_Smaller_SecondDate () {
75- GregorianCalendarExample calendarDemo = new GregorianCalendarExample ();
76- GregorianCalendar firstDate = new GregorianCalendar (2018 , 5 , 28 );
77- GregorianCalendar secondDate = new GregorianCalendar (2018 , 6 , 28 );
78- assertTrue (-1 == calendarDemo .compareDates (firstDate , secondDate ));
79- }
80-
81- @ Test
82- public void test_CompareFirstDateSmallerSecondDate () {
8367 GregorianCalendar firstDate = new GregorianCalendar (2018 , 5 , 28 );
8468 GregorianCalendar secondDate = new GregorianCalendar (2018 , 6 , 28 );
8569 assertTrue (-1 == firstDate .compareTo (secondDate ));
8670 }
8771
8872 @ Test
8973 public void test_Compare_Date_Both_Dates_Equal () {
90- GregorianCalendarExample calendarDemo = new GregorianCalendarExample ();
91- GregorianCalendar firstDate = new GregorianCalendar (2018 , 6 , 28 );
92- GregorianCalendar secondDate = new GregorianCalendar (2018 , 6 , 28 );
93- assertTrue (0 == calendarDemo .compareDates (firstDate , secondDate ));
94- }
95-
96- @ Test
97- public void test_CompareDatesEqual () {
9874 GregorianCalendar firstDate = new GregorianCalendar (2018 , 6 , 28 );
9975 GregorianCalendar secondDate = new GregorianCalendar (2018 , 6 , 28 );
10076 assertTrue (0 == firstDate .compareTo (secondDate ));
@@ -125,19 +101,24 @@ public void test_addDays() {
125101 }
126102
127103 @ Test
128- public void test_whenAddOneDay_thenMonthIsUnchanged () {
129- final int finalDay29 = 29 ;
130- GregorianCalendar calendarExpected = new GregorianCalendar (2018 , 6 , 28 );
104+ public void test_whenAddOneDay_thenMonthIsChanged () {
105+ final int finalDay1 = 1 ;
106+ final int finalMonthJul = 6 ;
107+ GregorianCalendar calendarExpected = new GregorianCalendar (2018 , 5 , 30 );
131108 calendarExpected .add (Calendar .DATE , 1 );
132- assertEquals (calendarExpected .get (Calendar .DATE ), finalDay29 );
109+ System .out .println (calendarExpected .getTime ());
110+ assertEquals (calendarExpected .get (Calendar .DATE ), finalDay1 );
111+ assertEquals (calendarExpected .get (Calendar .MONTH ), finalMonthJul );
133112 }
134113
135114 @ Test
136- public void test_whenSubtractOneDay_thenMonthIsUnchanged () {
137- final int finalDay27 = 27 ;
138- GregorianCalendar calendarExpected = new GregorianCalendar (2018 , 6 , 28 );
115+ public void test_whenSubtractOneDay_thenMonthIsChanged () {
116+ final int finalDay31 = 31 ;
117+ final int finalMonthMay = 4 ;
118+ GregorianCalendar calendarExpected = new GregorianCalendar (2018 , 5 , 1 );
139119 calendarExpected .add (Calendar .DATE , -1 );
140- assertEquals (calendarExpected .get (Calendar .DATE ), finalDay27 );
120+ assertEquals (calendarExpected .get (Calendar .DATE ), finalDay31 );
121+ assertEquals (calendarExpected .get (Calendar .MONTH ), finalMonthMay );
141122 }
142123
143124 @ Test
0 commit comments