KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > joda > time > TestLocalDate_Properties


1 /*
2  * Copyright 2001-2006 Stephen Colebourne
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.joda.time;
17
18 import java.util.Locale JavaDoc;
19
20 import junit.framework.TestCase;
21 import junit.framework.TestSuite;
22
23 import org.joda.time.chrono.CopticChronology;
24 import org.joda.time.chrono.LenientChronology;
25 import org.joda.time.chrono.StrictChronology;
26
27 /**
28  * This class is a Junit unit test for YearMonthDay.
29  *
30  * @author Stephen Colebourne
31  */

32 public class TestLocalDate_Properties extends TestCase {
33
34     private static final DateTimeZone PARIS = DateTimeZone.forID("Europe/Paris");
35     private static final Chronology COPTIC_PARIS = CopticChronology.getInstance(PARIS);
36
37     private long TEST_TIME_NOW =
38             (31L + 28L + 31L + 30L + 31L + 9L -1L) * DateTimeConstants.MILLIS_PER_DAY;
39             
40     private long TEST_TIME1 =
41         (31L + 28L + 31L + 6L -1L) * DateTimeConstants.MILLIS_PER_DAY
42         + 12L * DateTimeConstants.MILLIS_PER_HOUR
43         + 24L * DateTimeConstants.MILLIS_PER_MINUTE;
44         
45     private long TEST_TIME2 =
46         (365L + 31L + 28L + 31L + 30L + 7L -1L) * DateTimeConstants.MILLIS_PER_DAY
47         + 14L * DateTimeConstants.MILLIS_PER_HOUR
48         + 28L * DateTimeConstants.MILLIS_PER_MINUTE;
49         
50     private DateTimeZone zone = null;
51
52     public static void main(String JavaDoc[] args) {
53         junit.textui.TestRunner.run(suite());
54     }
55
56     public static TestSuite suite() {
57         return new TestSuite(TestLocalDate_Properties.class);
58     }
59
60     public TestLocalDate_Properties(String JavaDoc name) {
61         super(name);
62     }
63
64     protected void setUp() throws Exception JavaDoc {
65         DateTimeUtils.setCurrentMillisFixed(TEST_TIME_NOW);
66         zone = DateTimeZone.getDefault();
67         DateTimeZone.setDefault(DateTimeZone.UTC);
68     }
69
70     protected void tearDown() throws Exception JavaDoc {
71         DateTimeUtils.setCurrentMillisSystem();
72         DateTimeZone.setDefault(zone);
73         zone = null;
74     }
75
76     //-----------------------------------------------------------------------
77
public void testPropertyGetYear() {
78         LocalDate test = new LocalDate(1972, 6, 9);
79         assertSame(test.getChronology().year(), test.year().getField());
80         assertEquals("year", test.year().getName());
81         assertEquals("Property[year]", test.year().toString());
82         assertSame(test, test.year().getLocalDate());
83         assertEquals(1972, test.year().get());
84         assertEquals("1972", test.year().getAsString());
85         assertEquals("1972", test.year().getAsText());
86         assertEquals("1972", test.year().getAsText(Locale.FRENCH));
87         assertEquals("1972", test.year().getAsShortText());
88         assertEquals("1972", test.year().getAsShortText(Locale.FRENCH));
89         assertEquals(test.getChronology().years(), test.year().getDurationField());
90         assertEquals(null, test.year().getRangeDurationField());
91         assertEquals(9, test.year().getMaximumTextLength(null));
92         assertEquals(9, test.year().getMaximumShortTextLength(null));
93     }
94
95     public void testPropertyGetMaxMinValuesYear() {
96         LocalDate test = new LocalDate(1972, 6, 9);
97         assertEquals(-292275054, test.year().getMinimumValue());
98         assertEquals(-292275054, test.year().getMinimumValueOverall());
99         assertEquals(292278993, test.year().getMaximumValue());
100         assertEquals(292278993, test.year().getMaximumValueOverall());
101     }
102
103     public void testPropertyAddToCopyYear() {
104         LocalDate test = new LocalDate(1972, 6, 9);
105         LocalDate copy = test.year().addToCopy(9);
106         check(test, 1972, 6, 9);
107         check(copy, 1981, 6, 9);
108         
109         copy = test.year().addToCopy(0);
110         check(copy, 1972, 6, 9);
111         
112         copy = test.year().addToCopy(292278993 - 1972);
113         check(copy, 292278993, 6, 9);
114         
115         try {
116             test.year().addToCopy(292278993 - 1972 + 1);
117             fail();
118         } catch (IllegalArgumentException JavaDoc ex) {}
119         check(test, 1972, 6, 9);
120         
121         copy = test.year().addToCopy(-1972);
122         check(copy, 0, 6, 9);
123         
124         copy = test.year().addToCopy(-1973);
125         check(copy, -1, 6, 9);
126         
127         try {
128             test.year().addToCopy(-292275054 - 1972 - 1);
129             fail();
130         } catch (IllegalArgumentException JavaDoc ex) {}
131         check(test, 1972, 6, 9);
132     }
133
134     public void testPropertyAddWrapFieldToCopyYear() {
135         LocalDate test = new LocalDate(1972, 6, 9);
136         LocalDate copy = test.year().addWrapFieldToCopy(9);
137         check(test, 1972, 6, 9);
138         check(copy, 1981, 6, 9);
139         
140         copy = test.year().addWrapFieldToCopy(0);
141         check(copy, 1972, 6, 9);
142         
143         copy = test.year().addWrapFieldToCopy(292278993 - 1972 + 1);
144         check(copy, -292275054, 6, 9);
145         
146         copy = test.year().addWrapFieldToCopy(-292275054 - 1972 - 1);
147         check(copy, 292278993, 6, 9);
148     }
149
150     public void testPropertySetCopyYear() {
151         LocalDate test = new LocalDate(1972, 6, 9);
152         LocalDate copy = test.year().setCopy(12);
153         check(test, 1972, 6, 9);
154         check(copy, 12, 6, 9);
155     }
156
157     public void testPropertySetCopyTextYear() {
158         LocalDate test = new LocalDate(1972, 6, 9);
159         LocalDate copy = test.year().setCopy("12");
160         check(test, 1972, 6, 9);
161         check(copy, 12, 6, 9);
162     }
163
164     public void testPropertyCompareToYear() {
165         LocalDate test1 = new LocalDate(TEST_TIME1);
166         LocalDate test2 = new LocalDate(TEST_TIME2);
167         assertEquals(true, test1.year().compareTo(test2) < 0);
168         assertEquals(true, test2.year().compareTo(test1) > 0);
169         assertEquals(true, test1.year().compareTo(test1) == 0);
170         try {
171             test1.year().compareTo((ReadablePartial) null);
172             fail();
173         } catch (IllegalArgumentException JavaDoc ex) {}
174         
175         DateTime dt1 = new DateTime(TEST_TIME1);
176         DateTime dt2 = new DateTime(TEST_TIME2);
177         assertEquals(true, test1.year().compareTo(dt2) < 0);
178         assertEquals(true, test2.year().compareTo(dt1) > 0);
179         assertEquals(true, test1.year().compareTo(dt1) == 0);
180         try {
181             test1.year().compareTo((ReadableInstant) null);
182             fail();
183         } catch (IllegalArgumentException JavaDoc ex) {}
184     }
185
186     //-----------------------------------------------------------------------
187
public void testPropertyGetMonth() {
188         LocalDate test = new LocalDate(1972, 6, 9);
189         assertSame(test.getChronology().monthOfYear(), test.monthOfYear().getField());
190         assertEquals("monthOfYear", test.monthOfYear().getName());
191         assertEquals("Property[monthOfYear]", test.monthOfYear().toString());
192         assertSame(test, test.monthOfYear().getLocalDate());
193         assertEquals(6, test.monthOfYear().get());
194         assertEquals("6", test.monthOfYear().getAsString());
195         assertEquals("June", test.monthOfYear().getAsText());
196         assertEquals("juin", test.monthOfYear().getAsText(Locale.FRENCH));
197         assertEquals("Jun", test.monthOfYear().getAsShortText());
198         assertEquals("juin", test.monthOfYear().getAsShortText(Locale.FRENCH));
199         assertEquals(test.getChronology().months(), test.monthOfYear().getDurationField());
200         assertEquals(test.getChronology().years(), test.monthOfYear().getRangeDurationField());
201         assertEquals(9, test.monthOfYear().getMaximumTextLength(null));
202         assertEquals(3, test.monthOfYear().getMaximumShortTextLength(null));
203         test = new LocalDate(1972, 7, 9);
204         assertEquals("juillet", test.monthOfYear().getAsText(Locale.FRENCH));
205         assertEquals("juil.", test.monthOfYear().getAsShortText(Locale.FRENCH));
206     }
207
208     public void testPropertyGetMaxMinValuesMonth() {
209         LocalDate test = new LocalDate(1972, 6, 9);
210         assertEquals(1, test.monthOfYear().getMinimumValue());
211         assertEquals(1, test.monthOfYear().getMinimumValueOverall());
212         assertEquals(12, test.monthOfYear().getMaximumValue());
213         assertEquals(12, test.monthOfYear().getMaximumValueOverall());
214     }
215
216     public void testPropertyAddToCopyMonth() {
217         LocalDate test = new LocalDate(1972, 6, 9);
218         LocalDate copy = test.monthOfYear().addToCopy(6);
219         check(test, 1972, 6, 9);
220         check(copy, 1972, 12, 9);
221         
222         copy = test.monthOfYear().addToCopy(7);
223         check(copy, 1973, 1, 9);
224         
225         copy = test.monthOfYear().addToCopy(-5);
226         check(copy, 1972, 1, 9);
227         
228         copy = test.monthOfYear().addToCopy(-6);
229         check(copy, 1971, 12, 9);
230         
231         test = new LocalDate(1972, 1, 31);
232         copy = test.monthOfYear().addToCopy(1);
233         check(copy, 1972, 2, 29);
234         
235         copy = test.monthOfYear().addToCopy(2);
236         check(copy, 1972, 3, 31);
237         
238         copy = test.monthOfYear().addToCopy(3);
239         check(copy, 1972, 4, 30);
240         
241         test = new LocalDate(1971, 1, 31);
242         copy = test.monthOfYear().addToCopy(1);
243         check(copy, 1971, 2, 28);
244     }
245
246     public void testPropertyAddWrapFieldToCopyMonth() {
247         LocalDate test = new LocalDate(1972, 6, 9);
248         LocalDate copy = test.monthOfYear().addWrapFieldToCopy(4);
249         check(test, 1972, 6, 9);
250         check(copy, 1972, 10, 9);
251         
252         copy = test.monthOfYear().addWrapFieldToCopy(8);
253         check(copy, 1972, 2, 9);
254         
255         copy = test.monthOfYear().addWrapFieldToCopy(-8);
256         check(copy, 1972, 10, 9);
257         
258         test = new LocalDate(1972, 1, 31);
259         copy = test.monthOfYear().addWrapFieldToCopy(1);
260         check(copy, 1972, 2, 29);
261         
262         copy = test.monthOfYear().addWrapFieldToCopy(2);
263         check(copy, 1972, 3, 31);
264         
265         copy = test.monthOfYear().addWrapFieldToCopy(3);
266         check(copy, 1972, 4, 30);
267         
268         test = new LocalDate(1971, 1, 31);
269         copy = test.monthOfYear().addWrapFieldToCopy(1);
270         check(copy, 1971, 2, 28);
271     }
272
273     public void testPropertySetCopyMonth() {
274         LocalDate test = new LocalDate(1972, 6, 9);
275         LocalDate copy = test.monthOfYear().setCopy(12);
276         check(test, 1972, 6, 9);
277         check(copy, 1972, 12, 9);
278         
279         test = new LocalDate(1972, 1, 31);
280         copy = test.monthOfYear().setCopy(2);
281         check(copy, 1972, 2, 29);
282         
283         try {
284             test.monthOfYear().setCopy(13);
285             fail();
286         } catch (IllegalArgumentException JavaDoc ex) {}
287         try {
288             test.monthOfYear().setCopy(0);
289             fail();
290         } catch (IllegalArgumentException JavaDoc ex) {}
291     }
292
293     public void testPropertySetCopyTextMonth() {
294         LocalDate test = new LocalDate(1972, 6, 9);
295         LocalDate copy = test.monthOfYear().setCopy("12");
296         check(test, 1972, 6, 9);
297         check(copy, 1972, 12, 9);
298         
299         copy = test.monthOfYear().setCopy("December");
300         check(test, 1972, 6, 9);
301         check(copy, 1972, 12, 9);
302         
303         copy = test.monthOfYear().setCopy("Dec");
304         check(test, 1972, 6, 9);
305         check(copy, 1972, 12, 9);
306     }
307
308     public void testPropertyCompareToMonth() {
309         LocalDate test1 = new LocalDate(TEST_TIME1);
310         LocalDate test2 = new LocalDate(TEST_TIME2);
311         assertEquals(true, test1.monthOfYear().compareTo(test2) < 0);
312         assertEquals(true, test2.monthOfYear().compareTo(test1) > 0);
313         assertEquals(true, test1.monthOfYear().compareTo(test1) == 0);
314         try {
315             test1.monthOfYear().compareTo((ReadablePartial) null);
316             fail();
317         } catch (IllegalArgumentException JavaDoc ex) {}
318         
319         DateTime dt1 = new DateTime(TEST_TIME1);
320         DateTime dt2 = new DateTime(TEST_TIME2);
321         assertEquals(true, test1.monthOfYear().compareTo(dt2) < 0);
322         assertEquals(true, test2.monthOfYear().compareTo(dt1) > 0);
323         assertEquals(true, test1.monthOfYear().compareTo(dt1) == 0);
324         try {
325             test1.monthOfYear().compareTo((ReadableInstant) null);
326             fail();
327         } catch (IllegalArgumentException JavaDoc ex) {}
328     }
329
330     //-----------------------------------------------------------------------
331
public void testPropertyGetDay() {
332         LocalDate test = new LocalDate(1972, 6, 9);
333         assertSame(test.getChronology().dayOfMonth(), test.dayOfMonth().getField());
334         assertEquals("dayOfMonth", test.dayOfMonth().getName());
335         assertEquals("Property[dayOfMonth]", test.dayOfMonth().toString());
336         assertSame(test, test.dayOfMonth().getLocalDate());
337         assertEquals(9, test.dayOfMonth().get());
338         assertEquals("9", test.dayOfMonth().getAsString());
339         assertEquals("9", test.dayOfMonth().getAsText());
340         assertEquals("9", test.dayOfMonth().getAsText(Locale.FRENCH));
341         assertEquals("9", test.dayOfMonth().getAsShortText());
342         assertEquals("9", test.dayOfMonth().getAsShortText(Locale.FRENCH));
343         assertEquals(test.getChronology().days(), test.dayOfMonth().getDurationField());
344         assertEquals(test.getChronology().months(), test.dayOfMonth().getRangeDurationField());
345         assertEquals(2, test.dayOfMonth().getMaximumTextLength(null));
346         assertEquals(2, test.dayOfMonth().getMaximumShortTextLength(null));
347     }
348
349     public void testPropertyGetMaxMinValuesDay() {
350         LocalDate test = new LocalDate(1972, 6, 9);
351         assertEquals(1, test.dayOfMonth().getMinimumValue());
352         assertEquals(1, test.dayOfMonth().getMinimumValueOverall());
353         assertEquals(30, test.dayOfMonth().getMaximumValue());
354         assertEquals(31, test.dayOfMonth().getMaximumValueOverall());
355         test = new LocalDate(1972, 7, 9);
356         assertEquals(31, test.dayOfMonth().getMaximumValue());
357         test = new LocalDate(1972, 2, 9);
358         assertEquals(29, test.dayOfMonth().getMaximumValue());
359         test = new LocalDate(1971, 2, 9);
360         assertEquals(28, test.dayOfMonth().getMaximumValue());
361     }
362
363     public void testPropertyAddToCopyDay() {
364         LocalDate test = new LocalDate(1972, 6, 9);
365         LocalDate copy = test.dayOfMonth().addToCopy(9);
366         check(test, 1972, 6, 9);
367         check(copy, 1972, 6, 18);
368         
369         copy = test.dayOfMonth().addToCopy(21);
370         check(copy, 1972, 6, 30);
371         
372         copy = test.dayOfMonth().addToCopy(22);
373         check(copy, 1972, 7, 1);
374         
375         copy = test.dayOfMonth().addToCopy(22 + 30);
376         check(copy, 1972, 7, 31);
377         
378         copy = test.dayOfMonth().addToCopy(22 + 31);
379         check(copy, 1972, 8, 1);
380
381         copy = test.dayOfMonth().addToCopy(21 + 31 + 31 + 30 + 31 + 30 + 31);
382         check(copy, 1972, 12, 31);
383         
384         copy = test.dayOfMonth().addToCopy(22 + 31 + 31 + 30 + 31 + 30 + 31);
385         check(copy, 1973, 1, 1);
386         
387         copy = test.dayOfMonth().addToCopy(-8);
388         check(copy, 1972, 6, 1);
389         
390         copy = test.dayOfMonth().addToCopy(-9);
391         check(copy, 1972, 5, 31);
392         
393         copy = test.dayOfMonth().addToCopy(-8 - 31 - 30 - 31 - 29 - 31);
394         check(copy, 1972, 1, 1);
395         
396         copy = test.dayOfMonth().addToCopy(-9 - 31 - 30 - 31 - 29 - 31);
397         check(copy, 1971, 12, 31);
398     }
399
400     public void testPropertyAddWrapFieldToCopyDay() {
401         LocalDate test = new LocalDate(1972, 6, 9);
402         LocalDate copy = test.dayOfMonth().addWrapFieldToCopy(21);
403         check(test, 1972, 6, 9);
404         check(copy, 1972, 6, 30);
405         
406         copy = test.dayOfMonth().addWrapFieldToCopy(22);
407         check(copy, 1972, 6, 1);
408         
409         copy = test.dayOfMonth().addWrapFieldToCopy(-12);
410         check(copy, 1972, 6, 27);
411         
412         test = new LocalDate(1972, 7, 9);
413         copy = test.dayOfMonth().addWrapFieldToCopy(21);
414         check(copy, 1972, 7, 30);
415     
416         copy = test.dayOfMonth().addWrapFieldToCopy(22);
417         check(copy, 1972, 7, 31);
418     
419         copy = test.dayOfMonth().addWrapFieldToCopy(23);
420         check(copy, 1972, 7, 1);
421     
422         copy = test.dayOfMonth().addWrapFieldToCopy(-12);
423         check(copy, 1972, 7, 28);
424     }
425
426     public void testPropertySetCopyDay() {
427         LocalDate test = new LocalDate(1972, 6, 9);
428         LocalDate copy = test.dayOfMonth().setCopy(12);
429         check(test, 1972, 6, 9);
430         check(copy, 1972, 6, 12);
431         
432         try {
433             test.dayOfMonth().setCopy(31);
434             fail();
435         } catch (IllegalArgumentException JavaDoc ex) {}
436         try {
437             test.dayOfMonth().setCopy(0);
438             fail();
439         } catch (IllegalArgumentException JavaDoc ex) {}
440     }
441
442     public void testPropertySetCopyTextDay() {
443         LocalDate test = new LocalDate(1972, 6, 9);
444         LocalDate copy = test.dayOfMonth().setCopy("12");
445         check(test, 1972, 6, 9);
446         check(copy, 1972, 6, 12);
447     }
448
449     public void testPropertyWithMaximumValueDayOfMonth() {
450         LocalDate test = new LocalDate(1972, 6, 9);
451         LocalDate copy = test.dayOfMonth().withMaximumValue();
452         check(test, 1972, 6, 9);
453         check(copy, 1972, 6, 30);
454     }
455
456     public void testPropertyWithMinimumValueDayOfMonth() {
457         LocalDate test = new LocalDate(1972, 6, 9);
458         LocalDate copy = test.dayOfMonth().withMinimumValue();
459         check(test, 1972, 6, 9);
460         check(copy, 1972, 6, 1);
461     }
462
463     public void testPropertyCompareToDay() {
464         LocalDate test1 = new LocalDate(TEST_TIME1);
465         LocalDate test2 = new LocalDate(TEST_TIME2);
466         assertEquals(true, test1.dayOfMonth().compareTo(test2) < 0);
467         assertEquals(true, test2.dayOfMonth().compareTo(test1) > 0);
468         assertEquals(true, test1.dayOfMonth().compareTo(test1) == 0);
469         try {
470             test1.dayOfMonth().compareTo((ReadablePartial) null);
471             fail();
472         } catch (IllegalArgumentException JavaDoc ex) {}
473         
474         DateTime dt1 = new DateTime(TEST_TIME1);
475         DateTime dt2 = new DateTime(TEST_TIME2);
476         assertEquals(true, test1.dayOfMonth().compareTo(dt2) < 0);
477         assertEquals(true, test2.dayOfMonth().compareTo(dt1) > 0);
478         assertEquals(true, test1.dayOfMonth().compareTo(dt1) == 0);
479         try {
480             test1.dayOfMonth().compareTo((ReadableInstant) null);
481             fail();
482         } catch (IllegalArgumentException JavaDoc ex) {}
483     }
484
485     public void testPropertyEquals() {
486         LocalDate test1 = new LocalDate(2005, 11, 8);
487         LocalDate test2 = new LocalDate(2005, 11, 9);
488         LocalDate test3 = new LocalDate(2005, 11, 8, CopticChronology.getInstanceUTC());
489         assertEquals(false, test1.dayOfMonth().equals(test1.year()));
490         assertEquals(false, test1.dayOfMonth().equals(test1.monthOfYear()));
491         assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
492         assertEquals(false, test1.dayOfMonth().equals(test2.year()));
493         assertEquals(false, test1.dayOfMonth().equals(test2.monthOfYear()));
494         assertEquals(false, test1.dayOfMonth().equals(test2.dayOfMonth()));
495         
496         assertEquals(false, test1.monthOfYear().equals(test1.year()));
497         assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
498         assertEquals(false, test1.monthOfYear().equals(test1.dayOfMonth()));
499         assertEquals(false, test1.monthOfYear().equals(test2.year()));
500         assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
501         assertEquals(false, test1.monthOfYear().equals(test2.dayOfMonth()));
502         
503         assertEquals(false, test1.dayOfMonth().equals(null));
504         assertEquals(false, test1.dayOfMonth().equals("any"));
505         
506         // chrono
507
assertEquals(false, test1.dayOfMonth().equals(test3.dayOfMonth()));
508     }
509
510     public void testPropertyHashCode() {
511         LocalDate test1 = new LocalDate(2005, 11, 8);
512         LocalDate test2 = new LocalDate(2005, 11, 9);
513         assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
514         assertEquals(false, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
515         assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
516         assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
517     }
518
519     public void testPropertyEqualsHashCodeLenient() {
520         LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
521         LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
522         assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
523         assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
524         assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
525         assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
526         assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
527         assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
528         assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
529     }
530
531     public void testPropertyEqualsHashCodeStrict() {
532         LocalDate test1 = new LocalDate(1970, 6, 9, StrictChronology.getInstance(COPTIC_PARIS));
533         LocalDate test2 = new LocalDate(1970, 6, 9, StrictChronology.getInstance(COPTIC_PARIS));
534         assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
535         assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
536         assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
537         assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
538         assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
539         assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
540         assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
541     }
542
543     //-----------------------------------------------------------------------
544
private void check(LocalDate test, int year, int month, int day) {
545         assertEquals(year, test.getYear());
546         assertEquals(month, test.getMonthOfYear());
547         assertEquals(day, test.getDayOfMonth());
548     }
549 }
550
Popular Tags