LOG4J2-1926 unit test that verifies ExtendedThreadInfoFactory is loaded from 
ServiceLoader


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e369b8a5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e369b8a5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e369b8a5

Branch: refs/heads/master
Commit: e369b8a51fe7adec9afb58a42d279d9d41a08370
Parents: 20dab46
Author: rpopma <[email protected]>
Authored: Sat Jun 24 19:57:13 2017 +0900
Committer: rpopma <[email protected]>
Committed: Sat Jun 24 19:57:13 2017 +0900

----------------------------------------------------------------------
 .../message/ExtendedThreadInformationTest.java  | 36 ++++++++++++++++++++
 1 file changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e369b8a5/log4j-core/src/test/java/org/apache/logging/log4j/core/message/ExtendedThreadInformationTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/message/ExtendedThreadInformationTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/message/ExtendedThreadInformationTest.java
new file mode 100644
index 0000000..8333f19
--- /dev/null
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/message/ExtendedThreadInformationTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.message;
+
+import org.apache.logging.log4j.message.ThreadDumpMessage;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests that ThreadDumpMessage uses ExtendedThreadInformation when available.
+ */
+public class ExtendedThreadInformationTest {
+    @Test
+    public void testMessage() {
+        final ThreadDumpMessage msg = new ThreadDumpMessage("Testing");
+
+        final String message = msg.getFormattedMessage();
+        //System.out.print(message);
+        assertTrue("No header", message.contains(" Id="));
+    }
+}
\ No newline at end of file

Reply via email to