From 7e9df4b14d618c8bf5ed122941dc86885f717660 Mon Sep 17 00:00:00 2001 From: Wenjun Ruan Date: Mon, 16 Dec 2024 13:46:15 +0800 Subject: [PATCH] [Chore] Fix StopWorkflowInstanceExecuteFunctionTest failed on Locale.SIMPLIFIED_CHINESE (#16893) --- .../StopWorkflowInstanceExecuteFunctionTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecuteFunctionTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecuteFunctionTest.java index 9c6fa6ac5e..60e11477a0 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecuteFunctionTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecuteFunctionTest.java @@ -25,7 +25,11 @@ import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao; +import java.util.Locale; + +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; @@ -34,6 +38,7 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.junit.jupiter.MockitoSettings; import org.mockito.quality.Strictness; +import org.springframework.context.i18n.LocaleContextHolder; @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) @@ -45,6 +50,16 @@ class StopWorkflowInstanceExecuteFunctionTest { @InjectMocks private StopWorkflowInstanceExecutorDelegate stopWorkflowInstanceExecutorDelegate; + @BeforeAll + public static void setUp() { + LocaleContextHolder.setLocale(Locale.US); + } + + @AfterAll + public static void tearDown() { + LocaleContextHolder.resetLocaleContext(); + } + @ParameterizedTest @EnumSource(value = WorkflowExecutionStatus.class, names = { "RUNNING_EXECUTION",