|
@@ -5,7 +5,7 @@ |
5 |
5 |
|
|
6 |
6 |
|
import org.litesoft.core.typeutils.*; |
7 |
7 |
|
|
8 |
|
- |
public class CalendarYTest extends TestCase |
|
8 |
+ |
public class CalendarYTest extends AbstractTemporalTestSupport<CalendarY> |
9 |
9 |
|
{ |
10 |
10 |
|
public static TestSuite suite() |
11 |
11 |
|
{ |
|
@@ -126,25 +126,7 @@ |
126 |
126 |
|
CalendarY od = CalendarY.fromY( pDateY ); |
127 |
127 |
|
CalendarY nd = od.addYears( pAdjustBy ); |
128 |
128 |
|
assertEquals( pExpectedY, nd.toY() ); |
129 |
|
- |
if ( pAdjustBy == 0 ) |
130 |
|
- |
{ |
131 |
|
- |
assertTrue( od == nd ); |
132 |
|
- |
assertTrue( 0 == od.compareTo( nd ) ); |
133 |
|
- |
assertTrue( od.afterOrEqual( nd ) ); |
134 |
|
- |
assertTrue( od.beforeOrEqual( nd ) ); |
135 |
|
- |
} |
136 |
|
- |
else if ( pAdjustBy > 0 ) |
137 |
|
- |
{ |
138 |
|
- |
assertTrue( 0 > od.compareTo( nd ) ); |
139 |
|
- |
assertFalse( od.afterOrEqual( nd ) ); |
140 |
|
- |
assertTrue( od.beforeOrEqual( nd ) ); |
141 |
|
- |
} |
142 |
|
- |
else // pAdjustBy < 0 |
143 |
|
- |
{ |
144 |
|
- |
assertTrue( 0 < od.compareTo( nd ) ); |
145 |
|
- |
assertTrue( od.afterOrEqual( nd ) ); |
146 |
|
- |
assertFalse( od.beforeOrEqual( nd ) ); |
147 |
|
- |
} |
|
129 |
+ |
compareCheck( add( pAdjustBy ), od, nd ); |
148 |
130 |
|
} |
149 |
131 |
|
|
150 |
132 |
|
public void test_minusYears() |
|
@@ -160,47 +142,11 @@ |
160 |
142 |
|
CalendarY od = CalendarY.fromY( pDateY ); |
161 |
143 |
|
CalendarY nd = od.minusYears( pAdjustBy ); |
162 |
144 |
|
assertEquals( pExpectedY, nd.toY() ); |
163 |
|
- |
if ( pAdjustBy == 0 ) |
164 |
|
- |
{ |
165 |
|
- |
assertTrue( od == nd ); |
166 |
|
- |
assertTrue( 0 == od.compareTo( nd ) ); |
167 |
|
- |
assertTrue( od.afterOrEqual( nd ) ); |
168 |
|
- |
assertTrue( od.beforeOrEqual( nd ) ); |
169 |
|
- |
} |
170 |
|
- |
else if ( pAdjustBy < 0 ) |
171 |
|
- |
{ |
172 |
|
- |
assertTrue( 0 > od.compareTo( nd ) ); |
173 |
|
- |
assertFalse( od.afterOrEqual( nd ) ); |
174 |
|
- |
assertTrue( od.beforeOrEqual( nd ) ); |
175 |
|
- |
} |
176 |
|
- |
else // pAdjustBy > 0 |
177 |
|
- |
{ |
178 |
|
- |
assertTrue( 0 < od.compareTo( nd ) ); |
179 |
|
- |
assertTrue( od.afterOrEqual( nd ) ); |
180 |
|
- |
assertFalse( od.beforeOrEqual( nd ) ); |
181 |
|
- |
} |
|
145 |
+ |
compareCheck( minus( pAdjustBy ), od, nd ); |
182 |
146 |
|
} |
183 |
147 |
|
|
184 |
148 |
|
public void test_after_before_null() |
185 |
149 |
|
{ |
186 |
|
- |
CalendarY sd = new CalendarY( 2000 ); |
187 |
|
- |
try |
188 |
|
- |
{ |
189 |
|
- |
sd.afterOrEqual( null ); |
190 |
|
- |
fail( "Did Not fail on '" + sd + "': after( null )" ); |
191 |
|
- |
} |
192 |
|
- |
catch ( IllegalArgumentException expected ) |
193 |
|
- |
{ |
194 |
|
- |
// expected |
195 |
|
- |
} |
196 |
|
- |
try |
197 |
|
- |
{ |
198 |
|
- |
sd.beforeOrEqual( null ); |
199 |
|
- |
fail( "Did Not fail on '" + sd + "': before( null )" ); |
200 |
|
- |
} |
201 |
|
- |
catch ( IllegalArgumentException expected ) |
202 |
|
- |
{ |
203 |
|
- |
// expected |
204 |
|
- |
} |
|
150 |
+ |
chkAfterBeforeNull( new CalendarY( 2000 ) ); |
205 |
151 |
|
} |
206 |
152 |
|
} |