@Test public void testCustomTimeFormatterWithCustomZone() { EcLogYamlConfig config = new EcLogYamlConfig(); config.time_format = TIME_FORMAT; config.time_zone = "Europe/Stockholm"; Optional<DateTimeFormatter> timeFormatter = config.getTimeFormatter(); assertThat(timeFormatter).map(DateTimeFormatter::getZone).contains(ZoneId.of(config.time_zone)); assertThat(timeFormatter).map(formatter -> formatter.format(Instant.ofEpochSecond(42))).contains("1970-01-01 01:00:42 CET+0100"); }
public Optional<DateTimeFormatter> getTimeFormatter() { return Optional.ofNullable(time_format) .map(EcLogYamlConfig::createTimeFormatter) .map(formatter -> formatter.withZone(resolveZoneId(time_zone))); }
EcLogYamlConfig { public Optional<DateTimeFormatter> getTimeFormatter() { return Optional.ofNullable(time_format) .map(EcLogYamlConfig::createTimeFormatter) .map(formatter -> formatter.withZone(resolveZoneId(time_zone))); } }
EcLogYamlConfig { public Optional<DateTimeFormatter> getTimeFormatter() { return Optional.ofNullable(time_format) .map(EcLogYamlConfig::createTimeFormatter) .map(formatter -> formatter.withZone(resolveZoneId(time_zone))); }  }
EcLogYamlConfig { public Optional<DateTimeFormatter> getTimeFormatter() { return Optional.ofNullable(time_format) .map(EcLogYamlConfig::createTimeFormatter) .map(formatter -> formatter.withZone(resolveZoneId(time_zone))); }  String getLogFormat(); Optional<DateTimeFormatter> getTimeFormatter(); }
EcLogYamlConfig { public Optional<DateTimeFormatter> getTimeFormatter() { return Optional.ofNullable(time_format) .map(EcLogYamlConfig::createTimeFormatter) .map(formatter -> formatter.withZone(resolveZoneId(time_zone))); }  String getLogFormat(); Optional<DateTimeFormatter> getTimeFormatter(); public String log_format; public String time_format; public String time_zone; }