diff --git a/src/test/java/run/halo/app/infra/exception/handlers/I18nExceptionTest.java b/src/test/java/run/halo/app/infra/exception/handlers/I18nExceptionTest.java index a6ef11b9c..161a3be78 100644 --- a/src/test/java/run/halo/app/infra/exception/handlers/I18nExceptionTest.java +++ b/src/test/java/run/halo/app/infra/exception/handlers/I18nExceptionTest.java @@ -2,6 +2,9 @@ package run.halo.app.infra.exception.handlers; import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.Locale; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; @@ -25,6 +28,18 @@ class I18nExceptionTest { @Autowired WebTestClient webClient; + Locale currentLocale; + + @BeforeEach + void setUp() { + currentLocale = Locale.getDefault(); + Locale.setDefault(Locale.ENGLISH); + } + + @AfterEach + void tearDown() { + Locale.setDefault(currentLocale); + } @Test void shouldBeOkForGreetingEndpoint() {