LOG4J2-493 test fixes Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7ffd4cfe Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7ffd4cfe Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7ffd4cfe
Branch: refs/heads/LOG4J2-1161 Commit: 7ffd4cfe1fec0316a5cd79167f2250cba6752984 Parents: 4b0b01d Author: rpopma <rpo...@apache.org> Authored: Fri Oct 23 02:39:24 2015 +0900 Committer: rpopma <rpo...@apache.org> Committed: Fri Oct 23 02:39:24 2015 +0900 ---------------------------------------------------------------------- ...ncLoggerContextSelectorInitialStateTest.java | 30 ++++++++++++++++++++ .../async/AsyncLoggerContextSelectorTest.java | 18 +++++------- 2 files changed, 37 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7ffd4cfe/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java new file mode 100644 index 0000000..2d547ed --- /dev/null +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java @@ -0,0 +1,30 @@ +/* + * 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.async; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AsyncLoggerContextSelectorInitialStateTest { + + @Test + public void testLoggerContextsListInitiallyEmpty() { + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); + assertTrue(selector.getLoggerContexts().isEmpty()); + } +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7ffd4cfe/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java index 23c4cdd..324aa84 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java @@ -24,11 +24,13 @@ import org.junit.Test; import static org.junit.Assert.*; public class AsyncLoggerContextSelectorTest { + + private static final String FQCN = AsyncLoggerContextSelectorTest.class.getName(); @Test public void testContextReturnsAsyncLoggerContext() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); - final LoggerContext context = selector.getContext(null, null, false); + final LoggerContext context = selector.getContext(FQCN, null, false); assertTrue(context instanceof AsyncLoggerContext); } @@ -36,21 +38,15 @@ public class AsyncLoggerContextSelectorTest { @Test public void testContext2ReturnsAsyncLoggerContext() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); - final LoggerContext context = selector.getContext(null, null, false, null); + final LoggerContext context = selector.getContext(FQCN, null, false, null); assertTrue(context instanceof AsyncLoggerContext); } @Test - public void testLoggerContextsListInitiallyEmpty() { - final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); - assertTrue(selector.getLoggerContexts().isEmpty()); - } - - @Test public void testLoggerContextsReturnsAsyncLoggerContext() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); - selector.getContext(null, null, false); + selector.getContext(FQCN, null, false); final List<LoggerContext> list = selector.getLoggerContexts(); assertEquals(1, list.size()); @@ -60,9 +56,9 @@ public class AsyncLoggerContextSelectorTest { @Test public void testContextNameIsAsyncLoggerContextWithClassHashCode() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); - final LoggerContext context = selector.getContext(null, null, false); + final LoggerContext context = selector.getContext(FQCN, null, false); final int hash = getClass().getClassLoader().hashCode(); - final String expectedContextName = "AsyncLoggerContext@" + Integer.toHexString(hash); + final String expectedContextName = "AsyncContext@" + Integer.toHexString(hash); assertEquals(expectedContextName, context.getName()); }