org.joda.time.chrono.GregorianChronology Java Examples
The following examples show how to use
org.joda.time.chrono.GregorianChronology.
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: TestTimeOfDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_TOD() { TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40); TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); try { new TimeOfDay(10, 20, 35, 40).isAfter(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #2
Source File: TestInstant_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_RI() { Instant test1 = new Instant(TEST_TIME1); Instant test1a = new Instant(TEST_TIME1); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); Instant test2 = new Instant(TEST_TIME2); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); assertEquals(false, test2.isEqual(new MockInstant())); assertEquals(true, test1.isEqual(new MockInstant())); assertEquals(false, new Instant(TEST_TIME_NOW + 1).isEqual(null)); assertEquals(true, new Instant(TEST_TIME_NOW).isEqual(null)); assertEquals(false, new Instant(TEST_TIME_NOW - 1).isEqual(null)); }
Example #3
Source File: TestInstant_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsBefore_RI() { Instant test1 = new Instant(TEST_TIME1); Instant test1a = new Instant(TEST_TIME1); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test1a.isBefore(test1a)); Instant test2 = new Instant(TEST_TIME2); assertEquals(true, test1.isBefore(test2)); assertEquals(false, test2.isBefore(test1)); DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(true, test1.isBefore(test3)); assertEquals(false, test3.isBefore(test1)); assertEquals(false, test3.isBefore(test2)); assertEquals(false, test2.isBefore(new MockInstant())); assertEquals(false, test1.isBefore(new MockInstant())); assertEquals(false, new Instant(TEST_TIME_NOW + 1).isBefore(null)); assertEquals(false, new Instant(TEST_TIME_NOW).isBefore(null)); assertEquals(true, new Instant(TEST_TIME_NOW - 1).isBefore(null)); }
Example #4
Source File: TestYearMonthDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsBefore_YMD() { YearMonthDay test1 = new YearMonthDay(2005, 6, 2); YearMonthDay test1a = new YearMonthDay(2005, 6, 2); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test1a.isBefore(test1a)); YearMonthDay test2 = new YearMonthDay(2005, 7, 2); assertEquals(true, test1.isBefore(test2)); assertEquals(false, test2.isBefore(test1)); YearMonthDay test3 = new YearMonthDay(2005, 7, 2, GregorianChronology.getInstanceUTC()); assertEquals(true, test1.isBefore(test3)); assertEquals(false, test3.isBefore(test1)); assertEquals(false, test3.isBefore(test2)); try { new YearMonthDay(2005, 7, 2).isBefore(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #5
Source File: TestMonthDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_MD() { MonthDay test1 = new MonthDay(6, 6); MonthDay test1a = new MonthDay(6, 6); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); MonthDay test2 = new MonthDay(6, 7); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); MonthDay test3 = new MonthDay(6, 7, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new MonthDay(6, 7).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #6
Source File: TestTimeOfDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_TOD() { TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40); TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); try { new TimeOfDay(10, 20, 35, 40).isAfter(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #7
Source File: TestChronology.java From astor with GNU General Public License v2.0 | 6 votes |
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 #8
Source File: TestInstant_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_RI() { Instant test1 = new Instant(TEST_TIME1); Instant test1a = new Instant(TEST_TIME1); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); Instant test2 = new Instant(TEST_TIME2); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); assertEquals(true, test2.isAfter(new MockInstant())); assertEquals(false, test1.isAfter(new MockInstant())); assertEquals(true, new Instant(TEST_TIME_NOW + 1).isAfter(null)); assertEquals(false, new Instant(TEST_TIME_NOW).isAfter(null)); assertEquals(false, new Instant(TEST_TIME_NOW - 1).isAfter(null)); }
Example #9
Source File: CalendarConverter.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Gets the chronology, which is the GJChronology if a GregorianCalendar is used, * BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. * The time zone specified is used in preference to that on the calendar. * * @param object the Calendar to convert, must not be null * @param zone the specified zone to use, null means default zone * @return the chronology, never null * @throws NullPointerException if the object is null * @throws ClassCastException if the object is an invalid type */ public Chronology getChronology(Object object, DateTimeZone zone) { if (object.getClass().getName().endsWith(".BuddhistCalendar")) { return BuddhistChronology.getInstance(zone); } else if (object instanceof GregorianCalendar) { GregorianCalendar gc = (GregorianCalendar) object; long cutover = gc.getGregorianChange().getTime(); if (cutover == Long.MIN_VALUE) { return GregorianChronology.getInstance(zone); } else if (cutover == Long.MAX_VALUE) { return JulianChronology.getInstance(zone); } else { return GJChronology.getInstance(zone, cutover, 4); } } else { return ISOChronology.getInstance(zone); } }
Example #10
Source File: TestLocalTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_LocalTime() { LocalTime test1 = new LocalTime(10, 20, 30, 40); LocalTime test1a = new LocalTime(10, 20, 30, 40); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); LocalTime test2 = new LocalTime(10, 20, 35, 40); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); try { new LocalTime(10, 20, 35, 40).isAfter(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #11
Source File: TestYearMonth_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_YM() { YearMonth test1 = new YearMonth(2005, 6); YearMonth test1a = new YearMonth(2005, 6); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); YearMonth test2 = new YearMonth(2005, 7); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); YearMonth test3 = new YearMonth(2005, 7, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); try { new YearMonth(2005, 7).isAfter(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #12
Source File: TestYearMonth_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsBefore_YM() { YearMonth test1 = new YearMonth(2005, 6); YearMonth test1a = new YearMonth(2005, 6); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test1a.isBefore(test1a)); YearMonth test2 = new YearMonth(2005, 7); assertEquals(true, test1.isBefore(test2)); assertEquals(false, test2.isBefore(test1)); YearMonth test3 = new YearMonth(2005, 7, GregorianChronology.getInstanceUTC()); assertEquals(true, test1.isBefore(test3)); assertEquals(false, test3.isBefore(test1)); assertEquals(false, test3.isBefore(test2)); try { new YearMonth(2005, 7).isBefore(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #13
Source File: TestTimeOfDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_TOD() { TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40); TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new TimeOfDay(10, 20, 35, 40).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #14
Source File: TestLocalDate_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_LocalDate() { LocalDate test1 = new LocalDate(2005, 6, 2); LocalDate test1a = new LocalDate(2005, 6, 2); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); LocalDate test2 = new LocalDate(2005, 7, 2); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); LocalDate test3 = new LocalDate(2005, 7, 2, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); try { new LocalDate(2005, 7, 2).isAfter(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #15
Source File: TestTimeOfDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_TOD() { TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40); TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new TimeOfDay(10, 20, 35, 40).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #16
Source File: TestYearMonth_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_YM() { YearMonth test1 = new YearMonth(2005, 6); YearMonth test1a = new YearMonth(2005, 6); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); YearMonth test2 = new YearMonth(2005, 7); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); YearMonth test3 = new YearMonth(2005, 7, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new YearMonth(2005, 7).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #17
Source File: TestYearMonthDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_YMD() { YearMonthDay test1 = new YearMonthDay(2005, 6, 2); YearMonthDay test1a = new YearMonthDay(2005, 6, 2); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); YearMonthDay test2 = new YearMonthDay(2005, 7, 2); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); YearMonthDay test3 = new YearMonthDay(2005, 7, 2, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new YearMonthDay(2005, 7, 2).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #18
Source File: TestLocalTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_LocalTime() { LocalTime test1 = new LocalTime(10, 20, 30, 40); LocalTime test1a = new LocalTime(10, 20, 30, 40); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); LocalTime test2 = new LocalTime(10, 20, 35, 40); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new LocalTime(10, 20, 35, 40).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #19
Source File: TestInstant_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_RI() { Instant test1 = new Instant(TEST_TIME1); Instant test1a = new Instant(TEST_TIME1); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); Instant test2 = new Instant(TEST_TIME2); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); assertEquals(true, test2.isAfter(new MockInstant())); assertEquals(false, test1.isAfter(new MockInstant())); assertEquals(true, new Instant(TEST_TIME_NOW + 1).isAfter(null)); assertEquals(false, new Instant(TEST_TIME_NOW).isAfter(null)); assertEquals(false, new Instant(TEST_TIME_NOW - 1).isAfter(null)); }
Example #20
Source File: TestLocalTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_LocalTime() { LocalTime test1 = new LocalTime(10, 20, 30, 40); LocalTime test1a = new LocalTime(10, 20, 30, 40); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); LocalTime test2 = new LocalTime(10, 20, 35, 40); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new LocalTime(10, 20, 35, 40).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #21
Source File: TestLocalTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsBefore_LocalTime() { LocalTime test1 = new LocalTime(10, 20, 30, 40); LocalTime test1a = new LocalTime(10, 20, 30, 40); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test1a.isBefore(test1a)); LocalTime test2 = new LocalTime(10, 20, 35, 40); assertEquals(true, test1.isBefore(test2)); assertEquals(false, test2.isBefore(test1)); LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(true, test1.isBefore(test3)); assertEquals(false, test3.isBefore(test1)); assertEquals(false, test3.isBefore(test2)); try { new LocalTime(10, 20, 35, 40).isBefore(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #22
Source File: TestLocalTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter_LocalTime() { LocalTime test1 = new LocalTime(10, 20, 30, 40); LocalTime test1a = new LocalTime(10, 20, 30, 40); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); LocalTime test2 = new LocalTime(10, 20, 35, 40); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); try { new LocalTime(10, 20, 35, 40).isAfter(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #23
Source File: TestDateTimeZoneCutover.java From astor with GNU General Public License v2.0 | 6 votes |
public void testBug2182444_usCentral() { Chronology chronUSCentral = GregorianChronology.getInstance(DateTimeZone.forID("US/Central")); Chronology chronUTC = GregorianChronology.getInstance(DateTimeZone.UTC); DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0, 0, 0, chronUTC); DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0, 0, 0, chronUTC); assertTrue("Should be standard time", chronUSCentral.getZone().isStandardOffset(usCentralStandardInUTC.getMillis())); assertFalse("Should be daylight time", chronUSCentral.getZone().isStandardOffset(usCentralDaylightInUTC.getMillis())); DateTime usCentralStandardInUSCentral = usCentralStandardInUTC.toDateTime(chronUSCentral); DateTime usCentralDaylightInUSCentral = usCentralDaylightInUTC.toDateTime(chronUSCentral); assertEquals(1, usCentralStandardInUSCentral.getHourOfDay()); assertEquals(usCentralStandardInUSCentral.getHourOfDay(), usCentralDaylightInUSCentral.getHourOfDay()); assertTrue(usCentralStandardInUSCentral.getMillis() != usCentralDaylightInUSCentral.getMillis()); assertEquals(usCentralStandardInUSCentral, usCentralStandardInUSCentral.withHourOfDay(1)); assertEquals(usCentralStandardInUSCentral.getMillis() + 3, usCentralStandardInUSCentral.withMillisOfSecond(3).getMillis()); assertEquals(usCentralDaylightInUSCentral, usCentralDaylightInUSCentral.withHourOfDay(1)); assertEquals(usCentralDaylightInUSCentral.getMillis() + 3, usCentralDaylightInUSCentral.withMillisOfSecond(3).getMillis()); }
Example #24
Source File: TestMutableDateTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual() { MutableDateTime test1 = new MutableDateTime(TEST_TIME1); MutableDateTime test1a = new MutableDateTime(TEST_TIME1); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); MutableDateTime test2 = new MutableDateTime(TEST_TIME2); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); MutableDateTime test3 = new MutableDateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); assertEquals(false, test2.isEqual(new MockInstant())); assertEquals(true, test1.isEqual(new MockInstant())); assertEquals(false, new MutableDateTime(TEST_TIME_NOW + 1).isEqual(null)); assertEquals(true, new MutableDateTime(TEST_TIME_NOW).isEqual(null)); assertEquals(false, new MutableDateTime(TEST_TIME_NOW - 1).isEqual(null)); }
Example #25
Source File: TestMutableDateTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsBefore() { MutableDateTime test1 = new MutableDateTime(TEST_TIME1); MutableDateTime test1a = new MutableDateTime(TEST_TIME1); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test1a.isBefore(test1a)); MutableDateTime test2 = new MutableDateTime(TEST_TIME2); assertEquals(true, test1.isBefore(test2)); assertEquals(false, test2.isBefore(test1)); MutableDateTime test3 = new MutableDateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(true, test1.isBefore(test3)); assertEquals(false, test3.isBefore(test1)); assertEquals(false, test3.isBefore(test2)); assertEquals(false, test2.isBefore(new MockInstant())); assertEquals(false, test1.isBefore(new MockInstant())); assertEquals(false, new MutableDateTime(TEST_TIME_NOW + 1).isBefore(null)); assertEquals(false, new MutableDateTime(TEST_TIME_NOW).isBefore(null)); assertEquals(true, new MutableDateTime(TEST_TIME_NOW - 1).isBefore(null)); }
Example #26
Source File: TestMutableDateTime_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsAfter() { MutableDateTime test1 = new MutableDateTime(TEST_TIME1); MutableDateTime test1a = new MutableDateTime(TEST_TIME1); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); assertEquals(false, test1a.isAfter(test1a)); MutableDateTime test2 = new MutableDateTime(TEST_TIME2); assertEquals(false, test1.isAfter(test2)); assertEquals(true, test2.isAfter(test1)); MutableDateTime test3 = new MutableDateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(false, test1.isAfter(test3)); assertEquals(true, test3.isAfter(test1)); assertEquals(false, test3.isAfter(test2)); assertEquals(true, test2.isAfter(new MockInstant())); assertEquals(false, test1.isAfter(new MockInstant())); assertEquals(true, new MutableDateTime(TEST_TIME_NOW + 1).isAfter(null)); assertEquals(false, new MutableDateTime(TEST_TIME_NOW).isAfter(null)); assertEquals(false, new MutableDateTime(TEST_TIME_NOW - 1).isAfter(null)); }
Example #27
Source File: TestDateTimeZoneCutover.java From astor with GNU General Public License v2.0 | 6 votes |
public void testBug2182444_usCentral() { Chronology chronUSCentral = GregorianChronology.getInstance(DateTimeZone.forID("US/Central")); Chronology chronUTC = GregorianChronology.getInstance(DateTimeZone.UTC); DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0, 0, 0, chronUTC); DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0, 0, 0, chronUTC); assertTrue("Should be standard time", chronUSCentral.getZone().isStandardOffset(usCentralStandardInUTC.getMillis())); assertFalse("Should be daylight time", chronUSCentral.getZone().isStandardOffset(usCentralDaylightInUTC.getMillis())); DateTime usCentralStandardInUSCentral = usCentralStandardInUTC.toDateTime(chronUSCentral); DateTime usCentralDaylightInUSCentral = usCentralDaylightInUTC.toDateTime(chronUSCentral); assertEquals(1, usCentralStandardInUSCentral.getHourOfDay()); assertEquals(usCentralStandardInUSCentral.getHourOfDay(), usCentralDaylightInUSCentral.getHourOfDay()); assertTrue(usCentralStandardInUSCentral.getMillis() != usCentralDaylightInUSCentral.getMillis()); assertEquals(usCentralStandardInUSCentral, usCentralStandardInUSCentral.withHourOfDay(1)); assertEquals(usCentralStandardInUSCentral.getMillis() + 3, usCentralStandardInUSCentral.withMillisOfSecond(3).getMillis()); assertEquals(usCentralDaylightInUSCentral, usCentralDaylightInUSCentral.withHourOfDay(1)); assertEquals(usCentralDaylightInUSCentral.getMillis() + 3, usCentralDaylightInUSCentral.withMillisOfSecond(3).getMillis()); }
Example #28
Source File: TestLocalDate_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsBefore_LocalDate() { LocalDate test1 = new LocalDate(2005, 6, 2); LocalDate test1a = new LocalDate(2005, 6, 2); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test1a.isBefore(test1a)); LocalDate test2 = new LocalDate(2005, 7, 2); assertEquals(true, test1.isBefore(test2)); assertEquals(false, test2.isBefore(test1)); LocalDate test3 = new LocalDate(2005, 7, 2, GregorianChronology.getInstanceUTC()); assertEquals(true, test1.isBefore(test3)); assertEquals(false, test3.isBefore(test1)); assertEquals(false, test3.isBefore(test2)); try { new LocalDate(2005, 7, 2).isBefore(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #29
Source File: TestYearMonthDay_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsEqual_YMD() { YearMonthDay test1 = new YearMonthDay(2005, 6, 2); YearMonthDay test1a = new YearMonthDay(2005, 6, 2); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test1a)); YearMonthDay test2 = new YearMonthDay(2005, 7, 2); assertEquals(false, test1.isEqual(test2)); assertEquals(false, test2.isEqual(test1)); YearMonthDay test3 = new YearMonthDay(2005, 7, 2, GregorianChronology.getInstanceUTC()); assertEquals(false, test1.isEqual(test3)); assertEquals(false, test3.isEqual(test1)); assertEquals(true, test3.isEqual(test2)); try { new YearMonthDay(2005, 7, 2).isEqual(null); fail(); } catch (IllegalArgumentException ex) {} }
Example #30
Source File: TestInstant_Basics.java From astor with GNU General Public License v2.0 | 6 votes |
public void testIsBefore_RI() { Instant test1 = new Instant(TEST_TIME1); Instant test1a = new Instant(TEST_TIME1); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test1a.isBefore(test1a)); Instant test2 = new Instant(TEST_TIME2); assertEquals(true, test1.isBefore(test2)); assertEquals(false, test2.isBefore(test1)); DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS)); assertEquals(true, test1.isBefore(test3)); assertEquals(false, test3.isBefore(test1)); assertEquals(false, test3.isBefore(test2)); assertEquals(false, test2.isBefore(new MockInstant())); assertEquals(false, test1.isBefore(new MockInstant())); assertEquals(false, new Instant(TEST_TIME_NOW + 1).isBefore(null)); assertEquals(false, new Instant(TEST_TIME_NOW).isBefore(null)); assertEquals(true, new Instant(TEST_TIME_NOW - 1).isBefore(null)); }