You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2014/10/03 09:34:31 UTC

[7/8] git commit: Move custom Hamcrest classes to new test package.

Move custom Hamcrest classes to new test package.


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

Branch: refs/heads/master
Commit: 960fb5fc74c5d1f9adbfca005cb75ebc7db21323
Parents: f78a156
Author: Matt Sicker <ma...@apache.org>
Authored: Fri Oct 3 02:23:42 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Fri Oct 3 02:23:42 2014 -0500

----------------------------------------------------------------------
 .../appender/rewrite/MapRewritePolicyTest.java  |   2 +-
 .../rolling/RollingAppenderSizeTest.java        |   8 +-
 .../rolling/RollingAppenderTimeAndSizeTest.java |   8 +-
 .../rolling/RollingAppenderTimeTest.java        |   8 +-
 .../RollingAppenderUncompressedTest.java        |   8 +-
 ...RandomAccessFileManagerHeaderFooterTest.java |   4 +-
 .../RollingRandomAccessFileManagerTest.java     |   8 +-
 .../core/config/CustomConfigurationTest.java    |   4 +-
 .../log4j/core/config/FileOutputTest.java       |   4 +-
 .../core/config/MissingRootLoggerTest.java      |   2 +-
 .../log4j/core/config/TestConfigurator.java     |   2 +-
 .../logging/log4j/core/config/XIncludeTest.java |   2 +-
 .../logging/log4j/hamcrest/FileMatchers.java    | 180 +++++++++++++++++++
 .../logging/log4j/hamcrest/MapMatchers.java     |  62 +++++++
 .../logging/log4j/junit/FileMatchers.java       | 180 -------------------
 .../apache/logging/log4j/junit/MapMatchers.java |  62 -------
 16 files changed, 272 insertions(+), 272 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
index 82d3378..ff646e8 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
@@ -33,7 +33,7 @@ import org.apache.logging.log4j.spi.ThreadContextStack;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.apache.logging.log4j.junit.MapMatchers.hasSize;
+import static org.apache.logging.log4j.hamcrest.MapMatchers.hasSize;
 import static org.hamcrest.Matchers.hasEntry;
 import static org.junit.Assert.*;
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
index c490d2c..3e629f1 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
@@ -29,10 +29,10 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-import static org.apache.logging.log4j.junit.FileMatchers.exists;
-import static org.apache.logging.log4j.junit.FileMatchers.hasFiles;
-import static org.apache.logging.log4j.junit.FileMatchers.hasName;
-import static org.apache.logging.log4j.junit.FileMatchers.that;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.exists;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasFiles;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasName;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.that;
 import static org.hamcrest.Matchers.both;
 import static org.hamcrest.Matchers.endsWith;
 import static org.hamcrest.Matchers.hasItemInArray;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeAndSizeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeAndSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeAndSizeTest.java
index 067724e..bcf05a4 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeAndSizeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeAndSizeTest.java
@@ -25,10 +25,10 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.apache.logging.log4j.junit.FileMatchers.exists;
-import static org.apache.logging.log4j.junit.FileMatchers.hasFiles;
-import static org.apache.logging.log4j.junit.FileMatchers.hasName;
-import static org.apache.logging.log4j.junit.FileMatchers.that;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.exists;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasFiles;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasName;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.that;
 import static org.hamcrest.Matchers.both;
 import static org.hamcrest.Matchers.endsWith;
 import static org.hamcrest.Matchers.hasItemInArray;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeTest.java
index fab6cb1..5c6ed50 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderTimeTest.java
@@ -26,10 +26,10 @@ import org.junit.Test;
 import org.junit.rules.ExternalResource;
 import org.junit.rules.RuleChain;
 
-import static org.apache.logging.log4j.junit.FileMatchers.exists;
-import static org.apache.logging.log4j.junit.FileMatchers.hasFiles;
-import static org.apache.logging.log4j.junit.FileMatchers.hasName;
-import static org.apache.logging.log4j.junit.FileMatchers.that;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.exists;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasFiles;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasName;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.that;
 import static org.hamcrest.Matchers.both;
 import static org.hamcrest.Matchers.endsWith;
 import static org.hamcrest.Matchers.hasItemInArray;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
index 99f23eb..80e9775 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderUncompressedTest.java
@@ -28,10 +28,10 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.apache.logging.log4j.junit.FileMatchers.exists;
-import static org.apache.logging.log4j.junit.FileMatchers.hasFiles;
-import static org.apache.logging.log4j.junit.FileMatchers.hasName;
-import static org.apache.logging.log4j.junit.FileMatchers.that;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.exists;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasFiles;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasName;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.that;
 import static org.hamcrest.Matchers.both;
 import static org.hamcrest.Matchers.endsWith;
 import static org.hamcrest.Matchers.hasItemInArray;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerHeaderFooterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerHeaderFooterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerHeaderFooterTest.java
index 40134eb..a1d75e2 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerHeaderFooterTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerHeaderFooterTest.java
@@ -29,8 +29,8 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.apache.logging.log4j.junit.FileMatchers.exists;
-import static org.apache.logging.log4j.junit.FileMatchers.hasFiles;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.exists;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasFiles;
 import static org.hamcrest.Matchers.both;
 import static org.junit.Assert.*;
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerTest.java
index d1bc1ad..b80bb72 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManagerTest.java
@@ -28,10 +28,10 @@ import org.apache.logging.log4j.core.util.Closer;
 import org.apache.logging.log4j.util.Strings;
 import org.junit.Test;
 
-import static org.apache.logging.log4j.junit.FileMatchers.beforeNow;
-import static org.apache.logging.log4j.junit.FileMatchers.hasLength;
-import static org.apache.logging.log4j.junit.FileMatchers.isEmpty;
-import static org.apache.logging.log4j.junit.FileMatchers.lastModified;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.beforeNow;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasLength;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.isEmpty;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.lastModified;
 import static org.hamcrest.Matchers.both;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.greaterThanOrEqualTo;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
index 14af83a..72c81a4 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
@@ -36,8 +36,8 @@ import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.apache.logging.log4j.junit.FileMatchers.exists;
-import static org.apache.logging.log4j.junit.FileMatchers.hasLength;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.exists;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasLength;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.instanceOf;
 import static org.junit.Assert.*;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
index df9383a..86efebd 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
@@ -24,8 +24,8 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
 
-import static org.apache.logging.log4j.junit.FileMatchers.exists;
-import static org.apache.logging.log4j.junit.FileMatchers.hasLength;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.exists;
+import static org.apache.logging.log4j.hamcrest.FileMatchers.hasLength;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.junit.Assert.*;
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/config/MissingRootLoggerTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/MissingRootLoggerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/MissingRootLoggerTest.java
index 14067a5..10fdacf 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/MissingRootLoggerTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/MissingRootLoggerTest.java
@@ -28,7 +28,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
-import static org.apache.logging.log4j.junit.MapMatchers.hasSize;
+import static org.apache.logging.log4j.hamcrest.MapMatchers.hasSize;
 import static org.hamcrest.Matchers.hasKey;
 import static org.hamcrest.Matchers.instanceOf;
 import static org.hamcrest.Matchers.is;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
index 22908ac..7b028e5 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
@@ -36,7 +36,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
-import static org.apache.logging.log4j.junit.MapMatchers.hasSize;
+import static org.apache.logging.log4j.hamcrest.MapMatchers.hasSize;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.hasKey;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java
index f2c9579..d5af747 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java
@@ -43,7 +43,7 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
-import static org.apache.logging.log4j.junit.MapMatchers.hasSize;
+import static org.apache.logging.log4j.hamcrest.MapMatchers.hasSize;
 import static org.hamcrest.Matchers.endsWith;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.instanceOf;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/FileMatchers.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/FileMatchers.java b/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/FileMatchers.java
new file mode 100644
index 0000000..7b4def9
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/FileMatchers.java
@@ -0,0 +1,180 @@
+/*
+ * 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.hamcrest;
+
+import java.io.File;
+
+import org.hamcrest.CustomMatcher;
+import org.hamcrest.FeatureMatcher;
+import org.hamcrest.Matcher;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.number.OrderingComparison.greaterThan;
+import static org.hamcrest.number.OrderingComparison.lessThanOrEqualTo;
+
+/**
+ * Hamcrest Matchers that operate on File objects.
+ *
+ * @since 2.1
+ */
+public final class FileMatchers {
+
+    /**
+     * Decorating Matcher similar to {@code is()}, but for better grammar.
+     *
+     * @param matcher the Matcher to decorate.
+     * @param <T> the type expected by the Matcher.
+     * @return the decorated Matcher.
+     */
+    public static <T> Matcher<T> that(final Matcher<T> matcher) {
+        return new CustomMatcher<T>("that") {
+            @Override
+            public boolean matches(final Object item) {
+                return matcher.matches(item);
+            }
+        };
+    }
+
+    /**
+     * Matches if the File exists.
+     *
+     * @return the Matcher.
+     */
+    public static Matcher<File> exists() {
+        return new FeatureMatcher<File, Boolean>(is(true), "file exists", "file exists") {
+            @Override
+            protected Boolean featureValueOf(final File actual) {
+                return actual.exists();
+            }
+        };
+    }
+
+    /**
+     * Matches a Long Matcher against the file length.
+     *
+     * @param matcher the Matcher to use on the File length.
+     * @return the Matcher.
+     */
+    public static Matcher<File> hasLength(final Matcher<Long> matcher) {
+        return new FeatureMatcher<File, Long>(matcher, "file with size", "file with size") {
+            @Override
+            protected Long featureValueOf(final File actual) {
+                return actual.length();
+            }
+        };
+    }
+
+    /**
+     * Matches a specific file length.
+     *
+     * @param length the file length to match
+     * @param <T>    the type of the length.
+     * @return the Matcher.
+     */
+    public static <T extends Number> Matcher<File> hasLength(final T length) {
+        return hasLength(equalTo(length.longValue()));
+    }
+
+    /**
+     * Matches a specific file length.
+     *
+     * @param length the file length to match
+     * @return the Matcher.
+     */
+    public static Matcher<File> hasLength(final long length) {
+        return hasLength(equalTo(length));
+    }
+
+    /**
+     * Matches a file with length equal to zero.
+     *
+     * @return the Matcher.
+     */
+    public static Matcher<File> isEmpty() {
+        return hasLength(0L);
+    }
+
+    /**
+     * Matches against a file's last modification time in milliseconds.
+     *
+     * @param matcher the Matcher to use on the File modification time.
+     * @return the Matcher.
+     */
+    public static Matcher<File> lastModified(final Matcher<Long> matcher) {
+        return new FeatureMatcher<File, Long>(matcher, "was last modified", "was last modified") {
+            @Override
+            protected Long featureValueOf(final File actual) {
+                return actual.lastModified();
+            }
+        };
+    }
+
+    /**
+     * Matches a time in millis before the current time.
+     *
+     * @return the Matcher.
+     */
+    public static Matcher<Long> beforeNow() {
+        return lessThanOrEqualTo(System.currentTimeMillis());
+    }
+
+    /**
+     * Matches the number of files in a directory.
+     *
+     * @param matcher the Matcher to use on the number of files.
+     * @return the Matcher.
+     */
+    public static Matcher<File> hasNumberOfFiles(final Matcher<Integer> matcher) {
+        return new FeatureMatcher<File, Integer>(matcher, "directory with number of files",
+            "directory with number of files") {
+            @Override
+            protected Integer featureValueOf(final File actual) {
+                final File[] files = actual.listFiles();
+                return files == null ? 0 : files.length;
+            }
+        };
+    }
+
+    /**
+     * Matches a directory with at least one file.
+     *
+     * @return the Matcher.
+     */
+    public static Matcher<File> hasFiles() {
+        return hasNumberOfFiles(greaterThan(0));
+    }
+
+    /**
+     * Matches a file name.
+     *
+     * @param matcher the Matcher to use on the file name.
+     * @return the Matcher.
+     */
+    public static Matcher<File> hasName(final Matcher<String> matcher) {
+        return new FeatureMatcher<File, String>(matcher, "file named", "file named") {
+            @Override
+            protected String featureValueOf(final File actual) {
+                return actual.getName();
+            }
+        };
+    }
+
+    private FileMatchers() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/MapMatchers.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/MapMatchers.java b/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/MapMatchers.java
new file mode 100644
index 0000000..805c8a6
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/hamcrest/MapMatchers.java
@@ -0,0 +1,62 @@
+/*
+ * 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.hamcrest;
+
+import java.util.Map;
+
+import org.hamcrest.FeatureMatcher;
+import org.hamcrest.Matcher;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+
+/**
+ * Hamcrest Matchers for Maps.
+ *
+ * @since 2.1
+ */
+public final class MapMatchers {
+
+    /**
+     * Returns a Map Matcher matching on the size of a Map.
+     *
+     * @param matcher the Matcher to match against the Map size.
+     * @param <K>     the key type.
+     * @param <V>     the value type.
+     */
+    public static <K, V> Matcher<Map<? extends K, ? extends V>> hasSize(final Matcher<Integer> matcher) {
+        return new FeatureMatcher<Map<? extends K, ? extends V>, Integer>(matcher, "map with size", "map with size") {
+            @Override
+            protected Integer featureValueOf(final Map<? extends K, ? extends V> actual) {
+                return actual.size();
+            }
+        };
+    }
+
+    /**
+     * Returns a Map Matcher matching on the exact size of a Map.
+     *
+     * @param size the number of entries to match the Map against.
+     * @param <K>  the key type.
+     * @param <V>  the value type.
+     */
+    public static <K, V> Matcher<Map<? extends K, ? extends V>> hasSize(final int size) {
+        return hasSize(equalTo(size));
+    }
+
+    private MapMatchers() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/junit/FileMatchers.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/junit/FileMatchers.java b/log4j-core/src/test/java/org/apache/logging/log4j/junit/FileMatchers.java
deleted file mode 100644
index 609118c..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/junit/FileMatchers.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.junit;
-
-import java.io.File;
-
-import org.hamcrest.CustomMatcher;
-import org.hamcrest.FeatureMatcher;
-import org.hamcrest.Matcher;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.hamcrest.number.OrderingComparison.greaterThan;
-import static org.hamcrest.number.OrderingComparison.lessThanOrEqualTo;
-
-/**
- * Hamcrest Matchers that operate on File objects.
- *
- * @since 2.1
- */
-public final class FileMatchers {
-
-    /**
-     * Decorating Matcher similar to {@code is()}, but for better grammar.
-     *
-     * @param matcher the Matcher to decorate.
-     * @param <T> the type expected by the Matcher.
-     * @return the decorated Matcher.
-     */
-    public static <T> Matcher<T> that(final Matcher<T> matcher) {
-        return new CustomMatcher<T>("that") {
-            @Override
-            public boolean matches(final Object item) {
-                return matcher.matches(item);
-            }
-        };
-    }
-
-    /**
-     * Matches if the File exists.
-     *
-     * @return the Matcher.
-     */
-    public static Matcher<File> exists() {
-        return new FeatureMatcher<File, Boolean>(is(true), "file exists", "file exists") {
-            @Override
-            protected Boolean featureValueOf(final File actual) {
-                return actual.exists();
-            }
-        };
-    }
-
-    /**
-     * Matches a Long Matcher against the file length.
-     *
-     * @param matcher the Matcher to use on the File length.
-     * @return the Matcher.
-     */
-    public static Matcher<File> hasLength(final Matcher<Long> matcher) {
-        return new FeatureMatcher<File, Long>(matcher, "file with size", "file with size") {
-            @Override
-            protected Long featureValueOf(final File actual) {
-                return actual.length();
-            }
-        };
-    }
-
-    /**
-     * Matches a specific file length.
-     *
-     * @param length the file length to match
-     * @param <T>    the type of the length.
-     * @return the Matcher.
-     */
-    public static <T extends Number> Matcher<File> hasLength(final T length) {
-        return hasLength(equalTo(length.longValue()));
-    }
-
-    /**
-     * Matches a specific file length.
-     *
-     * @param length the file length to match
-     * @return the Matcher.
-     */
-    public static Matcher<File> hasLength(final long length) {
-        return hasLength(equalTo(length));
-    }
-
-    /**
-     * Matches a file with length equal to zero.
-     *
-     * @return the Matcher.
-     */
-    public static Matcher<File> isEmpty() {
-        return hasLength(0L);
-    }
-
-    /**
-     * Matches against a file's last modification time in milliseconds.
-     *
-     * @param matcher the Matcher to use on the File modification time.
-     * @return the Matcher.
-     */
-    public static Matcher<File> lastModified(final Matcher<Long> matcher) {
-        return new FeatureMatcher<File, Long>(matcher, "was last modified", "was last modified") {
-            @Override
-            protected Long featureValueOf(final File actual) {
-                return actual.lastModified();
-            }
-        };
-    }
-
-    /**
-     * Matches a time in millis before the current time.
-     *
-     * @return the Matcher.
-     */
-    public static Matcher<Long> beforeNow() {
-        return lessThanOrEqualTo(System.currentTimeMillis());
-    }
-
-    /**
-     * Matches the number of files in a directory.
-     *
-     * @param matcher the Matcher to use on the number of files.
-     * @return the Matcher.
-     */
-    public static Matcher<File> hasNumberOfFiles(final Matcher<Integer> matcher) {
-        return new FeatureMatcher<File, Integer>(matcher, "directory with number of files",
-            "directory with number of files") {
-            @Override
-            protected Integer featureValueOf(final File actual) {
-                final File[] files = actual.listFiles();
-                return files == null ? 0 : files.length;
-            }
-        };
-    }
-
-    /**
-     * Matches a directory with at least one file.
-     *
-     * @return the Matcher.
-     */
-    public static Matcher<File> hasFiles() {
-        return hasNumberOfFiles(greaterThan(0));
-    }
-
-    /**
-     * Matches a file name.
-     *
-     * @param matcher the Matcher to use on the file name.
-     * @return the Matcher.
-     */
-    public static Matcher<File> hasName(final Matcher<String> matcher) {
-        return new FeatureMatcher<File, String>(matcher, "file named", "file named") {
-            @Override
-            protected String featureValueOf(final File actual) {
-                return actual.getName();
-            }
-        };
-    }
-
-    private FileMatchers() {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/960fb5fc/log4j-core/src/test/java/org/apache/logging/log4j/junit/MapMatchers.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/junit/MapMatchers.java b/log4j-core/src/test/java/org/apache/logging/log4j/junit/MapMatchers.java
deleted file mode 100644
index 7fd19a8..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/junit/MapMatchers.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.junit;
-
-import java.util.Map;
-
-import org.hamcrest.FeatureMatcher;
-import org.hamcrest.Matcher;
-
-import static org.hamcrest.core.IsEqual.equalTo;
-
-/**
- * Hamcrest Matchers for Maps.
- *
- * @since 2.1
- */
-public final class MapMatchers {
-
-    /**
-     * Returns a Map Matcher matching on the size of a Map.
-     *
-     * @param matcher the Matcher to match against the Map size.
-     * @param <K>     the key type.
-     * @param <V>     the value type.
-     */
-    public static <K, V> Matcher<Map<? extends K, ? extends V>> hasSize(final Matcher<Integer> matcher) {
-        return new FeatureMatcher<Map<? extends K, ? extends V>, Integer>(matcher, "map with size", "map with size") {
-            @Override
-            protected Integer featureValueOf(final Map<? extends K, ? extends V> actual) {
-                return actual.size();
-            }
-        };
-    }
-
-    /**
-     * Returns a Map Matcher matching on the exact size of a Map.
-     *
-     * @param size the number of entries to match the Map against.
-     * @param <K>  the key type.
-     * @param <V>  the value type.
-     */
-    public static <K, V> Matcher<Map<? extends K, ? extends V>> hasSize(final int size) {
-        return hasSize(equalTo(size));
-    }
-
-    private MapMatchers() {
-    }
-}