@Test public void testToDateTime_fromApiDateTimeToJoda() { Object joda = DateTimes.toDateTime(apiDateTime3); assertEquals(jodaDateTime1, DateTimes.toDateTime(apiDateTime1)); assertEquals(jodaDateTime2, DateTimes.toDateTime(apiDateTime2)); assertEquals(jodaDateTime3, DateTimes.toDateTime(apiDateTime3)); }
@Test public void testToStringForTimeZone_fromApiDate() { Assert.assertEquals( stringDateTime1, DateTimes.toStringForTimeZone(apiDateTime1, TIME_ZONE_ID1)); Assert.assertEquals( stringDateTime2, DateTimes.toStringForTimeZone(apiDateTime2, TIME_ZONE_ID2)); Assert.assertEquals( stringDateTime3, DateTimes.toStringForTimeZone(apiDateTime3, TIME_ZONE_ID3)); Assert.assertEquals( stringDateTime1, DateTimes.toStringForTimeZone( DateTimes.toDateTime(jodaDateTime1.withZone(DateTimeZone.forID(TIME_ZONE_ID2))), TIME_ZONE_ID1)); Assert.assertEquals( stringDateTime2, DateTimes.toStringForTimeZone( DateTimes.toDateTime(jodaDateTime2.withZone(DateTimeZone.forID(TIME_ZONE_ID1))), TIME_ZONE_ID2)); Assert.assertEquals( stringDateTime3, DateTimes.toStringForTimeZone( DateTimes.toDateTime(jodaDateTime3.withZone(DateTimeZone.forID(TIME_ZONE_ID1))), TIME_ZONE_ID3)); }
@Test public void testTransitive_stringApiJoda() { assertEquals( jodaDateTime1, DateTimes.toDateTime(DateTimes.toDateTime(stringDateTime1, TIME_ZONE_ID1))); assertEquals( jodaDateTime2, DateTimes.toDateTime(DateTimes.toDateTime(stringDateTime2, TIME_ZONE_ID2))); assertEquals( jodaDateTime3, DateTimes.toDateTime(DateTimes.toDateTime(stringDateTime3, TIME_ZONE_ID3))); }
@Test public void testTransitive_apiStringApi() { assertEquals( apiDateTime1, DateTimes.toDateTime(DateTimes.toString(apiDateTime1), TIME_ZONE_ID1)); assertEquals( apiDateTime2, DateTimes.toDateTime(DateTimes.toString(apiDateTime2), TIME_ZONE_ID2)); assertEquals( apiDateTime3, DateTimes.toDateTime(DateTimes.toString(apiDateTime3), TIME_ZONE_ID3)); }
@Test public void testTransitive_stringApiJodaWithTimeZone() { assertEquals( jodaDateTime1, DateTimes.toDateTime(DateTimes.toDateTimeWithTimeZone(stringDateTimeWithTimeZone1))); assertEquals( jodaDateTime2, DateTimes.toDateTime(DateTimes.toDateTimeWithTimeZone(stringDateTimeWithTimeZone2))); assertEquals( jodaDateTime3, DateTimes.toDateTime(DateTimes.toDateTimeWithTimeZone(stringDateTimeWithTimeZone3))); }
@Test public void testTransitive_instantApiJoda() { assertEquals( jodaDateTime1, DateTimes.toDateTime(DateTimes.toDateTime(jodaDateTime1.toInstant(), TIME_ZONE_ID1))); assertEquals( jodaDateTime2, DateTimes.toDateTime(DateTimes.toDateTime(jodaDateTime2.toInstant(), TIME_ZONE_ID2))); assertEquals( jodaDateTime3, DateTimes.toDateTime(DateTimes.toDateTime(jodaDateTime3.toInstant(), TIME_ZONE_ID3))); }
@Test public void testTransitive_calendarApiJoda() { assertEquals(jodaDateTime1, DateTimes.toDateTime(DateTimes.toDateTime(calendar1))); assertEquals(jodaDateTime2, DateTimes.toDateTime(DateTimes.toDateTime(calendar2))); assertEquals(jodaDateTime3, DateTimes.toDateTime(DateTimes.toDateTime(calendar3))); }
@Test public void testTransitive_jodaApiJoda() { assertEquals(jodaDateTime1, DateTimes.toDateTime(DateTimes.toDateTime(jodaDateTime1))); assertEquals(jodaDateTime2, DateTimes.toDateTime(DateTimes.toDateTime(jodaDateTime2))); assertEquals(jodaDateTime3, DateTimes.toDateTime(DateTimes.toDateTime(jodaDateTime3))); }
@Test public void testTransitive_apiCalendarApi() { assertEquals(apiDateTime1, DateTimes.toDateTime(DateTimes.toCalendar(apiDateTime1))); assertEquals(apiDateTime2, DateTimes.toDateTime(DateTimes.toCalendar(apiDateTime2))); assertEquals(apiDateTime3, DateTimes.toDateTime(DateTimes.toCalendar(apiDateTime3))); }
@Test public void testToDateTime_fromCalendarToApiDateTime() { assertEquals(apiDateTime1, DateTimes.toDateTime(calendar1)); assertEquals(apiDateTime2, DateTimes.toDateTime(calendar2)); assertEquals(apiDateTime3, DateTimes.toDateTime(calendar3)); }
@Test public void testToString_fromApiDateTime() { Assert.assertEquals(stringDateTime1, DateTimes.toString(apiDateTime1)); Assert.assertEquals(stringDateTime2, DateTimes.toString(apiDateTime2)); Assert.assertEquals(stringDateTime3, DateTimes.toString(apiDateTime3)); }
@Test public void testToString_fromApiDate() { Assert.assertEquals(stringDate1, DateTimes.toString(apiDateTime1.getDate())); Assert.assertEquals(stringDate2, DateTimes.toString(apiDateTime2.getDate())); Assert.assertEquals(stringDate3, DateTimes.toString(apiDateTime3.getDate())); }
@Test public void testToCalendar_fromApiDate_withLocales() { assertEquals(calendarWithLocale1, DateTimes.toCalendar(apiDateTime1, LOCALE1)); assertEquals(calendarWithLocale2, DateTimes.toCalendar(apiDateTime2, LOCALE2)); assertEquals(calendarWithLocale3, DateTimes.toCalendar(apiDateTime3, LOCALE3)); }
@Test public void testToCalendar_fromApiDate() { assertEquals(calendar1, DateTimes.toCalendar(apiDateTime1)); assertEquals(calendar2, DateTimes.toCalendar(apiDateTime2)); assertEquals(calendar3, DateTimes.toCalendar(apiDateTime3)); }
@Test public void testToDateTime_fromStringToApiDateTimeWithTimeZone() { assertEquals(apiDateTime1, DateTimes.toDateTimeWithTimeZone(stringDateTimeWithTimeZone1)); assertEquals(apiDateTime2, DateTimes.toDateTimeWithTimeZone(stringDateTimeWithTimeZone2)); assertEquals(apiDateTime3, DateTimes.toDateTimeWithTimeZone(stringDateTimeWithTimeZone3)); }
@Test public void testToDateTime_fromStringToApiDateTime() { assertEquals(apiDateTime1, DateTimes.toDateTime(stringDateTime1, TIME_ZONE_ID1)); assertEquals(apiDateTime2, DateTimes.toDateTime(stringDateTime2, TIME_ZONE_ID2)); assertEquals(apiDateTime3, DateTimes.toDateTime(stringDateTime3, TIME_ZONE_ID3)); }
@Test public void testToStringWithTimeZone_fromApiDateTime() { Assert.assertEquals(stringDateTimeWithTimeZone1, DateTimes.toStringWithTimeZone(apiDateTime1)); Assert.assertEquals(stringDateTimeWithTimeZone2, DateTimes.toStringWithTimeZone(apiDateTime2)); Assert.assertEquals(stringDateTimeWithTimeZone3, DateTimes.toStringWithTimeZone(apiDateTime3)); }
@Test public void testToDateTime_fromInstantToApiDateTime() { assertEquals(apiDateTime1, DateTimes.toDateTime(jodaDateTime1.toInstant(), TIME_ZONE_ID1)); assertEquals(apiDateTime2, DateTimes.toDateTime(jodaDateTime2.toInstant(), TIME_ZONE_ID2)); assertEquals(apiDateTime3, DateTimes.toDateTime(jodaDateTime3.toInstant(), TIME_ZONE_ID3)); }