From 85f1446aeded2dbab481b1c2f9b0b1132e64e7ab Mon Sep 17 00:00:00 2001 From: Dennis Lawler Date: Thu, 12 Sep 2019 11:19:30 -0700 Subject: [PATCH] Add test for millisecond timestamp. --- .../gcviewer/imp/TestDataReaderUJLG1JDK11.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderUJLG1JDK11.java b/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderUJLG1JDK11.java index e0f9e0af..0e0214aa 100644 --- a/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderUJLG1JDK11.java +++ b/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderUJLG1JDK11.java @@ -43,6 +43,22 @@ public void testDefaultsPauseYoungNormal() throws Exception { assertThat("pause", model.get(0).getPause(), closeTo(0.012615, 0.00000001)); } + @Test + public void testNewUptimestamp() throws Exception { + TestLogHandler handler = new TestLogHandler(); + handler.setLevel(Level.WARNING); + GCResource gcResource = new GcResourceFile("byteArray"); + gcResource.getLogger().addHandler(handler); + InputStream in = new ByteArrayInputStream( + ("[113ms][info][gc] GC(4) Pause Young (Normal) (G1 Evacuation Pause) 70M->70M(128M) 12.615ms") + .getBytes()); + + DataReader reader = new DataReaderUnifiedJvmLogging(gcResource, in); + GCModel model = reader.read(); + + assertThat(model.getEvents().next().getTimestamp(), is(0.113)); + } + @Test public void testDefaultsPauseYoungConcurrentStart() throws Exception { TestLogHandler handler = new TestLogHandler();