@Test public void testToString_fromApiDate() { Assert.assertEquals(stringDate1, dateTimesHelper.dateToString(apiDateTime1.getDate())); Assert.assertEquals(stringDate2, dateTimesHelper.dateToString(apiDateTime2.getDate())); Assert.assertEquals(stringDate3, dateTimesHelper.dateToString(apiDateTime3.getDate())); }
public String dateToString(D date) { try { return String.format( DATE_PATTERN, (Integer) PropertyUtils.getProperty(date, "year"), (Integer) PropertyUtils.getProperty(date, "month"), (Integer) PropertyUtils.getProperty(date, "day")); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access class.", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Could not get field.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not get field.", e); } }
DateTimesHelper { public String dateToString(D date) { try { return String.format( DATE_PATTERN, (Integer) PropertyUtils.getProperty(date, "year"), (Integer) PropertyUtils.getProperty(date, "month"), (Integer) PropertyUtils.getProperty(date, "day")); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access class.", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Could not get field.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not get field.", e); } } }
DateTimesHelper { public String dateToString(D date) { try { return String.format( DATE_PATTERN, (Integer) PropertyUtils.getProperty(date, "year"), (Integer) PropertyUtils.getProperty(date, "month"), (Integer) PropertyUtils.getProperty(date, "day")); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access class.", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Could not get field.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not get field.", e); } } DateTimesHelper(Class<T> dateTimeClass, Class<D> dateClass); }
DateTimesHelper { public String dateToString(D date) { try { return String.format( DATE_PATTERN, (Integer) PropertyUtils.getProperty(date, "year"), (Integer) PropertyUtils.getProperty(date, "month"), (Integer) PropertyUtils.getProperty(date, "day")); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access class.", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Could not get field.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not get field.", e); } } DateTimesHelper(Class<T> dateTimeClass, Class<D> dateClass); T toDateTime(Calendar calendar); T toDateTime(Instant instant, String timeZoneId); T toDateTime(DateTime dateTime); T toDateTime(String dateTime, String timeZoneId); T toDateTimeWithTimeZone(String dateTime); String dateToString(D date); DateTime toDateTime(T dateTime); Calendar toCalendar(T dateTime); Calendar toCalendar(T dateTime, Locale locale); String toString(T dateTime); String toStringWithTimeZone(T dateTime); String toStringForTimeZone(T dateTime, String newZoneID); }
DateTimesHelper { public String dateToString(D date) { try { return String.format( DATE_PATTERN, (Integer) PropertyUtils.getProperty(date, "year"), (Integer) PropertyUtils.getProperty(date, "month"), (Integer) PropertyUtils.getProperty(date, "day")); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access class.", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Could not get field.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not get field.", e); } } DateTimesHelper(Class<T> dateTimeClass, Class<D> dateClass); T toDateTime(Calendar calendar); T toDateTime(Instant instant, String timeZoneId); T toDateTime(DateTime dateTime); T toDateTime(String dateTime, String timeZoneId); T toDateTimeWithTimeZone(String dateTime); String dateToString(D date); DateTime toDateTime(T dateTime); Calendar toCalendar(T dateTime); Calendar toCalendar(T dateTime, Locale locale); String toString(T dateTime); String toStringWithTimeZone(T dateTime); String toStringForTimeZone(T dateTime, String newZoneID);  }