Skip to content

Commit 5a9598e

Browse files
committed
test: add $millis() timestamp advancement test
1 parent 900c653 commit 5a9598e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/java/com/dashjoin/jsonata/ThreadSafetyTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,13 @@ public void testNowWithCachedInstance() throws Exception {
284284
assertNotEquals(r1, r2, "$now() should return different values on different calls");
285285
}
286286

287+
@Test
288+
public void testMillisWithCachedInstance() throws Exception {
289+
Jsonata expr = jsonata("$millis()");
290+
long r1 = ((Number) expr.evaluate(null)).longValue();
291+
Thread.sleep(10);
292+
long r2 = ((Number) expr.evaluate(null)).longValue();
293+
assertTrue(r2 > r1, "$millis() should advance across separate evaluations");
294+
}
295+
287296
}

0 commit comments

Comments
 (0)