You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/03/23 15:27:37 UTC
[2/2] logging-log4j2 git commit: Unit test for formatTimestamp
Unit test for formatTimestamp
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0b77d16d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0b77d16d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0b77d16d
Branch: refs/heads/master
Commit: 0b77d16dc17cf435243b7f4bb9abc7e7e3ea0ec1
Parents: 0623673
Author: Mikael Ståldal <mi...@magine.com>
Authored: Wed Mar 23 15:27:09 2016 +0100
Committer: Mikael Ståldal <mi...@magine.com>
Committed: Wed Mar 23 15:27:09 2016 +0100
----------------------------------------------------------------------
.../org/apache/logging/log4j/core/layout/GelfLayoutTest.java | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0b77d16d/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
index c82fa21..c89fad9 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
@@ -38,6 +38,7 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.InflaterInputStream;
import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals;
+import static org.junit.Assert.assertEquals;
public class GelfLayoutTest {
static ConfigurationFactory configFactory = new BasicConfigurationFactory();
@@ -209,4 +210,11 @@ public class GelfLayoutTest {
public void testLayoutZlibCompression() throws Exception {
testCompressedLayout(CompressionType.ZLIB);
}
+
+ @Test
+ public void testFormatTimestamp() {
+ assertEquals("0", GelfLayout.formatTimestamp(0L).toString());
+ assertEquals("1458741206.653", GelfLayout.formatTimestamp(1458741206653L).toString());
+ assertEquals("9223372036854775.807", GelfLayout.formatTimestamp(Long.MAX_VALUE).toString());
+ }
}