From b601044040bb3526e5dfaf3688bac48c1b83b625 Mon Sep 17 00:00:00 2001 From: Valerij Fredriksen Date: Tue, 5 Mar 2019 15:52:54 +0100 Subject: Make LogHandler configurable --- .../test/java/com/yahoo/container/handler/LogHandlerTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'container-core/src/test/java/com/yahoo/container/handler/LogHandlerTest.java') diff --git a/container-core/src/test/java/com/yahoo/container/handler/LogHandlerTest.java b/container-core/src/test/java/com/yahoo/container/handler/LogHandlerTest.java index 365b0313cf8..d578a745c9e 100644 --- a/container-core/src/test/java/com/yahoo/container/handler/LogHandlerTest.java +++ b/container-core/src/test/java/com/yahoo/container/handler/LogHandlerTest.java @@ -9,9 +9,10 @@ import org.junit.Test; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.time.Instant; import java.util.concurrent.Executor; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; public class LogHandlerTest { @@ -43,9 +44,13 @@ public class LogHandlerTest { } class MockLogReader extends LogReader { + MockLogReader() { + super("", ""); + } + @Override - protected JSONObject readLogs(String logDirectory, long earliestLogThreshold, long latestLogThreshold) throws JSONException { - if(latestLogThreshold > 1000) { + protected JSONObject readLogs(Instant earliestLogThreshold, Instant latestLogThreshold) throws JSONException { + if (latestLogThreshold.isAfter(Instant.ofEpochMilli(1000))) { return new JSONObject("{\"one\":\"newer_log\"}"); } else { return new JSONObject("{\"two\":\"older_log\"}"); -- cgit v1.2.3