This is an automated email from the ASF dual-hosted git repository.
more pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git
The following commit(s) were added to refs/heads/master by this push:
new 2cdf9e2fc KNOX-3060 - Fix an issue with
JsonUtilsTest.testRenderAsJsonStringWithDateFormat which can fail due to clock
skew (#1036)
2cdf9e2fc is described below
commit 2cdf9e2fc2fd333d8acbe34496bea698f6f3f32e
Author: Sandeep Moré <[email protected]>
AuthorDate: Thu May 1 10:48:30 2025 -0400
KNOX-3060 - Fix an issue with
JsonUtilsTest.testRenderAsJsonStringWithDateFormat which can fail due to clock
skew (#1036)
---
.../src/test/java/org/apache/knox/gateway/util/JsonUtilsTest.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/gateway-util-common/src/test/java/org/apache/knox/gateway/util/JsonUtilsTest.java
b/gateway-util-common/src/test/java/org/apache/knox/gateway/util/JsonUtilsTest.java
index 74e761a4a..429c18ad8 100644
---
a/gateway-util-common/src/test/java/org/apache/knox/gateway/util/JsonUtilsTest.java
+++
b/gateway-util-common/src/test/java/org/apache/knox/gateway/util/JsonUtilsTest.java
@@ -24,6 +24,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import org.junit.Test;
@@ -133,7 +134,7 @@ public class JsonUtilsTest {
@Test
public void testRenderAsJsonStringWithDateFormat() {
// Create a test object with a date
- Date testDate = new Date(1609459200000L); // 2021-01-01 00:00:00 UTC
+ Date testDate = new Date(TimeUnit.SECONDS.toMillis(1746108169L)); //
Thu, 01 May 2025 14:02:49 GMT
TestObjectWithDate testObject = new TestObjectWithDate("test-value",
testDate);
// Create a custom date format
@@ -145,7 +146,7 @@ public class JsonUtilsTest {
// Verify the JSON contains the expected values
assertNotNull(json);
assertThat(json, containsString("\"stringProperty\" :
\"test-value\""));
- assertThat(json, containsString("\"dateProperty\" : \"2021-01-01\""));
+ assertThat(json, containsString("\"dateProperty\" : \"2025-05-01\""));
}
// Simple test class for JSON serialization