001 /*
002 * Copyright 2001-2010 Stephen Colebourne
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.joda.time;
017
018 import java.util.Locale;
019
020 import junit.framework.TestCase;
021 import junit.framework.TestSuite;
022
023 import org.joda.time.chrono.CopticChronology;
024 import org.joda.time.chrono.LenientChronology;
025 import org.joda.time.chrono.StrictChronology;
026
027 /**
028 * This class is a Junit unit test for YearMonthDay.
029 *
030 * @author Stephen Colebourne
031 */
032 public class TestLocalDate_Properties extends TestCase {
033
034 private static final DateTimeZone PARIS = DateTimeZone.forID("Europe/Paris");
035 private static final Chronology COPTIC_PARIS = CopticChronology.getInstance(PARIS);
036
037 private long TEST_TIME_NOW =
038 (31L + 28L + 31L + 30L + 31L + 9L -1L) * DateTimeConstants.MILLIS_PER_DAY;
039
040 private long TEST_TIME1 =
041 (31L + 28L + 31L + 6L -1L) * DateTimeConstants.MILLIS_PER_DAY
042 + 12L * DateTimeConstants.MILLIS_PER_HOUR
043 + 24L * DateTimeConstants.MILLIS_PER_MINUTE;
044
045 private long TEST_TIME2 =
046 (365L + 31L + 28L + 31L + 30L + 7L -1L) * DateTimeConstants.MILLIS_PER_DAY
047 + 14L * DateTimeConstants.MILLIS_PER_HOUR
048 + 28L * DateTimeConstants.MILLIS_PER_MINUTE;
049
050 private DateTimeZone zone = null;
051
052 private Locale systemDefaultLocale = null;
053
054 public static void main(String[] args) {
055 junit.textui.TestRunner.run(suite());
056 }
057
058 public static TestSuite suite() {
059 return new TestSuite(TestLocalDate_Properties.class);
060 }
061
062 public TestLocalDate_Properties(String name) {
063 super(name);
064 }
065
066 protected void setUp() throws Exception {
067 DateTimeUtils.setCurrentMillisFixed(TEST_TIME_NOW);
068 zone = DateTimeZone.getDefault();
069 DateTimeZone.setDefault(DateTimeZone.UTC);
070 systemDefaultLocale = Locale.getDefault();
071 Locale.setDefault(Locale.ENGLISH);
072 }
073
074 protected void tearDown() throws Exception {
075 DateTimeUtils.setCurrentMillisSystem();
076 DateTimeZone.setDefault(zone);
077 zone = null;
078 Locale.setDefault(systemDefaultLocale);
079 systemDefaultLocale = null;
080 }
081
082 //-----------------------------------------------------------------------
083 public void testPropertyGetYear() {
084 LocalDate test = new LocalDate(1972, 6, 9);
085 assertSame(test.getChronology().year(), test.year().getField());
086 assertEquals("year", test.year().getName());
087 assertEquals("Property[year]", test.year().toString());
088 assertSame(test, test.year().getLocalDate());
089 assertEquals(1972, test.year().get());
090 assertEquals("1972", test.year().getAsString());
091 assertEquals("1972", test.year().getAsText());
092 assertEquals("1972", test.year().getAsText(Locale.FRENCH));
093 assertEquals("1972", test.year().getAsShortText());
094 assertEquals("1972", test.year().getAsShortText(Locale.FRENCH));
095 assertEquals(test.getChronology().years(), test.year().getDurationField());
096 assertEquals(null, test.year().getRangeDurationField());
097 assertEquals(9, test.year().getMaximumTextLength(null));
098 assertEquals(9, test.year().getMaximumShortTextLength(null));
099 }
100
101 public void testPropertyGetMaxMinValuesYear() {
102 LocalDate test = new LocalDate(1972, 6, 9);
103 assertEquals(-292275054, test.year().getMinimumValue());
104 assertEquals(-292275054, test.year().getMinimumValueOverall());
105 assertEquals(292278993, test.year().getMaximumValue());
106 assertEquals(292278993, test.year().getMaximumValueOverall());
107 }
108
109 public void testPropertyAddToCopyYear() {
110 LocalDate test = new LocalDate(1972, 6, 9);
111 LocalDate copy = test.year().addToCopy(9);
112 check(test, 1972, 6, 9);
113 check(copy, 1981, 6, 9);
114
115 copy = test.year().addToCopy(0);
116 check(copy, 1972, 6, 9);
117
118 copy = test.year().addToCopy(292278993 - 1972);
119 check(copy, 292278993, 6, 9);
120
121 try {
122 test.year().addToCopy(292278993 - 1972 + 1);
123 fail();
124 } catch (IllegalArgumentException ex) {}
125 check(test, 1972, 6, 9);
126
127 copy = test.year().addToCopy(-1972);
128 check(copy, 0, 6, 9);
129
130 copy = test.year().addToCopy(-1973);
131 check(copy, -1, 6, 9);
132
133 try {
134 test.year().addToCopy(-292275054 - 1972 - 1);
135 fail();
136 } catch (IllegalArgumentException ex) {}
137 check(test, 1972, 6, 9);
138 }
139
140 public void testPropertyAddWrapFieldToCopyYear() {
141 LocalDate test = new LocalDate(1972, 6, 9);
142 LocalDate copy = test.year().addWrapFieldToCopy(9);
143 check(test, 1972, 6, 9);
144 check(copy, 1981, 6, 9);
145
146 copy = test.year().addWrapFieldToCopy(0);
147 check(copy, 1972, 6, 9);
148
149 copy = test.year().addWrapFieldToCopy(292278993 - 1972 + 1);
150 check(copy, -292275054, 6, 9);
151
152 copy = test.year().addWrapFieldToCopy(-292275054 - 1972 - 1);
153 check(copy, 292278993, 6, 9);
154 }
155
156 public void testPropertySetCopyYear() {
157 LocalDate test = new LocalDate(1972, 6, 9);
158 LocalDate copy = test.year().setCopy(12);
159 check(test, 1972, 6, 9);
160 check(copy, 12, 6, 9);
161 }
162
163 public void testPropertySetCopyTextYear() {
164 LocalDate test = new LocalDate(1972, 6, 9);
165 LocalDate copy = test.year().setCopy("12");
166 check(test, 1972, 6, 9);
167 check(copy, 12, 6, 9);
168 }
169
170 public void testPropertyCompareToYear() {
171 LocalDate test1 = new LocalDate(TEST_TIME1);
172 LocalDate test2 = new LocalDate(TEST_TIME2);
173 assertEquals(true, test1.year().compareTo(test2) < 0);
174 assertEquals(true, test2.year().compareTo(test1) > 0);
175 assertEquals(true, test1.year().compareTo(test1) == 0);
176 try {
177 test1.year().compareTo((ReadablePartial) null);
178 fail();
179 } catch (IllegalArgumentException ex) {}
180
181 DateTime dt1 = new DateTime(TEST_TIME1);
182 DateTime dt2 = new DateTime(TEST_TIME2);
183 assertEquals(true, test1.year().compareTo(dt2) < 0);
184 assertEquals(true, test2.year().compareTo(dt1) > 0);
185 assertEquals(true, test1.year().compareTo(dt1) == 0);
186 try {
187 test1.year().compareTo((ReadableInstant) null);
188 fail();
189 } catch (IllegalArgumentException ex) {}
190 }
191
192 //-----------------------------------------------------------------------
193 public void testPropertyGetMonth() {
194 LocalDate test = new LocalDate(1972, 6, 9);
195 assertSame(test.getChronology().monthOfYear(), test.monthOfYear().getField());
196 assertEquals("monthOfYear", test.monthOfYear().getName());
197 assertEquals("Property[monthOfYear]", test.monthOfYear().toString());
198 assertSame(test, test.monthOfYear().getLocalDate());
199 assertEquals(6, test.monthOfYear().get());
200 assertEquals("6", test.monthOfYear().getAsString());
201 assertEquals("June", test.monthOfYear().getAsText());
202 assertEquals("juin", test.monthOfYear().getAsText(Locale.FRENCH));
203 assertEquals("Jun", test.monthOfYear().getAsShortText());
204 assertEquals("juin", test.monthOfYear().getAsShortText(Locale.FRENCH));
205 assertEquals(test.getChronology().months(), test.monthOfYear().getDurationField());
206 assertEquals(test.getChronology().years(), test.monthOfYear().getRangeDurationField());
207 assertEquals(9, test.monthOfYear().getMaximumTextLength(null));
208 assertEquals(3, test.monthOfYear().getMaximumShortTextLength(null));
209 test = new LocalDate(1972, 7, 9);
210 assertEquals("juillet", test.monthOfYear().getAsText(Locale.FRENCH));
211 assertEquals("juil.", test.monthOfYear().getAsShortText(Locale.FRENCH));
212 }
213
214 public void testPropertyGetMaxMinValuesMonth() {
215 LocalDate test = new LocalDate(1972, 6, 9);
216 assertEquals(1, test.monthOfYear().getMinimumValue());
217 assertEquals(1, test.monthOfYear().getMinimumValueOverall());
218 assertEquals(12, test.monthOfYear().getMaximumValue());
219 assertEquals(12, test.monthOfYear().getMaximumValueOverall());
220 }
221
222 public void testPropertyAddToCopyMonth() {
223 LocalDate test = new LocalDate(1972, 6, 9);
224 LocalDate copy = test.monthOfYear().addToCopy(6);
225 check(test, 1972, 6, 9);
226 check(copy, 1972, 12, 9);
227
228 copy = test.monthOfYear().addToCopy(7);
229 check(copy, 1973, 1, 9);
230
231 copy = test.monthOfYear().addToCopy(-5);
232 check(copy, 1972, 1, 9);
233
234 copy = test.monthOfYear().addToCopy(-6);
235 check(copy, 1971, 12, 9);
236
237 test = new LocalDate(1972, 1, 31);
238 copy = test.monthOfYear().addToCopy(1);
239 check(copy, 1972, 2, 29);
240
241 copy = test.monthOfYear().addToCopy(2);
242 check(copy, 1972, 3, 31);
243
244 copy = test.monthOfYear().addToCopy(3);
245 check(copy, 1972, 4, 30);
246
247 test = new LocalDate(1971, 1, 31);
248 copy = test.monthOfYear().addToCopy(1);
249 check(copy, 1971, 2, 28);
250 }
251
252 public void testPropertyAddWrapFieldToCopyMonth() {
253 LocalDate test = new LocalDate(1972, 6, 9);
254 LocalDate copy = test.monthOfYear().addWrapFieldToCopy(4);
255 check(test, 1972, 6, 9);
256 check(copy, 1972, 10, 9);
257
258 copy = test.monthOfYear().addWrapFieldToCopy(8);
259 check(copy, 1972, 2, 9);
260
261 copy = test.monthOfYear().addWrapFieldToCopy(-8);
262 check(copy, 1972, 10, 9);
263
264 test = new LocalDate(1972, 1, 31);
265 copy = test.monthOfYear().addWrapFieldToCopy(1);
266 check(copy, 1972, 2, 29);
267
268 copy = test.monthOfYear().addWrapFieldToCopy(2);
269 check(copy, 1972, 3, 31);
270
271 copy = test.monthOfYear().addWrapFieldToCopy(3);
272 check(copy, 1972, 4, 30);
273
274 test = new LocalDate(1971, 1, 31);
275 copy = test.monthOfYear().addWrapFieldToCopy(1);
276 check(copy, 1971, 2, 28);
277 }
278
279 public void testPropertySetCopyMonth() {
280 LocalDate test = new LocalDate(1972, 6, 9);
281 LocalDate copy = test.monthOfYear().setCopy(12);
282 check(test, 1972, 6, 9);
283 check(copy, 1972, 12, 9);
284
285 test = new LocalDate(1972, 1, 31);
286 copy = test.monthOfYear().setCopy(2);
287 check(copy, 1972, 2, 29);
288
289 try {
290 test.monthOfYear().setCopy(13);
291 fail();
292 } catch (IllegalArgumentException ex) {}
293 try {
294 test.monthOfYear().setCopy(0);
295 fail();
296 } catch (IllegalArgumentException ex) {}
297 }
298
299 public void testPropertySetCopyTextMonth() {
300 LocalDate test = new LocalDate(1972, 6, 9);
301 LocalDate copy = test.monthOfYear().setCopy("12");
302 check(test, 1972, 6, 9);
303 check(copy, 1972, 12, 9);
304
305 copy = test.monthOfYear().setCopy("December");
306 check(test, 1972, 6, 9);
307 check(copy, 1972, 12, 9);
308
309 copy = test.monthOfYear().setCopy("Dec");
310 check(test, 1972, 6, 9);
311 check(copy, 1972, 12, 9);
312 }
313
314 public void testPropertyCompareToMonth() {
315 LocalDate test1 = new LocalDate(TEST_TIME1);
316 LocalDate test2 = new LocalDate(TEST_TIME2);
317 assertEquals(true, test1.monthOfYear().compareTo(test2) < 0);
318 assertEquals(true, test2.monthOfYear().compareTo(test1) > 0);
319 assertEquals(true, test1.monthOfYear().compareTo(test1) == 0);
320 try {
321 test1.monthOfYear().compareTo((ReadablePartial) null);
322 fail();
323 } catch (IllegalArgumentException ex) {}
324
325 DateTime dt1 = new DateTime(TEST_TIME1);
326 DateTime dt2 = new DateTime(TEST_TIME2);
327 assertEquals(true, test1.monthOfYear().compareTo(dt2) < 0);
328 assertEquals(true, test2.monthOfYear().compareTo(dt1) > 0);
329 assertEquals(true, test1.monthOfYear().compareTo(dt1) == 0);
330 try {
331 test1.monthOfYear().compareTo((ReadableInstant) null);
332 fail();
333 } catch (IllegalArgumentException ex) {}
334 }
335
336 //-----------------------------------------------------------------------
337 public void testPropertyGetDay() {
338 LocalDate test = new LocalDate(1972, 6, 9);
339 assertSame(test.getChronology().dayOfMonth(), test.dayOfMonth().getField());
340 assertEquals("dayOfMonth", test.dayOfMonth().getName());
341 assertEquals("Property[dayOfMonth]", test.dayOfMonth().toString());
342 assertSame(test, test.dayOfMonth().getLocalDate());
343 assertEquals(9, test.dayOfMonth().get());
344 assertEquals("9", test.dayOfMonth().getAsString());
345 assertEquals("9", test.dayOfMonth().getAsText());
346 assertEquals("9", test.dayOfMonth().getAsText(Locale.FRENCH));
347 assertEquals("9", test.dayOfMonth().getAsShortText());
348 assertEquals("9", test.dayOfMonth().getAsShortText(Locale.FRENCH));
349 assertEquals(test.getChronology().days(), test.dayOfMonth().getDurationField());
350 assertEquals(test.getChronology().months(), test.dayOfMonth().getRangeDurationField());
351 assertEquals(2, test.dayOfMonth().getMaximumTextLength(null));
352 assertEquals(2, test.dayOfMonth().getMaximumShortTextLength(null));
353 }
354
355 public void testPropertyGetMaxMinValuesDay() {
356 LocalDate test = new LocalDate(1972, 6, 9);
357 assertEquals(1, test.dayOfMonth().getMinimumValue());
358 assertEquals(1, test.dayOfMonth().getMinimumValueOverall());
359 assertEquals(30, test.dayOfMonth().getMaximumValue());
360 assertEquals(31, test.dayOfMonth().getMaximumValueOverall());
361 test = new LocalDate(1972, 7, 9);
362 assertEquals(31, test.dayOfMonth().getMaximumValue());
363 test = new LocalDate(1972, 2, 9);
364 assertEquals(29, test.dayOfMonth().getMaximumValue());
365 test = new LocalDate(1971, 2, 9);
366 assertEquals(28, test.dayOfMonth().getMaximumValue());
367 }
368
369 public void testPropertyAddToCopyDay() {
370 LocalDate test = new LocalDate(1972, 6, 9);
371 LocalDate copy = test.dayOfMonth().addToCopy(9);
372 check(test, 1972, 6, 9);
373 check(copy, 1972, 6, 18);
374
375 copy = test.dayOfMonth().addToCopy(21);
376 check(copy, 1972, 6, 30);
377
378 copy = test.dayOfMonth().addToCopy(22);
379 check(copy, 1972, 7, 1);
380
381 copy = test.dayOfMonth().addToCopy(22 + 30);
382 check(copy, 1972, 7, 31);
383
384 copy = test.dayOfMonth().addToCopy(22 + 31);
385 check(copy, 1972, 8, 1);
386
387 copy = test.dayOfMonth().addToCopy(21 + 31 + 31 + 30 + 31 + 30 + 31);
388 check(copy, 1972, 12, 31);
389
390 copy = test.dayOfMonth().addToCopy(22 + 31 + 31 + 30 + 31 + 30 + 31);
391 check(copy, 1973, 1, 1);
392
393 copy = test.dayOfMonth().addToCopy(-8);
394 check(copy, 1972, 6, 1);
395
396 copy = test.dayOfMonth().addToCopy(-9);
397 check(copy, 1972, 5, 31);
398
399 copy = test.dayOfMonth().addToCopy(-8 - 31 - 30 - 31 - 29 - 31);
400 check(copy, 1972, 1, 1);
401
402 copy = test.dayOfMonth().addToCopy(-9 - 31 - 30 - 31 - 29 - 31);
403 check(copy, 1971, 12, 31);
404 }
405
406 public void testPropertyAddWrapFieldToCopyDay() {
407 LocalDate test = new LocalDate(1972, 6, 9);
408 LocalDate copy = test.dayOfMonth().addWrapFieldToCopy(21);
409 check(test, 1972, 6, 9);
410 check(copy, 1972, 6, 30);
411
412 copy = test.dayOfMonth().addWrapFieldToCopy(22);
413 check(copy, 1972, 6, 1);
414
415 copy = test.dayOfMonth().addWrapFieldToCopy(-12);
416 check(copy, 1972, 6, 27);
417
418 test = new LocalDate(1972, 7, 9);
419 copy = test.dayOfMonth().addWrapFieldToCopy(21);
420 check(copy, 1972, 7, 30);
421
422 copy = test.dayOfMonth().addWrapFieldToCopy(22);
423 check(copy, 1972, 7, 31);
424
425 copy = test.dayOfMonth().addWrapFieldToCopy(23);
426 check(copy, 1972, 7, 1);
427
428 copy = test.dayOfMonth().addWrapFieldToCopy(-12);
429 check(copy, 1972, 7, 28);
430 }
431
432 public void testPropertySetCopyDay() {
433 LocalDate test = new LocalDate(1972, 6, 9);
434 LocalDate copy = test.dayOfMonth().setCopy(12);
435 check(test, 1972, 6, 9);
436 check(copy, 1972, 6, 12);
437
438 try {
439 test.dayOfMonth().setCopy(31);
440 fail();
441 } catch (IllegalArgumentException ex) {}
442 try {
443 test.dayOfMonth().setCopy(0);
444 fail();
445 } catch (IllegalArgumentException ex) {}
446 }
447
448 public void testPropertySetCopyTextDay() {
449 LocalDate test = new LocalDate(1972, 6, 9);
450 LocalDate copy = test.dayOfMonth().setCopy("12");
451 check(test, 1972, 6, 9);
452 check(copy, 1972, 6, 12);
453 }
454
455 public void testPropertyWithMaximumValueDayOfMonth() {
456 LocalDate test = new LocalDate(1972, 6, 9);
457 LocalDate copy = test.dayOfMonth().withMaximumValue();
458 check(test, 1972, 6, 9);
459 check(copy, 1972, 6, 30);
460 }
461
462 public void testPropertyWithMinimumValueDayOfMonth() {
463 LocalDate test = new LocalDate(1972, 6, 9);
464 LocalDate copy = test.dayOfMonth().withMinimumValue();
465 check(test, 1972, 6, 9);
466 check(copy, 1972, 6, 1);
467 }
468
469 public void testPropertyCompareToDay() {
470 LocalDate test1 = new LocalDate(TEST_TIME1);
471 LocalDate test2 = new LocalDate(TEST_TIME2);
472 assertEquals(true, test1.dayOfMonth().compareTo(test2) < 0);
473 assertEquals(true, test2.dayOfMonth().compareTo(test1) > 0);
474 assertEquals(true, test1.dayOfMonth().compareTo(test1) == 0);
475 try {
476 test1.dayOfMonth().compareTo((ReadablePartial) null);
477 fail();
478 } catch (IllegalArgumentException ex) {}
479
480 DateTime dt1 = new DateTime(TEST_TIME1);
481 DateTime dt2 = new DateTime(TEST_TIME2);
482 assertEquals(true, test1.dayOfMonth().compareTo(dt2) < 0);
483 assertEquals(true, test2.dayOfMonth().compareTo(dt1) > 0);
484 assertEquals(true, test1.dayOfMonth().compareTo(dt1) == 0);
485 try {
486 test1.dayOfMonth().compareTo((ReadableInstant) null);
487 fail();
488 } catch (IllegalArgumentException ex) {}
489 }
490
491 public void testPropertyEquals() {
492 LocalDate test1 = new LocalDate(2005, 11, 8);
493 LocalDate test2 = new LocalDate(2005, 11, 9);
494 LocalDate test3 = new LocalDate(2005, 11, 8, CopticChronology.getInstanceUTC());
495 assertEquals(false, test1.dayOfMonth().equals(test1.year()));
496 assertEquals(false, test1.dayOfMonth().equals(test1.monthOfYear()));
497 assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
498 assertEquals(false, test1.dayOfMonth().equals(test2.year()));
499 assertEquals(false, test1.dayOfMonth().equals(test2.monthOfYear()));
500 assertEquals(false, test1.dayOfMonth().equals(test2.dayOfMonth()));
501
502 assertEquals(false, test1.monthOfYear().equals(test1.year()));
503 assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
504 assertEquals(false, test1.monthOfYear().equals(test1.dayOfMonth()));
505 assertEquals(false, test1.monthOfYear().equals(test2.year()));
506 assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
507 assertEquals(false, test1.monthOfYear().equals(test2.dayOfMonth()));
508
509 assertEquals(false, test1.dayOfMonth().equals(null));
510 assertEquals(false, test1.dayOfMonth().equals("any"));
511
512 // chrono
513 assertEquals(false, test1.dayOfMonth().equals(test3.dayOfMonth()));
514 }
515
516 public void testPropertyHashCode() {
517 LocalDate test1 = new LocalDate(2005, 11, 8);
518 LocalDate test2 = new LocalDate(2005, 11, 9);
519 assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
520 assertEquals(false, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
521 assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
522 assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
523 }
524
525 public void testPropertyEqualsHashCodeLenient() {
526 LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
527 LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
528 assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
529 assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
530 assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
531 assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
532 assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
533 assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
534 assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
535 }
536
537 public void testPropertyEqualsHashCodeStrict() {
538 LocalDate test1 = new LocalDate(1970, 6, 9, StrictChronology.getInstance(COPTIC_PARIS));
539 LocalDate test2 = new LocalDate(1970, 6, 9, StrictChronology.getInstance(COPTIC_PARIS));
540 assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
541 assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
542 assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
543 assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
544 assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
545 assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
546 assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
547 }
548
549 //-----------------------------------------------------------------------
550 private void check(LocalDate test, int year, int month, int day) {
551 assertEquals(year, test.getYear());
552 assertEquals(month, test.getMonthOfYear());
553 assertEquals(day, test.getDayOfMonth());
554 }
555 }