diff --git a/.travis.yml b/.travis.yml
index b6287adb..cdcd63e0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,22 +1,9 @@
language: java
-# Need to select an older Ubuntu distribution that supports JDK7
-dist: trusty
-
-# Workaround to using openjdk7 with Gradle due to security issue:
-# https://github.com/gradle/gradle/issues/2421
-before_install:
-- BCPROV_FILENAME=bcprov-ext-jdk15on-158.jar
-- wget "https://bouncycastle.org/download/${BCPROV_FILENAME}"
-- sudo mv $BCPROV_FILENAME /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
-- sudo perl -pi.bak -e 's/^(security\.provider\.)([0-9]+)/$1.($2+1)/ge' /etc/java-7-openjdk/security/java.security
-- echo "security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider" | sudo tee -a /etc/java-7-openjdk/security/java.security
-
jdk:
- - openjdk7
- - oraclejdk8
- openjdk8
- - oraclejdk9
+ - openjdk11
+ - openjdk12
script:
- ./gradlew clean build javadoc
diff --git a/build.gradle b/build.gradle
index 306f2488..3453efe0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,6 +7,7 @@ version = "2.2-SNAPSHOT"
subprojects {
apply plugin: 'java-library'
+ apply plugin: 'checkstyle'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
@@ -18,6 +19,24 @@ subprojects {
mavenCentral()
}
+ checkstyle {
+
+ project.ext.checkstyleVersion = '8.23'
+
+ sourceSets = [ project.sourceSets.main, project.sourceSets.test ]
+ ignoreFailures = false
+ configFile = file("${project.rootDir}/checkstyle.xml")
+
+ configurations {
+ checkstyle
+ }
+
+ dependencies{
+ assert project.hasProperty("checkstyleVersion")
+ checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
+ }
+ }
+
test {
testLogging {
exceptionFormat = 'full'
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 00000000..71a12974
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e0b3fb8d..ff9f5762 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@
+#Sun Aug 25 22:31:56 CEST 2019
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
-zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/HamcrestCoreIsDeprecated.java b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/HamcrestCoreIsDeprecated.java
index 19482c3d..395025c8 100644
--- a/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/HamcrestCoreIsDeprecated.java
+++ b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/HamcrestCoreIsDeprecated.java
@@ -1,3 +1,34 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest.core.deprecated;
/**
diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java
index 394ab821..579f5748 100644
--- a/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java
+++ b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java
@@ -1,3 +1,35 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* All classes in hamcrest-core.jar have been migrated to
* hamcrest.jar. Please use that dependency instead.
diff --git a/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java b/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java
index 936aa7d5..c18bccea 100644
--- a/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java
+++ b/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java
@@ -1,7 +1,38 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
-import org.hamcrest.integration.EasyMock2Adapter;
import org.hamcrest.core.IsEqual;
+import org.hamcrest.integration.EasyMock2Adapter;
/**
*
diff --git a/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java b/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java
index 6aac6f87..6b896b63 100644
--- a/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java
+++ b/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java
@@ -1,7 +1,38 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
-import org.hamcrest.integration.JMock1Adapter;
import org.hamcrest.core.IsEqual;
+import org.hamcrest.integration.JMock1Adapter;
import org.jmock.core.Constraint;
public class JMock1Matchers {
diff --git a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java
index 6cc97e81..b9afef9d 100644
--- a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java
+++ b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java
@@ -1,3 +1,34 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
/**
diff --git a/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java b/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java
index 09ab0f7d..2c04f752 100644
--- a/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java
+++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java
@@ -1,7 +1,38 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest.integration;
-import org.easymock.IArgumentMatcher;
import org.easymock.EasyMock;
+import org.easymock.IArgumentMatcher;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
@@ -18,6 +49,8 @@ public class EasyMock2Adapter implements IArgumentMatcher {
* Hamcrest {@link org.hamcrest.Matcher} to act as an
* EasyMock {@link org.easymock.IArgumentMatcher} and
* report it to EasyMock so it can be kept track of.
+ * @param matcher the matcher
+ * @return the wrapped matcher
*/
public static IArgumentMatcher adapt(Matcher> matcher) {
EasyMock2Adapter easyMock2Matcher = new EasyMock2Adapter(matcher);
diff --git a/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java b/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java
index fa2021ce..f61433bb 100644
--- a/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java
+++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java
@@ -1,8 +1,39 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest.integration;
-import org.jmock.core.Constraint;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
+import org.jmock.core.Constraint;
/**
* An adapter allowing a Hamcrest {@link org.hamcrest.Matcher}
@@ -18,6 +49,8 @@ public class JMock1Adapter implements Constraint {
* Convenience factory method that will adapt a
* Hamcrest {@link org.hamcrest.Matcher} to act as an
* jMock {@link org.jmock.core.Constraint}.
+ * @param matcher the matcher
+ * @return the adapted matcher
*/
public static Constraint adapt(Matcher> matcher) {
return new JMock1Adapter(matcher);
diff --git a/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/HamcrestLibraryIsDeprecated.java b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/HamcrestLibraryIsDeprecated.java
index b7ec20c3..4f3cd433 100644
--- a/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/HamcrestLibraryIsDeprecated.java
+++ b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/HamcrestLibraryIsDeprecated.java
@@ -1,3 +1,34 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest.library.deprecated;
/**
diff --git a/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java
index c98f5aff..b2226950 100644
--- a/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java
+++ b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java
@@ -1,3 +1,35 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* All classes in hamcrest-library.jar have been migrated to
* hamcrest.jar. Please use that dependency instead.
diff --git a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java
index d0c8fc41..a35f6c01 100644
--- a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java
+++ b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java
@@ -1,12 +1,41 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
-import org.hamcrest.internal.ArrayIterator;
-import org.hamcrest.internal.SelfDescribingValueIterator;
-
+import static java.lang.String.valueOf;
import java.util.Arrays;
import java.util.Iterator;
-
-import static java.lang.String.valueOf;
+import org.hamcrest.internal.ArrayIterator;
+import org.hamcrest.internal.SelfDescribingValueIterator;
/**
* A {@link Description} that is stored as a string.
@@ -18,13 +47,13 @@ public Description appendText(String text) {
append(text);
return this;
}
-
+
@Override
public Description appendDescriptionOf(SelfDescribing value) {
value.describeTo(this);
return this;
}
-
+
@Override
public Description appendValue(Object value) {
if (value == null) {
@@ -64,8 +93,7 @@ public Description appendValue(Object value) {
private String descriptionOf(Object value) {
try {
return valueOf(value);
- }
- catch (Exception e) {
+ } catch (Exception e) {
return value.getClass().getName() + "@" + Integer.toHexString(value.hashCode());
}
}
@@ -75,16 +103,16 @@ private String descriptionOf(Object value) {
public final Description appendValueList(String start, String separator, String end, T... values) {
return appendValueList(start, separator, end, Arrays.asList(values));
}
-
+
@Override
public Description appendValueList(String start, String separator, String end, Iterable values) {
return appendValueList(start, separator, end, values.iterator());
}
-
+
private Description appendValueList(String start, String separator, String end, Iterator values) {
return appendList(start, separator, end, new SelfDescribingValueIterator<>(values));
}
-
+
@Override
public Description appendList(String start, String separator, String end, Iterable extends SelfDescribing> values) {
return appendList(start, separator, end, values.iterator());
@@ -92,21 +120,23 @@ public Description appendList(String start, String separator, String end, Iterab
private Description appendList(String start, String separator, String end, Iterator extends SelfDescribing> i) {
boolean separate = false;
-
+
append(start);
while (i.hasNext()) {
- if (separate) append(separator);
+ if (separate) {
+ append(separator);
+ }
appendDescriptionOf(i.next());
separate = true;
}
append(end);
-
+
return this;
}
/**
- * Append the String str to the description.
- * The default implementation passes every character to {@link #append(char)}.
+ * Append the String str to the description.
+ * The default implementation passes every character to {@link #append(char)}.
* Override in subclasses to provide an efficient implementation.
*/
protected void append(String str) {
@@ -114,9 +144,9 @@ protected void append(String str) {
append(str.charAt(i));
}
}
-
+
/**
- * Append the char c to the description.
+ * Append the char c to the description.
*/
protected abstract void append(char c);
diff --git a/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java b/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java
index aaa6e957..b2b58cf0 100644
--- a/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java
+++ b/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java
@@ -1,8 +1,40 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
/**
* BaseClass for all Matcher implementations.
*
+ * @param allows to restrict the matched types
* @see Matcher
*/
public abstract class BaseMatcher implements Matcher {
diff --git a/hamcrest/src/main/java/org/hamcrest/Condition.java b/hamcrest/src/main/java/org/hamcrest/Condition.java
index 02ce09e6..b7f69705 100644
--- a/hamcrest/src/main/java/org/hamcrest/Condition.java
+++ b/hamcrest/src/main/java/org/hamcrest/Condition.java
@@ -1,3 +1,34 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
/**
@@ -8,22 +39,32 @@
*
* Based on https://github.com/npryce/maybe-java
* @author Steve Freeman 2012 http://www.hamcrest.com
+ * @param the type of matched objects
*/
-
public abstract class Condition {
public static final NotMatched
*
+ * @param the matcher type
* @see BaseMatcher
*/
public interface Matcher extends SelfDescribing {
@@ -39,12 +71,12 @@ public interface Matcher extends SelfDescribing {
* @see BaseMatcher
*/
boolean matches(Object actual);
-
+
/**
* Generate a description of why the matcher has not accepted the item.
* The description will be part of a larger description of why a matching
- * failed, so it should be concise.
- * This method assumes that matches(item) is false, but
+ * failed, so it should be concise.
+ * This method assumes that matches(item) is false, but
* will not check this.
*
* @param actual The item that the Matcher has rejected.
@@ -63,5 +95,7 @@ public interface Matcher extends SelfDescribing {
* @deprecated to make
*/
@Deprecated
+ //CHECKSTYLE:OFF
void _dont_implement_Matcher___instead_extend_BaseMatcher_();
+ //CHECKSTYLE:ON
}
diff --git a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java
index 049e1df3..4ff71658 100644
--- a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java
+++ b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java
@@ -1,11 +1,46 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
-
+/**
+ * A collection factory methods to create assertion matchers.
+ * @author richter
+ */
public class MatcherAssert {
+
public static void assertThat(T actual, Matcher super T> matcher) {
assertThat("", actual, matcher);
}
-
+
public static void assertThat(String reason, T actual, Matcher super T> matcher) {
if (!matcher.matches(actual)) {
Description description = new StringDescription();
@@ -14,11 +49,11 @@ public static void assertThat(String reason, T actual, Matcher super T> ma
.appendDescriptionOf(matcher)
.appendText("\n but: ");
matcher.describeMismatch(actual, description);
-
+
throw new AssertionError(description.toString());
}
}
-
+
public static void assertThat(String reason, boolean assertion) {
if (!assertion) {
throw new AssertionError(reason);
diff --git a/hamcrest/src/main/java/org/hamcrest/Matchers.java b/hamcrest/src/main/java/org/hamcrest/Matchers.java
index 30064b12..ab344e9f 100644
--- a/hamcrest/src/main/java/org/hamcrest/Matchers.java
+++ b/hamcrest/src/main/java/org/hamcrest/Matchers.java
@@ -1,1511 +1,1802 @@
+/**
+ * BSD License
+ *
+ * Copyright (c) 2000-2015 www.hamcrest.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of Hamcrest nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package org.hamcrest;
+import java.util.Collection;
+import java.util.EventObject;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
import org.hamcrest.collection.ArrayMatching;
import org.hamcrest.core.IsIterableContaining;
import org.hamcrest.core.StringRegularExpression;
import org.hamcrest.text.IsEqualCompressingWhiteSpace;
-import java.util.regex.Pattern;
+/**
+ * Factory methods for matchers.
+ */
+public class Matchers {
+
+ /**
+ * Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param matchers the matchers to match
+ * @return the created matcher
+ */
+ public static Matcher allOf(Iterable> matchers) {
+ return org.hamcrest.core.AllOf.allOf(matchers);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param matchers the matchers to match
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static Matcher allOf(Matcher super T>... matchers) {
+ return org.hamcrest.core.AllOf.allOf(matchers);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @return the created matcher
+ */
+ public static Matcher allOf(Matcher super T> first, Matcher super T> second) {
+ return org.hamcrest.core.AllOf.allOf(first, second);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @return the created matcher
+ */
+ public static Matcher allOf(Matcher super T> first, Matcher super T> second, Matcher super T> third) {
+ return org.hamcrest.core.AllOf.allOf(first, second, third);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @param fourth the forth matcher to match
+ * @return the created matcher
+ */
+ public static Matcher allOf(Matcher super T> first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth) {
+ return org.hamcrest.core.AllOf.allOf(first, second, third, fourth);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @param fourth the forth matcher to match
+ * @param fifth the fifth matcher to match
+ * @return the created matcher
+ */
+ public static Matcher allOf(Matcher super T> first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth, Matcher super T> fifth) {
+ return org.hamcrest.core.AllOf.allOf(first, second, third, fourth, fifth);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @param fourth the forth matcher to match
+ * @param fifth the fifth matcher to match
+ * @param sixth the sixth matcher to match
+ * @return the created matcher
+ */
+ public static Matcher allOf(Matcher super T> first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth, Matcher super T> fifth, Matcher super T> sixth) {
+ return org.hamcrest.core.AllOf.allOf(first, second, third, fourth, fifth, sixth);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param matchers the matchers to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.AnyOf anyOf(Iterable> matchers) {
+ return org.hamcrest.core.AnyOf.anyOf(matchers);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param matchers the matchers to match
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static org.hamcrest.core.AnyOf anyOf(Matcher super T>... matchers) {
+ return org.hamcrest.core.AnyOf.anyOf(matchers);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.AnyOf anyOf(Matcher super T> first, Matcher super T> second) {
+ return org.hamcrest.core.AnyOf.anyOf(first, second);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.AnyOf anyOf(Matcher first, Matcher super T> second, Matcher super T> third) {
+ return org.hamcrest.core.AnyOf.anyOf(first, second, third);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @param fourth the forth matcher to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.AnyOf anyOf(Matcher super T> first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth) {
+ return org.hamcrest.core.AnyOf.anyOf(first, second, third, fourth);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @param fourth the forth matcher to match
+ * @param fifth the fifth matcher to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.AnyOf anyOf(Matcher first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth, Matcher super T> fifth) {
+ return org.hamcrest.core.AnyOf.anyOf(first, second, third, fourth, fifth);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ * For example:
+ *
+ * @param the matcher type
+ * @param first the first matcher to match
+ * @param second the second matcher to match
+ * @param third the third matcher to match
+ * @param fourth the forth matcher to match
+ * @param fifth the fifth matcher to match
+ * @param sixth the sixth matcher to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.AnyOf anyOf(Matcher first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth, Matcher super T> fifth, Matcher super T> sixth) {
+ return org.hamcrest.core.AnyOf.anyOf(first, second, third, fourth, fifth, sixth);
+ }
+
+ /**
+ * Creates a matcher that matches when both of the specified matchers match the examined object.
+ * For example:
+ *
+ * @param the matcher type
+ * @param matcher the matcher to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcher both(Matcher super T> matcher) {
+ return org.hamcrest.core.CombinableMatcher.both(matcher);
+ }
+
+ /**
+ * Creates a matcher that matches when either of the specified matchers match the examined object.
+ * For example:
+ *
+ * @param the matcher type
+ * @param matcher the matcher to match
+ * @return the created matcher
+ */
+ public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher either(Matcher super T> matcher) {
+ return org.hamcrest.core.CombinableMatcher.either(matcher);
+ }
+
+ /**
+ * Wraps an existing matcher, overriding its description with that specified. All other functions are
+ * delegated to the decorated matcher, including its mismatch description.
+ * For example:
+ *
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
+ *
+ * @param the matcher type
+ * @param description
+ * the new description for the wrapped matcher
+ * @param matcher
+ * the matcher to wrap
+ * @param values
+ * optional values to insert into the tokenized description
+ * @return the created matcher
+ */
+ public static Matcher describedAs(String description, Matcher matcher, Object... values) {
+ return org.hamcrest.core.DescribedAs.describedAs(description, matcher, values);
+ }
+
+ /**
+ * Creates a matcher for {@link Iterable}s that only matches when a single pass over the
+ * examined {@link Iterable} yields items that are all matched by the specified
+ * itemMatcher.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param itemMatcher
+ * the matcher to apply to every item provided by the examined {@link Iterable}
+ * @return the created matcher
+ */
+ public static Matcher> everyItem(Matcher itemMatcher) {
+ return org.hamcrest.core.Every.everyItem(itemMatcher);
+ }
+
+ /**
+ * Decorates another Matcher, retaining its behaviour, but allowing tests
+ * to be slightly more expressive.
+ * For example:
+ *
assertThat(cheese, is(equalTo(smelly)))
+ * instead of:
+ *
assertThat(cheese, equalTo(smelly))
+ * @param the matcher type
+ * @param matcher the matcher to wrap
+ * @return the created matcher
+ */
+ public static Matcher is(Matcher matcher) {
+ return org.hamcrest.core.Is.is(matcher);
+ }
+
+ /**
+ * A shortcut to the frequently used is(equalTo(x)).
+ * For example:
+ *
assertThat(cheese, is(smelly))
+ * instead of:
+ *
assertThat(cheese, is(equalTo(smelly)))
+ * @param the matcher type
+ * @param value the value to match
+ * @return the created matcher
+ */
+ public static Matcher is(T value) {
+ return org.hamcrest.core.Is.is(value);
+ }
+
+ /**
+ * A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+ * For example:
+ *
assertThat(cheese, isA(Cheddar.class))
+ * instead of:
+ *
assertThat(cheese, is(instanceOf(Cheddar.class)))
+ * @param the matcher type
+ * @param type the type to match
+ * @return the created matcher
+ */
+ public static Matcher isA(Class> type) {
+ return org.hamcrest.core.Is.isA(type);
+ }
+
+ /**
+ * Creates a matcher that always matches, regardless of the examined object.
+ * @return the created matcher
+ */
+ public static Matcher anything() {
+ return org.hamcrest.core.IsAnything.anything();
+ }
+
+ /**
+ * Creates a matcher that always matches, regardless of the examined object, but describes
+ * itself with the specified {@link String}.
+ *
+ * @param description
+ * a meaningful {@link String} used when describing itself
+ * @return the created matcher
+ */
+ public static Matcher anything(String description) {
+ return org.hamcrest.core.IsAnything.anything(description);
+ }
+
+ /**
+ * Creates a matcher for {@link Iterable}s that only matches when a single pass over the
+ * examined {@link Iterable} yields at least one item that is matched by the specified
+ * itemMatcher. Whilst matching, the traversal of the examined {@link Iterable}
+ * will stop as soon as a matching item is found.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param itemMatcher
+ * the matcher to apply to items provided by the examined {@link Iterable}
+ * @return the created matcher
+ */
+ public static Matcher> hasItem(Matcher super T> itemMatcher) {
+ return IsIterableContaining.hasItem(itemMatcher);
+ }
+
+ /**
+ * Creates a matcher for {@link Iterable}s that only matches when a single pass over the
+ * examined {@link Iterable} yields at least one item that is equal to the specified
+ * item. Whilst matching, the traversal of the examined {@link Iterable}
+ * will stop as soon as a matching item is found.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param item
+ * the item to compare against the items provided by the examined {@link Iterable}
+ * @return the created matcher
+ */
+ public static Matcher> hasItem(T item) {
+ return IsIterableContaining.hasItem(item);
+ }
+
+ /**
+ * Creates a matcher for {@link Iterable}s that matches when consecutive passes over the
+ * examined {@link Iterable} yield at least one item that is matched by the corresponding
+ * matcher from the specified itemMatchers. Whilst matching, each traversal of
+ * the examined {@link Iterable} will stop as soon as a matching item is found.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param itemMatchers
+ * the matchers to apply to items provided by the examined {@link Iterable}
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static Matcher> hasItems(Matcher super T>... itemMatchers) {
+ return IsIterableContaining.hasItems(itemMatchers);
+ }
+
+ /**
+ * Creates a matcher for {@link Iterable}s that matches when consecutive passes over the
+ * examined {@link Iterable} yield at least one item that is equal to the corresponding
+ * item from the specified items. Whilst matching, each traversal of the
+ * examined {@link Iterable} will stop as soon as a matching item is found.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param items
+ * the items to compare against the items provided by the examined {@link Iterable}
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static Matcher> hasItems(T... items) {
+ return IsIterableContaining.hasItems(items);
+ }
+
+ /**
+ * Creates a matcher that matches when the examined object is logically equal to the specified
+ * operand, as determined by calling the {@link java.lang.Object#equals} method on
+ * the examined object.
+ *
+ *
If the specified operand is null then the created matcher will only match if
+ * the examined object's equals method returns true when passed a
+ * null (which would be a violation of the equals contract), unless the
+ * examined object itself is null, in which case the matcher will return a positive
+ * match.
+ *
+ *
The created matcher provides a special behaviour when examining Arrays, whereby
+ * it will match if both the operand and the examined object are arrays of the same length and
+ * contain items that are equal to each other (according to the above rules) in the same
+ * indexes.
+ * @param the matcher type
+ * @param operand the operand to match
+ * @return the created matcher
+ */
+ public static Matcher equalTo(T operand) {
+ return org.hamcrest.core.IsEqual.equalTo(operand);
+ }
+
+ /**
+ * Creates an {@link org.hamcrest.core.IsEqual} matcher that does not enforce the values being
+ * compared to be of the same static type.
+ * @param operand the operand to match
+ * @return the created matcher
+ */
+ public static Matcher equalToObject(Object operand) {
+ return org.hamcrest.core.IsEqual.equalToObject(operand);
+ }
+
+ /**
+ * Creates a matcher that matches when the examined object is an instance of the specified type,
+ * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the
+ * the examined object.
+ *
+ *
The created matcher forces a relationship between specified type and the examined object, and should be
+ * used when it is necessary to make generics conform, for example in the JMock clause
+ * with(any(Thing.class))
+ * For example:
+ *
assertThat(new Canoe(), instanceOf(Canoe.class));
+ * @param the matcher type
+ * @param type the type to match
+ * @return the created matcher
+ */
+ public static Matcher any(Class type) {
+ return org.hamcrest.core.IsInstanceOf.any(type);
+ }
+
+ /**
+ * Creates a matcher that matches when the examined object is an instance of the specified type,
+ * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the
+ * the examined object.
+ *
+ *
The created matcher assumes no relationship between specified type and the examined object.
+ * @param the matcher type
+ * @param type the type to match
+ * @return the created matcher
+ */
+ public static Matcher instanceOf(Class> type) {
+ return org.hamcrest.core.IsInstanceOf.instanceOf(type);
+ }
+
+ /**
+ * Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ * it will match.
+ * For example:
+ *
assertThat(cheese, is(not(equalTo(smelly))))
+ *
+ * @param the matcher type
+ * @param matcher
+ * the matcher whose sense should be inverted
+ * @return the created matcher
+ */
+ public static Matcher not(Matcher matcher) {
+ return org.hamcrest.core.IsNot.not(matcher);
+ }
+
+ /**
+ * A shortcut to the frequently used not(equalTo(x)).
+ * For example:
+ *
assertThat(cheese, is(not(smelly)))
+ * instead of:
+ *
assertThat(cheese, is(not(equalTo(smelly))))
+ *
+ * @param the matcher type
+ * @param value
+ * the value that any examined object should not equal
+ * @return the created matcher
+ */
+ public static Matcher not(T value) {
+ return org.hamcrest.core.IsNot.not(value);
+ }
+
+ /**
+ * A shortcut to the frequently used not(nullValue()).
+ * For example:
+ *
assertThat(cheese, is(notNullValue()))
+ * instead of:
+ *
assertThat(cheese, is(not(nullValue())))
+ * @return the created matcher
+ */
+ public static Matcher notNullValue() {
+ return org.hamcrest.core.IsNull.notNullValue();
+ }
+
+ /**
+ * A shortcut to the frequently used not(nullValue(X.class)). Accepts a
+ * single dummy argument to facilitate type inference..
+ * For example:
+ *
assertThat(cheese, is(notNullValue(X.class)))
+ * instead of:
+ *
assertThat(cheese, is(not(nullValue(X.class))))
+ *
+ * @param the matcher type
+ * @param type
+ * dummy parameter used to infer the generic type of the returned matcher
+ * @return the created matcher
+ */
+ public static Matcher notNullValue(Class type) {
+ return org.hamcrest.core.IsNull.notNullValue(type);
+ }
+
+ /**
+ * Creates a matcher that matches if examined object is null.
+ * For example:
+ *
assertThat(cheese, is(nullValue())
+ * @return the created matcher
+ */
+ public static Matcher nullValue() {
+ return org.hamcrest.core.IsNull.nullValue();
+ }
+
+ /**
+ * Creates a matcher that matches if examined object is null. Accepts a
+ * single dummy argument to facilitate type inference.
+ * For example:
+ *
assertThat(cheese, is(nullValue(Cheese.class))
+ *
+ * @param the matcher type
+ * @param type
+ * dummy parameter used to infer the generic type of the returned matcher
+ * @return the created matcher
+ */
+ public static Matcher nullValue(Class type) {
+ return org.hamcrest.core.IsNull.nullValue(type);
+ }
+
+ /**
+ * Creates a matcher that matches only when the examined object is the same instance as
+ * the specified target object.
+ *
+ * @param the matcher type
+ * @param target
+ * the target instance against which others should be assessed
+ * @return the created matcher
+ */
+ public static Matcher sameInstance(T target) {
+ return org.hamcrest.core.IsSame.sameInstance(target);
+ }
+
+ /**
+ * Creates a matcher that matches only when the examined object is the same instance as
+ * the specified target object.
+ *
+ * @param the matcher type
+ * @param target
+ * the target instance against which others should be assessed
+ * @return the created matcher
+ */
+ public static Matcher theInstance(T target) {
+ return org.hamcrest.core.IsSame.theInstance(target);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined {@link String} contains the specified
+ * {@link String} anywhere.
+ * For example:
+ *
+ *
+ * @param substring
+ * the substring that the returned matcher will expect to find within any examined string
+ * @return the created matcher
+ */
+ public static Matcher containsString(String substring) {
+ return org.hamcrest.core.StringContains.containsString(substring);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined {@link String} contains the specified
+ * {@link String} anywhere, ignoring case.
+ * For example:
+ *
+ *
+ * @param substring
+ * the substring that the returned matcher will expect to find within any examined string
+ * @return the created matcher
+ */
+ public static Matcher containsStringIgnoringCase(String substring) {
+ return org.hamcrest.core.StringContains.containsStringIgnoringCase(substring);
+ }
+
+ /**
+ *
+ * Creates a matcher that matches if the examined {@link String} starts with the specified
+ * {@link String}.
+ *
+ * For example:
+ *
assertThat("myStringOfNote", startsWith("my"))
+ *
+ * @param prefix
+ * the substring that the returned matcher will expect at the start of any examined string
+ * @return the created matcher
+ */
+ public static Matcher startsWith(String prefix) {
+ return org.hamcrest.core.StringStartsWith.startsWith(prefix);
+ }
+
+ /**
+ *
+ * Creates a matcher that matches if the examined {@link String} starts with the specified
+ * {@link String}, ignoring case
+ *
+ *
+ * @param prefix
+ * the substring that the returned matcher will expect at the start of any examined string
+ * @return the created matcher
+ */
+ public static Matcher startsWithIgnoringCase(String prefix) {
+ return org.hamcrest.core.StringStartsWith.startsWithIgnoringCase(prefix);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined {@link String} ends with the specified
+ * {@link String}.
+ * For example:
+ *
assertThat("myStringOfNote", endsWith("Note"))
+ *
+ * @param suffix
+ * the substring that the returned matcher will expect at the end of any examined string
+ * @return the created matcher
+ */
+ public static Matcher endsWith(String suffix) {
+ return org.hamcrest.core.StringEndsWith.endsWith(suffix);
+ }
+
+ /**
+ * Creates a matcher that matches if the examined {@link String} ends with the specified
+ * {@link String}, ignoring case.
+ * For example:
+ *
+ *
+ * @param suffix
+ * the substring that the returned matcher will expect at the end of any examined string
+ * @return the created matcher
+ */
+ public static Matcher endsWithIgnoringCase(String suffix) {
+ return org.hamcrest.core.StringEndsWith.endsWithIgnoringCase(suffix);
+ }
+
+ /**
+ * Validate a string with a {@link java.util.regex.Pattern}.
+ *
+ *
+ *
+ * @param regex
+ * The regex to be used for the validation.
+ * @return the created matcher
+ */
+ public static Matcher matchesRegex(String regex) {
+ return StringRegularExpression.matchesRegex(Pattern.compile(regex));
+ }
+
+ /**
+ * Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. Matches
+ * positively only if the number of matchers specified is equal to the length of the examined array and
+ * each matcher[i] is satisfied by array[i].
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param elementMatchers
+ * the matchers that the elements of examined arrays should satisfy
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static org.hamcrest.collection.IsArray array(Matcher super T>... elementMatchers) {
+ return org.hamcrest.collection.IsArray.array(elementMatchers);
+ }
+
+ /**
+ * Creates a matcher for arrays that matches when the examined array contains at least one item
+ * that is matched by the specified elementMatcher. Whilst matching, the traversal
+ * of the examined array will stop as soon as a matching element is found.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param elementMatcher
+ * the matcher to apply to elements in examined arrays
+ * @return the created matcher
+ */
+ public static Matcher hasItemInArray(Matcher super T> elementMatcher) {
+ return ArrayMatching.hasItemInArray(elementMatcher);
+ }
+
+ /**
+ * A shortcut to the frequently used hasItemInArray(equalTo(x)).
+ * For example:
+ *
assertThat(hasItemInArray(x))
+ * instead of:
+ *
assertThat(hasItemInArray(equalTo(x)))
+ *
+ * @param the matcher type
+ * @param element
+ * the element that should be present in examined arrays
+ * @return the created matcher
+ */
+ public static Matcher hasItemInArray(T element) {
+ return ArrayMatching.hasItemInArray(element);
+ }
+
+ /**
+ * Creates a matcher for arrays that matches when each item in the examined array is
+ * logically equal to the corresponding item in the specified items. For a positive match,
+ * the examined array must be of the same length as the number of specified items.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param items
+ * the items that must equal the items within an examined array
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static Matcher arrayContaining(T... items) {
+ return ArrayMatching.arrayContaining(items);
+ }
+
+ /**
+ * Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ * corresponding matcher in the specified matchers. For a positive match, the examined array
+ * must be of the same length as the number of specified matchers.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param itemMatchers
+ * the matchers that must be satisfied by the items in the examined array
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static Matcher arrayContaining(Matcher super T>... itemMatchers) {
+ return ArrayMatching.arrayContaining(itemMatchers);
+ }
+
+ /**
+ * Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ * corresponding matcher in the specified list of matchers. For a positive match, the examined array
+ * must be of the same length as the specified list of matchers.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param itemMatchers
+ * a list of matchers, each of which must be satisfied by the corresponding item in an examined array
+ * @return the created matcher
+ */
+ public static Matcher arrayContaining(List> itemMatchers) {
+ return ArrayMatching.arrayContaining(itemMatchers);
+ }
+
+ /**
+ *
+ * Creates an order agnostic matcher for arrays that matches when each item in the
+ * examined array satisfies one matcher anywhere in the specified matchers.
+ * For a positive match, the examined array must be of the same length as the number of
+ * specified matchers.
+ *
+ *
+ * N.B. each of the specified matchers will only be used once during a given examination, so be
+ * careful when specifying matchers that may be satisfied by more than one entry in an examined
+ * array.
+ *
+ *
+ * @param the matcher type
+ * @param itemMatchers
+ * a list of matchers, each of which must be satisfied by an entry in an examined array
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static Matcher arrayContainingInAnyOrder(Matcher super T>... itemMatchers) {
+ return ArrayMatching.arrayContainingInAnyOrder(itemMatchers);
+ }
+
+ /**
+ *
+ * Creates an order agnostic matcher for arrays that matches when each item in the
+ * examined array satisfies one matcher anywhere in the specified collection of matchers.
+ * For a positive match, the examined array must be of the same length as the specified collection
+ * of matchers.
+ *
+ *
+ * N.B. each matcher in the specified collection will only be used once during a given
+ * examination, so be careful when specifying matchers that may be satisfied by more than
+ * one entry in an examined array.
+ *
+ *
+ * @param the matcher type
+ * @param itemMatchers
+ * a list of matchers, each of which must be satisfied by an item provided by an examined array
+ * @return the created matcher
+ */
+ public static Matcher arrayContainingInAnyOrder(Collection> itemMatchers) {
+ return ArrayMatching.arrayContainingInAnyOrder(itemMatchers);
+ }
+
+ /**
+ *
Creates an order agnostic matcher for arrays that matches when each item in the
+ * examined array is logically equal to one item anywhere in the specified items.
+ * For a positive match, the examined array must be of the same length as the number of
+ * specified items.
+ *
+ *
N.B. each of the specified items will only be used once during a given examination, so be
+ * careful when specifying items that may be equal to more than one entry in an examined
+ * array.
+ *
+ *
+ * @param the matcher type
+ * @param items
+ * the items that must equal the entries of an examined array, in any order
+ * @return the created matcher
+ */
+ @SafeVarargs
+ public static Matcher arrayContainingInAnyOrder(T... items) {
+ return ArrayMatching.arrayContainingInAnyOrder(items);
+ }
+
+ /**
+ * Creates a matcher for arrays that matches when the length of the array
+ * satisfies the specified matcher.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param sizeMatcher
+ * a matcher for the length of an examined array
+ * @return the created matcher
+ */
+ public static Matcher arrayWithSize(Matcher super Integer> sizeMatcher) {
+ return org.hamcrest.collection.IsArrayWithSize.arrayWithSize(sizeMatcher);
+ }
+
+ /**
+ * Creates a matcher for arrays that matches when the length of the array
+ * equals the specified size.
+ * For example:
+ *
+ *
+ * @param the matcher type
+ * @param size
+ * the length that an examined array must have for a positive match
+ * @return the created matcher
+ */
+ public static Matcher arrayWithSize(int size) {
+ return org.hamcrest.collection.IsArrayWithSize.arrayWithSize(size);
+ }
+
+ /**
+ * Creates a matcher for arrays that matches when the length of the array
+ * is zero.
+ * For example:
+ *
assertThat(new String[0], emptyArray())
+ * @param the matcher type
+ * @return the created matcher
+ */
+ public static Matcher emptyArray() {
+ return org.hamcrest.collection.IsArrayWithSize.emptyArray();
+ }
+
+ /**
+ * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns
+ * a value that satisfies the specified matcher.
+ * For example:
+ *
assertThat(myMap, is(aMapWithSize(equalTo(2))))
+ *
+ * @param the map key type
+ * @param the map value type
+ * @param sizeMatcher
+ * a matcher for the size of an examined {@link java.util.Map}
+ * @return the created matcher
+ */
+ public static Matcher