This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new d37e256f Use correct clock source in TimestampSerializerTest
d37e256f is described below
commit d37e256f2ed0105f65ce1753765d3a712be45032
Author: Brandon Williams <[email protected]>
AuthorDate: Mon Nov 8 09:56:12 2021 -0600
Use correct clock source in TimestampSerializerTest
Patch by brandonwilliams; reviewed by edimitrova for CASSANDRA-17120
---
.../org/apache/cassandra/serializers/TimestampSerializerTest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/test/unit/org/apache/cassandra/serializers/TimestampSerializerTest.java
b/test/unit/org/apache/cassandra/serializers/TimestampSerializerTest.java
index e9ae266..64a1b11 100644
--- a/test/unit/org/apache/cassandra/serializers/TimestampSerializerTest.java
+++ b/test/unit/org/apache/cassandra/serializers/TimestampSerializerTest.java
@@ -26,6 +26,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.apache.cassandra.utils.Clock.Global.currentTimeMillis;
+
public class TimestampSerializerTest
{
public static final long ONE_SECOND = 1000L;
@@ -196,7 +198,7 @@ public class TimestampSerializerTest
public void testNumeric()
{
// now (positive
- final long now = System.currentTimeMillis();
+ final long now = currentTimeMillis();
assertEquals(now,
TimestampSerializer.dateStringToTimestamp(Long.toString(now)));
// negative
@@ -222,7 +224,7 @@ public class TimestampSerializerTest
public void testNow()
{
final long threshold = 5;
- final long now = System.currentTimeMillis();
+ final long now = currentTimeMillis();
final long parsed = TimestampSerializer.dateStringToTimestamp("now");
assertTrue("'now' timestamp not within expected tolerance.", now <=
parsed && parsed <= now + threshold);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]