From babcb8a25b64a8aaec2c4c22b10cf9251b85c21b Mon Sep 17 00:00:00 2001 From: Matt Peterson Date: Thu, 27 Jun 2024 13:18:00 -0600 Subject: [PATCH] fix: added array wrap-around functionality for the TestClock Signed-off-by: Matt Peterson --- .../block/server/consumer/LiveStreamObserverImplTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/test/java/com/hedera/block/server/consumer/LiveStreamObserverImplTest.java b/server/src/test/java/com/hedera/block/server/consumer/LiveStreamObserverImplTest.java index b9b6b2553..243fbafed 100644 --- a/server/src/test/java/com/hedera/block/server/consumer/LiveStreamObserverImplTest.java +++ b/server/src/test/java/com/hedera/block/server/consumer/LiveStreamObserverImplTest.java @@ -128,7 +128,12 @@ static class TestClock implements InstantSource { @Override public long millis() { - return millis[index++]; + long value = millis[index]; + + // cycle through the provided millis + // and wrap around if necessary + index = index > millis.length - 1 ? 0 : index + 1; + return value; } @Override