use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestReadableInstantConverter method testGetChronology_Object_nullChronology.
public void testGetChronology_Object_nullChronology() throws Exception {
assertEquals(ISO.withUTC(), ReadableInstantConverter.INSTANCE.getChronology(new Instant(123L), (Chronology) null));
assertEquals(ISO, ReadableInstantConverter.INSTANCE.getChronology(new DateTime(123L), (Chronology) null));
MutableDateTime mdt = new MutableDateTime() {
public Chronology getChronology() {
// bad
return null;
}
};
assertEquals(ISO, ReadableInstantConverter.INSTANCE.getChronology(mdt, (Chronology) null));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestLenientChronology method test_isoChrononolgy_Chicago.
public void test_isoChrononolgy_Chicago() {
DateTimeZone zone = DateTimeZone.forID("America/Chicago");
Chronology lenient = ISOChronology.getInstance(zone);
try {
new DateTime(2007, 3, 11, 2, 30, 0, 0, lenient);
fail();
} catch (IllegalArgumentException ex) {
// expected
}
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestLenientChronology method test_lenientChrononolgy_Turk.
public void test_lenientChrononolgy_Turk() {
Chronology lenient = LenientChronology.getInstance(ISOChronology.getInstance(MOCK_TURK));
DateTime dt = new DateTime(2007, 4, 1, 0, 30, 0, 0, lenient);
assertEquals("2007-04-01T01:30:00.000-04:00", dt.toString());
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestLenientChronology method test_setYear.
//-----------------------------------------------------------------------
public void test_setYear() {
Chronology zone = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
DateTime dt = new DateTime(2007, 1, 1, 0, 0, 0, 0, zone);
assertEquals("2007-01-01T00:00:00.000Z", dt.toString());
dt = dt.withYear(2008);
assertEquals("2008-01-01T00:00:00.000Z", dt.toString());
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_monthDay_feb29.
public void testParseLocalDate_monthDay_feb29() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("M d").withChronology(chrono).withLocale(Locale.UK);
assertEquals(new LocalDate(2000, 2, 29, chrono), f.parseLocalDate("2 29"));
}
Aggregations