This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git


The following commit(s) were added to refs/heads/master by this push:
     new 97bd5ec1 Use JUnit Pioneer instead of direct global variables access
97bd5ec1 is described below

commit 97bd5ec171fe37666142518b654b06df5514f065
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Dec 26 10:24:03 2024 -0500

    Use JUnit Pioneer instead of direct global variables access
---
 .../commons/validator/routines/TimeValidatorTest.java       | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java 
b/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java
index 243e2aca..9acfcba6 100644
--- a/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/TimeValidatorTest.java
@@ -32,6 +32,8 @@ import java.util.TimeZone;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.DefaultLocale;
+import org.junitpioneer.jupiter.DefaultTimeZone;
 
 /**
  * Test Case for TimeValidator.
@@ -258,15 +260,10 @@ public class TimeValidatorTest {
      * Test time zone methods.
      */
     @Test
+    @DefaultLocale("en-GB")
+    @DefaultTimeZone("GMT")
     public void testTimeZone() {
-        // Set the default Locale & TimeZone
-        Locale.setDefault(Locale.UK);
-        TimeZone.setDefault(GMT);
-
-        Calendar result;
-
-        // Default Locale, Default TimeZone
-        result = validator.validate("18:01");
+        Calendar result = validator.validate("18:01");
         assertNotNull(result, "default result");
         assertEquals(GMT, result.getTimeZone(), "default zone");
         assertEquals(18, result.get(Calendar.HOUR_OF_DAY), "default hour");

Reply via email to