@Test public void testDateFormatModifiers() throws IOException { TemplateEncoder encoder = new TemplateEncoder(getClass().getResource("format2.txt")); Date date = new Date(); LocalDate localDate = LocalDate.now(); LocalTime localTime = LocalTime.now(); LocalDateTime localDateTime = LocalDateTime.now(); String result; try (StringWriter writer = new StringWriter()) { encoder.write(mapOf( entry("timestamp", date.getTime()), entry("date", date), entry("localDate", localDate), entry("localTime", localTime), entry("localDateTime", localDateTime) ), writer); result = writer.toString(); } ZonedDateTime now = ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); assertEquals(DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + ",\n" + DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + ",\n" + DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + ",\n" + DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + ",\n" + DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(localDate) + ",\n" + DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).format(localTime) + ",\n" + DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).format(localDateTime), result); }
@Override public void write(Object value, OutputStream outputStream) throws IOException { write(value, outputStream, Locale.getDefault()); }
TemplateEncoder extends Encoder<Object> { @Override public void write(Object value, OutputStream outputStream) throws IOException { write(value, outputStream, Locale.getDefault()); } }
TemplateEncoder extends Encoder<Object> { @Override public void write(Object value, OutputStream outputStream) throws IOException { write(value, outputStream, Locale.getDefault()); } TemplateEncoder(URL url);  TemplateEncoder(URL url, Charset charset); }
TemplateEncoder extends Encoder<Object> { @Override public void write(Object value, OutputStream outputStream) throws IOException { write(value, outputStream, Locale.getDefault()); } TemplateEncoder(URL url);  TemplateEncoder(URL url, Charset charset); Map<String, Modifier> getModifiers(); String getBaseName(); void setBaseName(String baseName); Map<String, ?> getContext(); void setContext(Map<String, ?> context); @Override void write(Object value, OutputStream outputStream); void write(Object value, OutputStream outputStream, Locale locale); void write(Object value, OutputStream outputStream, Locale locale, TimeZone timeZone); @Override void write(Object value, Writer writer); void write(Object value, Writer writer, Locale locale); void write(Object value, Writer writer, Locale locale, TimeZone timeZone); static Map<String, Modifier> getDefaultModifiers(); }
TemplateEncoder extends Encoder<Object> { @Override public void write(Object value, OutputStream outputStream) throws IOException { write(value, outputStream, Locale.getDefault()); } TemplateEncoder(URL url);  TemplateEncoder(URL url, Charset charset); Map<String, Modifier> getModifiers(); String getBaseName(); void setBaseName(String baseName); Map<String, ?> getContext(); void setContext(Map<String, ?> context); @Override void write(Object value, OutputStream outputStream); void write(Object value, OutputStream outputStream, Locale locale); void write(Object value, OutputStream outputStream, Locale locale, TimeZone timeZone); @Override void write(Object value, Writer writer); void write(Object value, Writer writer, Locale locale); void write(Object value, Writer writer, Locale locale, TimeZone timeZone); static Map<String, Modifier> getDefaultModifiers();  }