org.joda.time.chrono.LenientChronology Java Examples

The following examples show how to use org.joda.time.chrono.LenientChronology. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testToString() {
    DateTimeZone paris = DateTimeZone.forID("Europe/Paris");
    ISOChronology isoParis = ISOChronology.getInstance(paris);
    
    assertEquals("ISOChronology[Europe/Paris]", isoParis.toString());
    assertEquals("GJChronology[Europe/Paris]", GJChronology.getInstance(paris).toString());
    assertEquals("GregorianChronology[Europe/Paris]", GregorianChronology.getInstance(paris).toString());
    assertEquals("JulianChronology[Europe/Paris]", JulianChronology.getInstance(paris).toString());
    assertEquals("BuddhistChronology[Europe/Paris]", BuddhistChronology.getInstance(paris).toString());
    assertEquals("CopticChronology[Europe/Paris]", CopticChronology.getInstance(paris).toString());
    assertEquals("EthiopicChronology[Europe/Paris]", EthiopicChronology.getInstance(paris).toString());
    assertEquals("IslamicChronology[Europe/Paris]", IslamicChronology.getInstance(paris).toString());
    
    assertEquals("LenientChronology[ISOChronology[Europe/Paris]]", LenientChronology.getInstance(isoParis).toString());
    assertEquals("StrictChronology[ISOChronology[Europe/Paris]]", StrictChronology.getInstance(isoParis).toString());
    assertEquals("LimitChronology[ISOChronology[Europe/Paris], NoLimit, NoLimit]", LimitChronology.getInstance(isoParis, null, null).toString());
    assertEquals("ZonedChronology[ISOChronology[UTC], Europe/Paris]", ZonedChronology.getInstance(isoParis, paris).toString());
}
 
Example #2
Source File: Interval.java    From program-ab with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static int getDaysBetween(final String date1, final String date2, String format){
    try {
        final DateTimeFormatter fmt =
                DateTimeFormat
                        .forPattern(format)
                        .withChronology(
                                LenientChronology.getInstance(
                                        GregorianChronology.getInstance()));
        return Days.daysBetween(
                fmt.parseDateTime(date1),
                fmt.parseDateTime(date2)
        ).getDays();
    } catch (Exception ex) {
        ex.printStackTrace();
        return 0;
    }
}
 
Example #3
Source File: Interval.java    From program-ab with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static int getMonthsBetween(final String date1, final String date2, String format){
    try {
    final DateTimeFormatter fmt =
            DateTimeFormat
                    .forPattern(format)
                    .withChronology(
                            LenientChronology.getInstance(
                                    GregorianChronology.getInstance()));
    return Months.monthsBetween(
            fmt.parseDateTime(date1),
            fmt.parseDateTime(date2)
    ).getMonths();
    } catch (Exception ex) {
        ex.printStackTrace();
        return 0;
    }
}
 
Example #4
Source File: TestChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testEqualsHashCode_Lenient() {
    Chronology chrono1 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
    Chronology chrono2 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
    Chronology chrono3 = LenientChronology.getInstance(ISOChronology.getInstance());
    
    assertEquals(true, chrono1.equals(chrono2));
    assertEquals(false, chrono1.equals(chrono3));
    
    DateTime dt1 = new DateTime(0L, chrono1);
    DateTime dt2 = new DateTime(0L, chrono2);
    DateTime dt3 = new DateTime(0L, chrono3);
    
    assertEquals(true, dt1.equals(dt2));
    assertEquals(false, dt1.equals(dt3));
    
    assertEquals(true, chrono1.hashCode() == chrono2.hashCode());
    assertEquals(false, chrono1.hashCode() == chrono3.hashCode());
}
 
Example #5
Source File: TestChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testToString() {
    DateTimeZone paris = DateTimeZone.forID("Europe/Paris");
    ISOChronology isoParis = ISOChronology.getInstance(paris);
    
    assertEquals("ISOChronology[Europe/Paris]", isoParis.toString());
    assertEquals("GJChronology[Europe/Paris]", GJChronology.getInstance(paris).toString());
    assertEquals("GregorianChronology[Europe/Paris]", GregorianChronology.getInstance(paris).toString());
    assertEquals("JulianChronology[Europe/Paris]", JulianChronology.getInstance(paris).toString());
    assertEquals("BuddhistChronology[Europe/Paris]", BuddhistChronology.getInstance(paris).toString());
    assertEquals("CopticChronology[Europe/Paris]", CopticChronology.getInstance(paris).toString());
    assertEquals("EthiopicChronology[Europe/Paris]", EthiopicChronology.getInstance(paris).toString());
    assertEquals("IslamicChronology[Europe/Paris]", IslamicChronology.getInstance(paris).toString());
    
    assertEquals("LenientChronology[ISOChronology[Europe/Paris]]", LenientChronology.getInstance(isoParis).toString());
    assertEquals("StrictChronology[ISOChronology[Europe/Paris]]", StrictChronology.getInstance(isoParis).toString());
    assertEquals("LimitChronology[ISOChronology[Europe/Paris], NoLimit, NoLimit]", LimitChronology.getInstance(isoParis, null, null).toString());
    assertEquals("ZonedChronology[ISOChronology[UTC], Europe/Paris]", ZonedChronology.getInstance(isoParis, paris).toString());
}
 
Example #6
Source File: Interval.java    From program-ab with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static int getYearsBetween(final String date1, final String date2, String format){
    try {
    final DateTimeFormatter fmt =
            DateTimeFormat
                    .forPattern(format)
                    .withChronology(
                            LenientChronology.getInstance(
                                    GregorianChronology.getInstance()));
    return Years.yearsBetween(
            fmt.parseDateTime(date1),
            fmt.parseDateTime(date2)
    ).getYears();
    } catch (Exception ex) {
        ex.printStackTrace();
        return 0;
    }
}
 
Example #7
Source File: Interval.java    From program-ab with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static int getHoursBetween(final String date1, final String date2, String format){
    try {
    final DateTimeFormatter fmt =
            DateTimeFormat
                    .forPattern(format)
                    .withChronology(
                            LenientChronology.getInstance(
                                    GregorianChronology.getInstance()));
    return Hours.hoursBetween(
            fmt.parseDateTime(date1),
            fmt.parseDateTime(date2)
    ).getHours();
    } catch (Exception ex) {
        ex.printStackTrace();
        return 0;
    }
}
 
Example #8
Source File: TestChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testEqualsHashCode_Lenient() {
    Chronology chrono1 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
    Chronology chrono2 = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
    Chronology chrono3 = LenientChronology.getInstance(ISOChronology.getInstance());
    
    assertEquals(true, chrono1.equals(chrono2));
    assertEquals(false, chrono1.equals(chrono3));
    
    DateTime dt1 = new DateTime(0L, chrono1);
    DateTime dt2 = new DateTime(0L, chrono2);
    DateTime dt3 = new DateTime(0L, chrono3);
    
    assertEquals(true, dt1.equals(dt2));
    assertEquals(false, dt1.equals(dt3));
    
    assertEquals(true, chrono1.hashCode() == chrono2.hashCode());
    assertEquals(false, chrono1.hashCode() == chrono3.hashCode());
}
 
Example #9
Source File: TestInterval_Basics.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testEqualsHashCodeStrict() {
    Interval test1 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    Interval test2 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    assertEquals(true, test1.equals(test2));
    assertEquals(true, test2.equals(test1));
    assertEquals(true, test1.equals(test1));
    assertEquals(true, test2.equals(test2));
    assertEquals(true, test1.hashCode() == test2.hashCode());
    assertEquals(true, test1.hashCode() == test1.hashCode());
    assertEquals(true, test2.hashCode() == test2.hashCode());
}
 
Example #10
Source File: TestYearMonth_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    YearMonth test1 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
    YearMonth test2 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
    assertEquals(true, test2.monthOfYear().equals(test1.monthOfYear()));
    assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
    assertEquals(true, test2.monthOfYear().equals(test2.monthOfYear()));
    assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
    assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
    assertEquals(true, test2.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
}
 
Example #11
Source File: TestDateTime_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    DateTime test1 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
    DateTime test2 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #12
Source File: TestLocalDate_Basics.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testEqualsHashCodeLenient() {
    LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.equals(test2));
    assertEquals(true, test2.equals(test1));
    assertEquals(true, test1.equals(test1));
    assertEquals(true, test2.equals(test2));
    assertEquals(true, test1.hashCode() == test2.hashCode());
    assertEquals(true, test1.hashCode() == test1.hashCode());
    assertEquals(true, test2.hashCode() == test2.hashCode());
}
 
Example #13
Source File: TestLocalDate_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #14
Source File: TestDateMidnight_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    DateMidnight test1 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    DateMidnight test2 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #15
Source File: TestInterval_Basics.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testEqualsHashCodeLenient() {
    Interval test1 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    Interval test2 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    assertEquals(true, test1.equals(test2));
    assertEquals(true, test2.equals(test1));
    assertEquals(true, test1.equals(test1));
    assertEquals(true, test2.equals(test2));
    assertEquals(true, test1.hashCode() == test2.hashCode());
    assertEquals(true, test1.hashCode() == test1.hashCode());
    assertEquals(true, test2.hashCode() == test2.hashCode());
}
 
Example #16
Source File: TestMonthDay_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    MonthDay test1 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
    MonthDay test2 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #17
Source File: TestYearMonthDay_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    YearMonthDay test1 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    YearMonthDay test2 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #18
Source File: AbstractJodaProcessorBuilder.java    From super-csv-annotation with Apache License 2.0 5 votes vote down vote up
/**
 * 変換規則から、{@link DateTimeFormatter}のインスタンスを作成する。
 * <p>アノテーション{@link CsvDateTimeFormat}が付与されていない場合は、各種タイプごとの標準の書式で作成する。</p>
 * @param field フィールド情報
 * @param config システム設定
 * @return {@link DateTimeFormatter}のインスタンス。
 */
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) {
    
    final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class);
    if(!formatAnno.isPresent()) {
        return DateTimeFormat.forPattern(getDefaultPattern());
    }
    
    String pattern = formatAnno.get().pattern();
    if(pattern.isEmpty()) {
        pattern = getDefaultPattern();
    }
    
    final Locale locale = Utils.getLocale(formatAnno.get().locale());
    final DateTimeZone zone = formatAnno.get().timezone().isEmpty() ? DateTimeZone.getDefault()
            : DateTimeZone.forTimeZone(TimeZone.getTimeZone(formatAnno.get().timezone()));
    
    final DateTimeFormatter formatter = DateTimeFormat.forPattern(pattern)
            .withLocale(locale)
            .withZone(zone);
    
    final boolean lenient = formatAnno.get().lenient();
    if(lenient) {
        Chronology chronology = LenientChronology.getInstance(ISOChronology.getInstance());
        return formatter.withChronology(chronology);
        
    } else {
        return formatter;
    }
    
}
 
Example #19
Source File: TestYearMonthDay_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    YearMonthDay test1 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    YearMonthDay test2 = new YearMonthDay(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #20
Source File: TestInterval_Basics.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testEqualsHashCodeStrict() {
    Interval test1 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    Interval test2 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    assertEquals(true, test1.equals(test2));
    assertEquals(true, test2.equals(test1));
    assertEquals(true, test1.equals(test1));
    assertEquals(true, test2.equals(test2));
    assertEquals(true, test1.hashCode() == test2.hashCode());
    assertEquals(true, test1.hashCode() == test1.hashCode());
    assertEquals(true, test2.hashCode() == test2.hashCode());
}
 
Example #21
Source File: TestInterval_Basics.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testEqualsHashCodeLenient() {
    Interval test1 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    Interval test2 = new Interval(
            new DateTime(TEST_TIME1, LenientChronology.getInstance(COPTIC_PARIS)),
            new DateTime(TEST_TIME2, LenientChronology.getInstance(COPTIC_PARIS)));
    assertEquals(true, test1.equals(test2));
    assertEquals(true, test2.equals(test1));
    assertEquals(true, test1.equals(test1));
    assertEquals(true, test2.equals(test2));
    assertEquals(true, test1.hashCode() == test2.hashCode());
    assertEquals(true, test1.hashCode() == test1.hashCode());
    assertEquals(true, test2.hashCode() == test2.hashCode());
}
 
Example #22
Source File: TestDateMidnight_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    DateMidnight test1 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    DateMidnight test2 = new DateMidnight(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #23
Source File: TestLocalDate_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #24
Source File: TestLocalDate_Basics.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testEqualsHashCodeLenient() {
    LocalDate test1 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    LocalDate test2 = new LocalDate(1970, 6, 9, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.equals(test2));
    assertEquals(true, test2.equals(test1));
    assertEquals(true, test1.equals(test1));
    assertEquals(true, test2.equals(test2));
    assertEquals(true, test1.hashCode() == test2.hashCode());
    assertEquals(true, test1.hashCode() == test1.hashCode());
    assertEquals(true, test2.hashCode() == test2.hashCode());
}
 
Example #25
Source File: TestDateTime_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    DateTime test1 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
    DateTime test2 = new DateTime(1970, 6, 9, 0, 0, 0, 0, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #26
Source File: TestYearMonth_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    YearMonth test1 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
    YearMonth test2 = new YearMonth(1970, 6, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.monthOfYear().equals(test2.monthOfYear()));
    assertEquals(true, test2.monthOfYear().equals(test1.monthOfYear()));
    assertEquals(true, test1.monthOfYear().equals(test1.monthOfYear()));
    assertEquals(true, test2.monthOfYear().equals(test2.monthOfYear()));
    assertEquals(true, test1.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
    assertEquals(true, test1.monthOfYear().hashCode() == test1.monthOfYear().hashCode());
    assertEquals(true, test2.monthOfYear().hashCode() == test2.monthOfYear().hashCode());
}
 
Example #27
Source File: TestMonthDay_Properties.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPropertyEqualsHashCodeLenient() {
    MonthDay test1 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
    MonthDay test2 = new MonthDay(5, 6, LenientChronology.getInstance(COPTIC_PARIS));
    assertEquals(true, test1.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().equals(test1.dayOfMonth()));
    assertEquals(true, test2.dayOfMonth().equals(test2.dayOfMonth()));
    assertEquals(true, test1.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
    assertEquals(true, test1.dayOfMonth().hashCode() == test1.dayOfMonth().hashCode());
    assertEquals(true, test2.dayOfMonth().hashCode() == test2.dayOfMonth().hashCode());
}
 
Example #28
Source File: Time_11_ZoneInfoCompiler_s.java    From coming with MIT License 4 votes vote down vote up
static Chronology getLenientISOChronology() {
    if (cLenientISO == null) {
        cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
    }
    return cLenientISO;
}
 
Example #29
Source File: ZoneInfoCompiler.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
static Chronology getLenientISOChronology() {
    if (cLenientISO == null) {
        cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
    }
    return cLenientISO;
}
 
Example #30
Source File: ZoneInfoCompiler.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
static Chronology getLenientISOChronology() {
    if (cLenientISO == null) {
        cLenientISO = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
    }
    return cLenientISO;
}