Fix WebFlux test Timezone issue

Fix test that fails in certain timezones.

See gh-8923
This commit is contained in:
Phillip Webb
2026-04-07 22:20:03 -07:00
parent 3753b9d466
commit e434ee17ca
@@ -343,11 +343,11 @@ class WebFluxAutoConfigurationTests {
}
@Test
void embeddedValueResolverIsAppliedToConversionService() throws Exception {
void embeddedValueResolverIsAppliedToConversionService() {
this.contextRunner.withPropertyValues("my.date.format=yyyy-MM-dd").run((context) -> {
FormattingConversionService conversionService = context.getBean(FormattingConversionService.class);
TypeDescriptor dateType = new TypeDescriptor(FormattedDate.class.getDeclaredField("date"));
Date date = Date.from(ZonedDateTime.of(2000, 1, 2, 3, 4, 5, 6, ZoneId.of("UTC")).toInstant());
Date date = Date.from(ZonedDateTime.of(2000, 1, 2, 3, 4, 5, 6, ZoneId.systemDefault()).toInstant());
assertThat(conversionService.convert(date, dateType, TypeDescriptor.valueOf(String.class)))
.isEqualTo("2000-01-02");
});