From e1dd40a923586201e91abdc262fa9beca55488fd Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 7 Apr 2026 18:00:49 -0700 Subject: [PATCH] Fix test Timezone issue Fix test that fails in certain timezones. See gh-8923 --- .../webmvc/autoconfigure/WebMvcAutoConfigurationTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfigurationTests.java b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfigurationTests.java index 5387a811399..b6f3df9497f 100644 --- a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfigurationTests.java +++ b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfigurationTests.java @@ -512,11 +512,11 @@ class WebMvcAutoConfigurationTests { } @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"); });