diff --git a/.classpath b/.classpath deleted file mode 100644 index fc81595d..00000000 --- a/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/.gitignore b/.gitignore index 31a9c703..725179b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,18 @@ -/build -/classes -.idea/dictionaries -.idea/scopes -.idea/workspace.xml +build/ +classes/ +bin/ +out/ +.DS_Store +*~ +*.swp +.idea/ +*.iws +*.ipr +*.iml +.classpath +.gradle +.project +.settings/ +gradle.properties +release-key.asc +grade-wrapper.properties diff --git a/.idea/ant.xml b/.idea/ant.xml deleted file mode 100644 index 4674eeac..00000000 --- a/.idea/ant.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 97c9ca5c..00000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index 3572571a..00000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index e206d70d..00000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index c76e85a4..00000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 3b312839..00000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/libraries/ant_output.xml b/.idea/libraries/ant_output.xml deleted file mode 100644 index 30fe6ed1..00000000 --- a/.idea/libraries/ant_output.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/generator.xml b/.idea/libraries/generator.xml deleted file mode 100644 index 75c71620..00000000 --- a/.idea/libraries/generator.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/integration.xml b/.idea/libraries/integration.xml deleted file mode 100644 index 7858148a..00000000 --- a/.idea/libraries/integration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 42045f44..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - http://www.w3.org/1999/xhtml - - - - - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index bc1e8934..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 3b000203..00000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 0076118a..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index bdb236ff..00000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,817 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - localhost - 5050 - - - - - - - - - 1333703332412 - 1333703507020 - - - - 1333703329722 - 1333703329722 - - - 1333703620906 - 1333703620906 - - - 1333703679220 - 1333703679220 - - - 1333703768216 - 1333703768216 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No facets are configured - - - - - - - - - - - - - - - 1.6 - - - - - - - - hamcrest-core - - - - - - - - - integration - - - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index 9d643ab9..00000000 --- a/.project +++ /dev/null @@ -1,46 +0,0 @@ - - - hamcrest-java - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - - 1337464735913 - - 26 - - org.eclipse.ui.ide.multiFilter - 1.0-projectRelativePath-matches-false-false-build/temp/build - - - - 1337464735918 - - 30 - - org.eclipse.ui.ide.multiFilter - 1.0-projectRelativePath-matches-false-true-build/.*\.((?!java).)*$ - - - - 1337464735922 - - 26 - - org.eclipse.ui.ide.multiFilter - 1.0-projectRelativePath-matches-false-false-build/javadoc - - - - diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d147313f..00000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,81 +0,0 @@ -#Sat May 19 16:48:52 BST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=warning -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..b6287adb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +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 + +script: + - ./gradlew clean build javadoc diff --git a/BUILDING.txt b/BUILDING.txt index f466d75c..b5af7f6f 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -4,54 +4,14 @@ --[ Build requirements ]------------------------------------- -* JDK 1.5 - Note: that this is a buildtime dependency for 1.5 specific - features. However the final built jars should run on 1.4 - and 1.3 JVMs with some features unavailable. - -* Ant 1.6 or greater - To enable testing support, ensure junit.jar exists in - ANT_HOME/lib. - +* JDK 1.7 --[ Building from the command line ]------------------------- -Execute the default ant target: - ant - -This will do a full clean build, run all tests and (if -successful) package up a distribution. The resulting builds -reside in the 'build' directory. - -For a list of finer grained build operations: - ant -projecthelp - -The default version number used in the build is 'SNAPSHOT'. -To override this, you can pass a property to ant: - ant -Dversion=MY.OTHER.VERSION - - ---[ Building from the IDE ]---------------------------------- - -It is possible to compile and test the source directly from -popular IDEs, without resorting to the command line. - -Steps: - - Run 'ant library'. This generates additional Java coded - necessary to compile. - - Create a new project. - - Add the following directories as source directories: - hamcrest-core/src/main/java - hamcrest-library/src/main/java - hamcrest-generator/src/main/java - hamcrest-integration/src/main/java - build/temp/hamcrest-core/generated-code - build/temp/hamcrest-library/generated-code - - Add hamcrest-unit-test/src/main/java as a test directory. - If this is unsupported by the IDE, add it as another source - directory. - - Include all jars in the lib directory in the classpath. - - Compile as usual in the IDE. - - If supported, run all tests under org.hamcrest from the - IDEs JUnit runner. +Execute Gradle target: + ./gradlew clean build javadoc +This will download the correct version of Gradle, do a full +clean build, run all tests and (if successful) package up +a distribution. The resulting builds reside in the 'build' +directory. diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 00000000..859f7b46 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,135 @@ +# Hamcrest Changes + +## Version 2.2 (Unreleased) + +### Improvements + +* AllOf/AnyOf: Pass the matchers to constructor using varargs ([Issue #245](https://github.com/hamcrest/JavaHamcrest/pull/245)) +* Matchers.anyOf: Fix generic bounds compatibility for JDK 11 ([Issue #256](https://github.com/hamcrest/JavaHamcrest/issues/256), [Issue #257](https://github.com/hamcrest/JavaHamcrest/issues/257)) +* AssertionError message is unhelpful when match fails for byte type ([Issue #254](https://github.com/hamcrest/JavaHamcrest/issues/254), [Issue #255](https://github.com/hamcrest/JavaHamcrest/issues/255)) +* Use platform specific line breaks ([PR #267](https://github.com/hamcrest/JavaHamcrest/pull/267)) +* Build now checks for consistent use of spaces ([PR #217](https://github.com/hamcrest/JavaHamcrest/pull/217)) + +### Bugfixes +* Fix compatibility issue for development with Android D8 ([Issue #246](https://github.com/hamcrest/JavaHamcrest/issues/246)) +* Fix typo in license name ([Issue #247](https://github.com/hamcrest/JavaHamcrest/pull/247)) +* 1.3 compatible constructors for string matchers ([Issue #259](https://github.com/hamcrest/JavaHamcrest/issues/259), [Issue #260](https://github.com/hamcrest/JavaHamcrest/issues/260)) +* Fix for split packages with Java 9 modules ([Issue #269](https://github.com/hamcrest/JavaHamcrest/issues/269), [PR #270](https://github.com/hamcrest/JavaHamcrest/pull/270)) + + +## Version 2.1 (21st December 2018) + +### Overview for 2.1 + +After a long hiatus without releases, this version simplifies the packaging of +Hamcrest into a single jar: `hamcrest-.jar`. Other big changes include +Java 9 module compatibility, migrating the code repository from Google Code to +GitHub, along with numerous other new features, improvements and bug fixes. + +### Breaking Changes for 2.1 + +* The way that the project is packaged has changed. This may cause problems with +correctly upgrading transitive dependencies. Refer to the +[Hamcrest Distributables](http://hamcrest.org/JavaHamcrest/distributables.html) +documentation for more information, and in particular, +[Upgrading from Hamcrest 1.x](http://hamcrest.org/JavaHamcrest/distributables.html#upgrading-from-hamcrest-1.x) +* `org.hamcrest.Factory` has been removed. This was only used in old implementations +of the hamcrest build toolchain, and can safely be deleted from client code without +any effect. + +### Changes for 2.1 + +* Documentation updates +* Several JavaDoc improvements and corrections +* Fix JavaDoc examples +* Upgraded to Java 7 +* Build with Gradle +* Publish a single jar `hamcrest-2.1.jar` +* Publish pom-only artifacts for `hamcrest-core` and `hamcrest-library`. +* Add implementation for CharSequence length matcher +* Fix for TypeSafeDiagnosingMatcher can't detect generic types for subclass +* Make Hamcrest an OSGI bundle +* Add StringRegularExpression matcher +* Fix StringContainsInOrder to detect if a repeated pattern is missing +* Add ArrayAsIterableMatcher +* Fix description for IsEqualIgnoringCase +* Removed deprecated methods from previous release +* Improve mismatch description of hasItem/hasItems +* General improvements to mismatch descriptions +* Deprecated several matcher factory methods of the for "isXyz" +* Fix [GH issue #75](https://github.com/hamcrest/JavaHamcrest/issues/75) - address doclint errors reported in JDK 1.8 +* Fix [GH issue #69](https://github.com/hamcrest/JavaHamcrest/issues/69) - Iterable contains in order is null-safe +* Fix [GH issue #59](https://github.com/hamcrest/JavaHamcrest/issues/59) - added equalToObject() (i.e. unchecked) method +* Fix [GH issue #25](https://github.com/hamcrest/JavaHamcrest/issues/25) - arrayContaining(null, null) cause NullPointerException +* Fix [GH issue #36](https://github.com/hamcrest/JavaHamcrest/issues/36) - string matching on regular expressions +* Fix [GH issue #8](https://github.com/hamcrest/JavaHamcrest/issues/8) - isCloseTo() shows wrong delta in mismatch description +* Fix [GH issue #59](https://github.com/hamcrest/JavaHamcrest/issues/59) - add untyped version of equalTo, named equalToObject +* Fix [GC issue #131](https://code.google.com/archive/p/hamcrest/issues/131) - Implement IsEmptyMap, IsMapWithSize +* Fix [GC issue #187](https://code.google.com/archive/p/hamcrest/issues/187) - IsArray.describeMismatchSafely() should use Matcher.describeMismatch +* Fix [GC issue #155](https://code.google.com/archive/p/hamcrest/issues/155) - Add Matcher implementation for files +* Fix [GC issue #69](https://code.google.com/archive/p/hamcrest/issues/69) - fix NPE in IsIterableContainingInOrder + +## Version 1.3 (9th July 2012) + +* Introduce Condition class to ease the implementation of multi-step matches +* Upgrade qdox (included in the generator) to the latest stable version +* Correct inadvertent deprecation of the Is.isA factory method +* Fix [issue #179](https://code.google.com/archive/p/hamcrest/issues/179) - AllOf does not output mismatch description +* Fix [issue #177](https://code.google.com/archive/p/hamcrest/issues/177) - Introduced closeTo matcher for BigDecimals +* Fix [issue #152](https://code.google.com/archive/p/hamcrest/issues/152) - Factory classes missing from matchers.xml +* Fix [issue #144](https://code.google.com/archive/p/hamcrest/issues/144) - OrderingComparison doesn't describe mismatch of comparables that return values other than (-1,0,1) +* Fix [issue #134](https://code.google.com/archive/p/hamcrest/issues/134) - DescribedAs does not delegate describeMismatch +* Fix [issue #106](https://code.google.com/archive/p/hamcrest/issues/106) - deprecation warning when writing custom matchers +* Fix [issue #101](https://code.google.com/archive/p/hamcrest/issues/101) - Added theInstance alias for sameInstance factory method + +## Version 1.3 RC2 (22nd October 2010) + +* Added FeatureMatcher +* distinguish between instanceOf() and any() + +## Version 1.2 (16th May 2009) + +* Added mismatch reporting +* Added WithSamePropertyValuesAs matcher +* Moved any() from IsAnything to IsInstanceOf. It now checks the type of the matched object +* Moved MatcherAssert from integration to core +* Tightened up generics. +* Added IsMapContainingKey and IsMapContainingValue matchers to resolve a + generics bug in hasKey and hasValue static factories previously declared + in IsMapContaining (ngd) +* Added IsCollectionOnlyContaining and IsArrayOnlyContaining which matches + collections (and arrays) where all match a given matcher. E.g onlyContains(3,4,5) + or onlyContains(lessThan(9)) +* text module moved to separate project, hamcrest-text-patterns +* added more colection matchers: xContainingInAnyOrder, xContainingInOrder, xWithSize +* new text Matcher: IsEmptyString +* hamcrest generator uses method return type + +## Version 1.1 (30th June 2007) + +* Hamcrest Generator now includes JavaDoc and parameter names in generated code + by using QDox to parse the source code. +* Created hamcrest-core.jar (and removed hamcrest-api.jar). + Moved core set of matchers (and, eq, not, etc) + to this package to make it more practical for external libraries + to embed Hamcrest. +* Created CoreMatchers (static import sugar) in hamcrest-core.jar. +* StringBuilder can use any Appendable (not just StringBuffer). +* Added sensible toString() method to BaseMatcher. +* Created StringDescription.asString() alias (because toString() caused issues + with static imports). +* Relaxed isInstanceOf() matcher generic type so it can be used on any kind of + object. e.g. assertThat(someUnknownObject, isInstanceOf(String.class)); +* Added any(Class), null(Class) and notNull(Class) matchers, which returns + Matcher. Helpful when the compiler struggles with type inference. +* Modified anyOf() and allOf() to accept mixed-types. +* TypeSafeMatcher.matchesSafely() is now public. +* Generator recognizes @Factory methods that return subclass of Matcher. + (Fix by David Saff) + +## Version 1.0 (15th Dececmber 2006) + +Initial release. + +* Support for namespaces in HasXPath +* Bug fix for matching empty elements with HasXPath diff --git a/CHANGES.txt b/CHANGES.txt deleted file mode 100644 index fee721a3..00000000 --- a/CHANGES.txt +++ /dev/null @@ -1,93 +0,0 @@ -== Version 1.3: Not yet released == - -* Introduce Condition class to ease the implementation of multi-step matches - -* Upgrade qdox (included in the generator) to the latest stable version - -* Correct inadvertent deprecation of the Is.isA factory method - -* Fix issue 179 - AllOf does not output mismatch description - -* Fix issue 177 - Introduced closeTo matcher for BigDecimals - -* Fix issue 152 - Factory classes missing from matchers.xml - -* Fix issue 144 - OrderingComparison doesn't describe mismatch of comparables that return values other than (-1,0,1) - -* Fix issue 134 - DescribedAs does not delegate describeMismatch - -* Fix issue 106 - deprecation warning when writing custom matchers - -* Fix issue 101 - Added theInstance alias for sameInstance factory method - -== Version 1.3 RC2: Released October 22 2010 == - -* Added FeatureMatcher - -* distinguish between instanceOf() and any() - -== Version 1.2: Released May 16 2009 == - -* Added mismatch reporting - -* Added WithSamePropertyValuesAs matcher - -* Moved any() from IsAnything to IsInstanceOf. It now checks the type of the matched object - -* Moved MatcherAssert from integration to core - -* Tightened up generics. - -* Added IsMapContainingKey and IsMapContainingValue matchers to resolve a - generics bug in hasKey and hasValue static factories previously declared - in IsMapContaining (ngd) - -* Added IsCollectionOnlyContaining and IsArrayOnlyContaining which matches - collections (and arrays) where all match a given matcher. E.g onlyContains(3,4,5) - or onlyContains(lessThan(9)) - -* text module moved to separate project, hamcrest-text-patterns - -* added more colection matchers: xContainingInAnyOrder, xContainingInOrder, xWithSize - -* new text Matcher: IsEmptyString - -* hamcrest generator uses method return type - -== Version 1.1: Released Jun 30 2007 == - -* Hamcrest Generator now includes JavaDoc and parameter names in generated code - by using QDox to parse the source code. - -* Created hamcrest-core.jar (and removed hamcrest-api.jar). - Moved core set of matchers (and, eq, not, etc) - to this package to make it more practical for external libraries - to embed Hamcrest. - -* Created CoreMatchers (static import sugar) in hamcrest-core.jar. - -* StringBuilder can use any Appendable (not just StringBuffer). - -* Added sensible toString() method to BaseMatcher. - -* Created StringDescription.asString() alias (because toString() caused issues - with static imports). - -* Relaxed isInstanceOf() matcher generic type so it can be used on any kind of - object. e.g. assertThat(someUnknownObject, isInstanceOf(String.class)); - -* Added any(Class), null(Class) and notNull(Class) matchers, which returns - Matcher. Helpful when the compiler struggles with type inference. - -* Modified anyOf() and allOf() to accept mixed-types. - -* TypeSafeMatcher.matchesSafely() is now public. - -* Generator recognizes @Factory methods that return subclass of Matcher. - (Fix by David Saff) - -== Version 1.0: Released Dec 15 2006 == - -Initial release. -* Support for namespaces in HasXPath -* Bug fix for matching empty elements with HasXPath diff --git a/LICENSE.txt b/LICENSE.txt index 5ebe92c5..1b869027 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ BSD License -Copyright (c) 2000-2006, www.hamcrest.org +Copyright (c) 2000-2015 www.hamcrest.org All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md new file mode 100644 index 00000000..57fbe8c1 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +![JavaHamcrest](http://hamcrest.org/images/logo.jpg) + +[![Build Status](https://travis-ci.org/hamcrest/JavaHamcrest.png?branch=master)](https://travis-ci.org/hamcrest/JavaHamcrest) + +Java Hamcrest +============= +Licensed under [BSD License][]. + +What is Hamcrest? +----------------- +Hamcrest is a library of matchers, which can be combined in to create flexible expressions of intent in tests. +They've also been used for other purposes. + +Downloads +--------- +You can obtain Hamcrest binaries from [maven central][]. + +Extensions +---------- + +For Hamcrest extension projects see the [hamcrest extensions page][]. + +Documentation +------------- +Documentation can be found on the [Hamcrest site](http://hamcrest.org). + +Reporting Bugs/Issues +--------------------- +If you find an issue with Java Hamcrest, please report it via the +[GitHub issue tracker](https://github.com/hamcrest/JavaHamcrest/issues), +after first checking that it hasn't been raised already. + +Source +------ +To build, please read BUILDING.txt + +Acknowledgements +---------------- +Developers: + + * Joe Walnes + * Nat Pryce + * Steve Freeman + +Contributors: + + * Robert Chatley + * Tom White + * Neil Dunn + * Dan North + * Magne Rasmussen + * David Saff + * Tom Denley + +Also, thanks to everyone who has worked on DynaMock, nMock, jMock, EasyMock and MiniMock! These libraries inspired Hamcrest. + + +[logo]: http://hamcrest.org/images/logo.jpg +[website]: https://github.com/hamcrest/JavaHamcrest +[BSD License]: http://opensource.org/licenses/BSD-3-Clause +[Maven central]: http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.hamcrest +[hamcrest extensions page]: https://github.com/hamcrest/JavaHamcrest/wiki/Related-Projects +[GitHub issue tracker]: https://github.com/hamcrest/JavaHamcrest/issues diff --git a/README.txt b/README.txt deleted file mode 100644 index f635da72..00000000 --- a/README.txt +++ /dev/null @@ -1,94 +0,0 @@ - - ************ -************************* Hamcrest ************************* - ************ - - - ---[ What is Hamcrest? ]------------------------------------- - -Hamcrest is a library of matchers, which can be combined in -to create flexible expressions of intent in tests. - - ---[ Binaries ]----------------------------------------------- - -Depending on how you intend to use Hamcrest, you should use -different Jars. - - * [hamcrest-core.jar] - This is the core API to be used by third-party framework - providers. This includes the a foundation set of matcher - implementations for common operations. - This API is stable and will rarely change. You will need - this library as a minimum. - - * [hamcrest-library.jar] - The ever-growing library of Matcher implementations. This - will grow between releases. - - * [hamcrest-generator.jar] - A tool to allow many Matcher implementations to be - combined into a single class so users don't have to - remember many classes/packages to import. Generates - code. - - * [hamcrest-integration.jar] - Provides integration between Hamcrest and other testing - tools, including JUnit (3 and 4), TestNG, jMock and - EasyMock. - -Alternatively, if you don't care: - - * [hamcrest-all.jar] - Includes all of the above. - -For convenience, all the Jars also include source code. - - ---[ Dependencies ]------------------------------------------- - -All libraries in the 'lib' directory are used at build time, -or are optional extras used for tighter integration with -third party libraries. - -ALL OF THE DEPENDENCIES ARE OPTIONAL. - - ---[ Documentation ]------------------------------------------ - -Documentation can be found at: - http://hamcrest.org/ - - ---[ Source ]------------------------------------------------- - -The complete source for Hamcrest is bundled. This includes: - * Matcher core classes [src/core] - * Matcher libary [src/library] - * Matcher integrations [src/integration] - * Syntactic sugar generator [src/generator] - * Unit tests [src/unit-test] - * Ant build file [build.xml] - * Dependencies [lib] - -To build, please read BUILDING.txt - -------------------------------------------------------------- - -Developers: -- Joe Walnes -- Nat Pryce -- Steve Freeman - -Contributors: -- Robert Chatley -- Tom White -- Neil Dunn -- Dan North -- Magne Rasmussen -- David Saff - -Also, thanks to everyone who has worked on DynaMock, nMock, -jMock, EasyMock and MiniMock! These libraries inspired -Hamcrest. diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..810e5b50 --- /dev/null +++ b/build.gradle @@ -0,0 +1,152 @@ +apply plugin: 'signing' +apply plugin: 'osgi' +apply plugin: 'maven-publish' + +group = "org.hamcrest" +version = "2.2" + +subprojects { + apply plugin: 'checkstyle' + apply plugin: 'java-library' + + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + group = rootProject.group + version = rootProject.version + + repositories { + mavenCentral() + } + + checkstyle { + + project.ext.checkstyleVersion = '6.18' + //works with a JDK 7 version which is supposed to be supported although + //deprecated, see https://github.com/hamcrest/JavaHamcrest/pull/211 for + //the discussion about the support + + 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' + } + } + + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc + } +} + +def pomConfigurationFor(String pomName, String pomDescription) { + return { + name = pomName + description = pomDescription + url = 'http://hamcrest.org/JavaHamcrest/' + + scm { + connection = 'git@github.com:hamcrest/JavaHamcrest.git' + url = 'https://github.com/hamcrest/JavaHamcrest' + } + + licenses { + license { + name = 'BSD License 3' + url = 'http://opensource.org/licenses/BSD-3-Clause' + } + } + + developers { + developer { + id = 'joewalnes' + name = 'Joe Walnes' + } + developer { + id = 'npryce' + name = 'Nat Pryce' + } + developer { + id = 'sf105' + name = 'Steve Freeman' + } + } + } +} + +def publishToOssrh = project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword') + +publishing { + publications { + def hamcrestProject = project(':hamcrest') + hamcrest(MavenPublication) { + from hamcrestProject.components.java + artifactId hamcrestProject.name + artifact hamcrestProject.sourcesJar + artifact hamcrestProject.javadocJar + pom pomConfigurationFor( + 'Hamcrest', + 'Core API and libraries of hamcrest matcher framework.') + } + + def hamcrestCoreProject = project(':hamcrest-core') + hamcrestCore(MavenPublication) { + from hamcrestCoreProject.components.java + artifactId hamcrestCoreProject.name + artifact hamcrestCoreProject.sourcesJar + artifact hamcrestCoreProject.javadocJar + pom pomConfigurationFor( + 'Hamcrest Core', + 'Core Hamcrest API - deprecated, please use "hamcrest" instead') + } + + def hamcrestLibraryProject = project(':hamcrest-library') + hamcrestLibrary(MavenPublication) { + from hamcrestLibraryProject.components.java + artifactId hamcrestLibraryProject.name + artifact hamcrestLibraryProject.sourcesJar + artifact hamcrestLibraryProject.javadocJar + pom pomConfigurationFor( + 'Hamcrest Library', + 'A library of Hamcrest matchers - deprecated, please use "hamcrest" instead') + } + } + repositories { + if (publishToOssrh) { + maven { + def snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" + def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + url = version.contains('SNAPSHOT') ? snapshotRepoUrl : stagingRepoUrl + credentials { + username = ossrhUsername + password = ossrhPassword + } + } + } + } +} + +signing { + required { publishToOssrh } + sign publishing.publications.hamcrest + sign publishing.publications.hamcrestCore + sign publishing.publications.hamcrestLibrary +} diff --git a/build.xml b/build.xml deleted file mode 100644 index 9b90ac19..00000000 --- a/build.xml +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build.xml.original b/build.xml.original new file mode 100644 index 00000000..95662ee0 --- /dev/null +++ b/build.xml.original @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 00000000..c1dbabf3 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/core-matchers.xml b/core-matchers.xml deleted file mode 100644 index e47a5bbc..00000000 --- a/core-matchers.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 00000000..10e6731a --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1 @@ +markdown: kramdown diff --git a/docs/_includes/head.html b/docs/_includes/head.html new file mode 100644 index 00000000..b9ae8325 --- /dev/null +++ b/docs/_includes/head.html @@ -0,0 +1,11 @@ + + + + + + + + {{ page.title }} + + + diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html new file mode 100644 index 00000000..c75f2e2d --- /dev/null +++ b/docs/_layouts/default.html @@ -0,0 +1,18 @@ + + + + {% include head.html %} + + +
+ {{ content }} +
+ + Fork me on GitHub + + diff --git a/docs/css/hamcrest.css b/docs/css/hamcrest.css new file mode 100644 index 00000000..c456ed90 --- /dev/null +++ b/docs/css/hamcrest.css @@ -0,0 +1,44 @@ +@import url(https://fonts.googleapis.com/css?family=Cabin+Sketch); +@import url(https://fonts.googleapis.com/css?family=Alegreya); +body { + font-family: "Alegreya"; + margin: 40px auto; + width: 700px; +} +.content { + position: relative; +} +footer { + padding: 2em 0 1em 0; + font-size: 12px; +} +h1 { + font-size: 80px; + margin-top: .3em; + margin-bottom: 0; +} +h1 + h2 { + margin-top: 0; +} +h2 { + font-weight: 400; + font-size: 20px; +} +h1, h2 { + font-family: "Cabin Sketch"; + text-rendering: optimizeLegibility; +} +.content > p { + line-height: 1.5em; + text-rendering: optimizeLegibility; +} +.logo { + height: 60px; + padding-left: 0px; + padding-right: 40px; +} +pre.highlight { + border: 1px solid #ccc; + background-color: #eee; + padding: 0.5em; +} \ No newline at end of file diff --git a/docs/css/pygments-default.css b/docs/css/pygments-default.css new file mode 100644 index 00000000..8070f2fb --- /dev/null +++ b/docs/css/pygments-default.css @@ -0,0 +1,61 @@ +.highlight .hll { background-color: #ffffcc } +.highlight .c { color: #408080; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #008000; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #BC7A00 } /* Comment.Preproc */ +.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #808080 } /* Generic.Output */ +.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0040D0 } /* Generic.Traceback */ +.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #008000 } /* Keyword.Pseudo */ +.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #B00040 } /* Keyword.Type */ +.highlight .m { color: #666666 } /* Literal.Number */ +.highlight .s { color: #BA2121 } /* Literal.String */ +.highlight .na { color: #7D9029 } /* Name.Attribute */ +.highlight .nb { color: #008000 } /* Name.Builtin */ +.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.highlight .no { color: #880000 } /* Name.Constant */ +.highlight .nd { color: #AA22FF } /* Name.Decorator */ +.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0000FF } /* Name.Function */ +.highlight .nl { color: #A0A000 } /* Name.Label */ +.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #19177C } /* Name.Variable */ +.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #666666 } /* Literal.Number.Float */ +.highlight .mh { color: #666666 } /* Literal.Number.Hex */ +.highlight .mi { color: #666666 } /* Literal.Number.Integer */ +.highlight .mo { color: #666666 } /* Literal.Number.Oct */ +.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ +.highlight .sc { color: #BA2121 } /* Literal.String.Char */ +.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #BA2121 } /* Literal.String.Double */ +.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */ +.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.highlight .sx { color: #008000 } /* Literal.String.Other */ +.highlight .sr { color: #BB6688 } /* Literal.String.Regex */ +.highlight .s1 { color: #BA2121 } /* Literal.String.Single */ +.highlight .ss { color: #19177C } /* Literal.String.Symbol */ +.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #19177C } /* Name.Variable.Class */ +.highlight .vg { color: #19177C } /* Name.Variable.Global */ +.highlight .vi { color: #19177C } /* Name.Variable.Instance */ +.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/docs/distributables.md b/docs/distributables.md new file mode 100644 index 00000000..dde75ac7 --- /dev/null +++ b/docs/distributables.md @@ -0,0 +1,151 @@ +--- +title: Hamcrest Distributables +layout: default +--- +[Java Hamcrest Home](index) + +# Hamcrest Distributables +{:.no_toc} + +## Introduction +{:.no_toc} + +This document describes the current and previous versions of the various Hamcrest +distributables, and the functionality contained in each of them. + +The latest version of Hamcrest consists of a single jar file which contains base +classes and a library of useful matcher implementations. This is different from +older versions. + +Older versions of Hamcrest consisted of a number of different jars matching the +different needs of applications. The change in the jar packaging requires care +when upgrading. + +## Table of Contents +{:.no_toc} + +* TOC +{:toc} + +## The Hamcrest Jar + +All the base classes and standard matcher implementations are contained in a +single jar file called `hamcrest-2.1.jar`. + +### Using Hamcrest in a Gradle Project + +Add `"org.hamcrest:hamcrest:2.1"` to the dependencies section of your +`build.gradle`, for example: + +```gradle +apply plugin: 'java' + +dependencies { + testImplementation 'org.hamcrest:hamcrest:2.1' +} +``` + +Note: older versions of Gradle use the `testCompile` configuration +instead of the `testImplementation` configuration. + +### Using Hamcrest in a Maven Project + +Add the following to the `` section in your `pom.xml`: + +```xml + + org.hamcrest + hamcrest + 2.1 + test + +``` + +### Download the Hamcrest Jar + +You can download the jars directly from Maven Central. You can find the jars by searching Maven Central for groupId `org.hamcrest` +using the following link: + +> [https://search.maven.org/search?q=g:org.hamcrest](https://search.maven.org/search?q=g:org.hamcrest) + +## Previous Versions of Hamcrest + +Prior to version 2.x, Hamcrest was distributed through multiple jars, described +below. + +* **`hamcrest-core.jar`**: This was the core API to be used by third-party framework +providers. This includes a foundation set of matcher implementations for common +operations. This library was used as a dependency for many third-party libraries, +including JUnit 4.x. From Hamcrest version 2.x, all the classes in +`hamcrest-core.jar` were moved into `hamcrest.jar`. +* **`hamcrest-library.jar`**: The library of Matcher implementations which are based +on the core functionality in hamcrest-core.jar. From Hamcrest version 2.x, all the +classes in `hamcrest-core.jar` were moved into `hamcrest.jar`. +* **`hamcrest-integration.jar`**: Provides integration between Hamcrest and other +testing tools, such as jMock and EasyMock. It depends upon `hamcrest-core.jar` and +`hamcrest-library.jar`. There are no new releases of this library since version 1.3. +* **`hamcrest-generator.jar`**: A tool to allow many Matcher implementations to be +combined into a single class with static methods returning the different matchers +so users don't have to remember many classes/packages to import. Generates code. +This library is only used internally at compile time. It is not necessary for the +use of any of the other hamcrest libraries at runtime. There are no new releases of +this library since version 1.3. +* **`hamcrest-all.jar`**: One jar containing all classes of all the other jars. +There are no new releases of this library since version 1.3. Please use the single +`hamcrest.jar` instead. + +### Upgrading from Hamcrest 1.x + +Care must be taken when upgrading from Hamcrest 1.3 or earlier. Due to the change in +packaging, the version conflict resolution that happens in dependency management +tools won't happen automatically. A common example is projects that depend upon +JUnit 4. JUnit 4 declares a transitive dependency upon `hamcrest-core-1.3.jar`. +Because `hamcrest-core` is not the same artifact as `hamcrest`, it will not be +upgraded. + +To address this issue, Hamcrest 2.1 and later also publish artifacts for +`hamcrest-core` and `hamcrest-library`. Although these jars contain no classes, +they trigger the version conflict upgrade in the dependency manager, and correctly +declare transitive dependencies upon the new `hamcrest` packaging. Users can +directly declare a dependency upon these shim jars to force the upgrade. + +#### Gradle Upgrade Example + +```gradle +apply plugin: 'java' + +dependencies { + testImplementation 'org.hamcrest:hamcrest:2.1' + testImplementation 'org.hamcrest:hamcrest-library:2.1' + testImplementation 'junit:junit:4.12' +} +``` + +#### Maven Upgrade Example + +**Warning**: +Maven users should declare a dependency upon `hamcrest-library` **before** other +dependencies, otherwise the older version will take precedence. + +```xml + + + org.hamcrest + hamcrest + 2.1 + test + + + org.hamcrest + hamcrest-library + 2.1 + test + + + junit + junit + 4.12 + test + + +``` diff --git a/docs/images/logo.jpg b/docs/images/logo.jpg new file mode 100644 index 00000000..efd750d3 Binary files /dev/null and b/docs/images/logo.jpg differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..1af974b4 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,25 @@ +--- +title: Java Hamcrest +layout: default +--- +# ![Hamcrest Surfer](http://hamcrest.org/images/logo.jpg){:.logo}Java Hamcrest + +## Matchers that can be combined to create flexible expressions of intent + +### Documentation + +* [Getting Started](tutorial) +* [API Documentation (JavaDoc)](javadoc/) + +### Downloads + +* [Distributables and Dependency Configuration](distributables) +* [Source Repository](http://github.com/hamcrest/JavaHamcrest) +* [Project License](http://opensource.org/licenses/BSD-3-Clause) +* [Extensions and Related Projects](related) + +### User Support + +* [Hamcrest Java Users Mailing List](https://groups.google.com/forum/?fromgroups#!forum/hamcrest-java) +* [Hamcrest Developer Mailing List](https://groups.google.com/forum/?fromgroups#!forum/hamcrest-dev) +* [Issue Tracker](https://github.com/hamcrest/JavaHamcrest/issues) diff --git a/docs/javadoc/1.3/allclasses-frame.html b/docs/javadoc/1.3/allclasses-frame.html new file mode 100644 index 00000000..63ba802b --- /dev/null +++ b/docs/javadoc/1.3/allclasses-frame.html @@ -0,0 +1,181 @@ + + + + + + +All Classes (Hamcrest) + + + + + + + + + + + +All Classes +
+ + + + + +
AllOf +
+AnyOf +
+ArrayIterator +
+BaseDescription +
+BaseMatcher +
+BigDecimalCloseTo +
+CombinableMatcher +
+CombinableMatcher.CombinableBothMatcher +
+CombinableMatcher.CombinableEitherMatcher +
+Condition +
+Condition.Step +
+CoreMatchers +
+CustomMatcher +
+CustomTypeSafeMatcher +
+DescribedAs +
+Description +
+Description.NullDescription +
+DiagnosingMatcher +
+EasyMock2Adapter +
+EasyMock2Matchers +
+Every +
+Factory +
+FeatureMatcher +
+HasProperty +
+HasPropertyWithValue +
+HasToString +
+HasXPath +
+Is +
+IsAnything +
+IsArray +
+IsArrayContaining +
+IsArrayContainingInAnyOrder +
+IsArrayContainingInOrder +
+IsArrayWithSize +
+IsCloseTo +
+IsCollectionContaining +
+IsCollectionWithSize +
+IsCompatibleType +
+IsEmptyCollection +
+IsEmptyIterable +
+IsEmptyString +
+IsEqual +
+IsEqualIgnoringCase +
+IsEqualIgnoringWhiteSpace +
+IsEventFrom +
+IsIn +
+IsInstanceOf +
+IsIterableContainingInAnyOrder +
+IsIterableContainingInOrder +
+IsIterableWithSize +
+IsMapContaining +
+IsNot +
+IsNull +
+IsSame +
+JavaLangMatcherAssert +
+JMock1Adapter +
+JMock1Matchers +
+Matcher +
+MatcherAssert +
+Matchers +
+OrderingComparison +
+PropertyUtil +
+ReflectiveTypeFinder +
+SamePropertyValuesAs +
+SamePropertyValuesAs.PropertyMatcher +
+SelfDescribing +
+SelfDescribingValue +
+SelfDescribingValueIterator +
+StringContains +
+StringContainsInOrder +
+StringDescription +
+StringEndsWith +
+StringStartsWith +
+SubstringMatcher +
+TypeSafeDiagnosingMatcher +
+TypeSafeMatcher +
+
+ + + diff --git a/docs/javadoc/1.3/allclasses-noframe.html b/docs/javadoc/1.3/allclasses-noframe.html new file mode 100644 index 00000000..f0ab6313 --- /dev/null +++ b/docs/javadoc/1.3/allclasses-noframe.html @@ -0,0 +1,181 @@ + + + + + + +All Classes (Hamcrest) + + + + + + + + + + + +All Classes +
+ + + + + +
AllOf +
+AnyOf +
+ArrayIterator +
+BaseDescription +
+BaseMatcher +
+BigDecimalCloseTo +
+CombinableMatcher +
+CombinableMatcher.CombinableBothMatcher +
+CombinableMatcher.CombinableEitherMatcher +
+Condition +
+Condition.Step +
+CoreMatchers +
+CustomMatcher +
+CustomTypeSafeMatcher +
+DescribedAs +
+Description +
+Description.NullDescription +
+DiagnosingMatcher +
+EasyMock2Adapter +
+EasyMock2Matchers +
+Every +
+Factory +
+FeatureMatcher +
+HasProperty +
+HasPropertyWithValue +
+HasToString +
+HasXPath +
+Is +
+IsAnything +
+IsArray +
+IsArrayContaining +
+IsArrayContainingInAnyOrder +
+IsArrayContainingInOrder +
+IsArrayWithSize +
+IsCloseTo +
+IsCollectionContaining +
+IsCollectionWithSize +
+IsCompatibleType +
+IsEmptyCollection +
+IsEmptyIterable +
+IsEmptyString +
+IsEqual +
+IsEqualIgnoringCase +
+IsEqualIgnoringWhiteSpace +
+IsEventFrom +
+IsIn +
+IsInstanceOf +
+IsIterableContainingInAnyOrder +
+IsIterableContainingInOrder +
+IsIterableWithSize +
+IsMapContaining +
+IsNot +
+IsNull +
+IsSame +
+JavaLangMatcherAssert +
+JMock1Adapter +
+JMock1Matchers +
+Matcher +
+MatcherAssert +
+Matchers +
+OrderingComparison +
+PropertyUtil +
+ReflectiveTypeFinder +
+SamePropertyValuesAs +
+SamePropertyValuesAs.PropertyMatcher +
+SelfDescribing +
+SelfDescribingValue +
+SelfDescribingValueIterator +
+StringContains +
+StringContainsInOrder +
+StringDescription +
+StringEndsWith +
+StringStartsWith +
+SubstringMatcher +
+TypeSafeDiagnosingMatcher +
+TypeSafeMatcher +
+
+ + + diff --git a/docs/javadoc/1.3/constant-values.html b/docs/javadoc/1.3/constant-values.html new file mode 100644 index 00000000..3b472d2a --- /dev/null +++ b/docs/javadoc/1.3/constant-values.html @@ -0,0 +1,146 @@ + + + + + + +Constant Field Values (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Constant Field Values

+
+
+Contents
    +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/deprecated-list.html b/docs/javadoc/1.3/deprecated-list.html new file mode 100644 index 00000000..260fc82d --- /dev/null +++ b/docs/javadoc/1.3/deprecated-list.html @@ -0,0 +1,191 @@ + + + + + + +Deprecated List (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Deprecated API

+
+
+Contents + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Deprecated Methods
org.hamcrest.Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_() +
+          to make 
org.hamcrest.BaseMatcher._dont_implement_Matcher___instead_extend_BaseMatcher_() +
+           
org.hamcrest.Matchers.containsInAnyOrder(Matcher) +
+          use contains(Matcher itemMatcher) instead 
org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher) +
+          use contains(Matcher itemMatcher) instead 
org.hamcrest.Matchers.is(Class) +
+          use isA(Class type) instead. 
org.hamcrest.CoreMatchers.is(Class) +
+          use isA(Class type) instead. 
org.hamcrest.core.Is.is(Class) +
+          use isA(Class type) instead. 
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/help-doc.html b/docs/javadoc/1.3/help-doc.html new file mode 100644 index 00000000..e7f01c0f --- /dev/null +++ b/docs/javadoc/1.3/help-doc.html @@ -0,0 +1,223 @@ + + + + + + +API Help (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+How This API Document Is Organized

+
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

+Overview

+
+ +

+The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

+

+Package

+
+ +

+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

    +
  • Interfaces (italic)
  • Classes
  • Enums
  • Exceptions
  • Errors
  • Annotation Types
+
+

+Class/Interface

+
+ +

+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
  • Class inheritance diagram
  • Direct Subclasses
  • All Known Subinterfaces
  • All Known Implementing Classes
  • Class/interface declaration
  • Class/interface description +

    +

  • Nested Class Summary
  • Field Summary
  • Constructor Summary
  • Method Summary +

    +

  • Field Detail
  • Constructor Detail
  • Method Detail
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+ +

+Annotation Type

+
+ +

+Each annotation type has its own separate page with the following sections:

    +
  • Annotation Type declaration
  • Annotation Type description
  • Required Element Summary
  • Optional Element Summary
  • Element Detail
+
+ +

+Enum

+
+ +

+Each enum has its own separate page with the following sections:

    +
  • Enum declaration
  • Enum description
  • Enum Constant Summary
  • Enum Constant Detail
+
+

+Use

+
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+

+Tree (Class Hierarchy)

+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
    +
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+

+Deprecated API

+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+

+Index

+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+

+Prev/Next

+These links take you to the next or previous class, interface, package, or related page.

+Frames/No Frames

+These links show and hide the HTML frames. All pages are available with or without frames. +

+

+Serialized Form

+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

+

+Constant Field Values

+The Constant Field Values page lists the static final fields and their values. +

+ + +This help file applies to API documentation generated using the standard doclet. + +
+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/index-all.html b/docs/javadoc/1.3/index-all.html new file mode 100644 index 00000000..40ed7de9 --- /dev/null +++ b/docs/javadoc/1.3/index-all.html @@ -0,0 +1,2032 @@ + + + + + + +Index (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I J L M N O P R S T _
+

+A

+
+
adapt(Matcher<?>) - +Static method in class org.hamcrest.integration.EasyMock2Adapter +
Convenience factory method that will adapt a + Hamcrest Matcher to act as an + EasyMock IArgumentMatcher and + report it to EasyMock so it can be kept track of. +
adapt(Matcher<?>) - +Static method in class org.hamcrest.integration.JMock1Adapter +
Convenience factory method that will adapt a + Hamcrest Matcher to act as an + jMock Constraint. +
AllOf<T> - Class in org.hamcrest.core
Calculates the logical conjunction of multiple matchers.
AllOf(Iterable<Matcher<? super T>>) - +Constructor for class org.hamcrest.core.AllOf +
  +
allOf(Iterable<Matcher<? super T>>) - +Static method in class org.hamcrest.core.AllOf +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>...) - +Static method in class org.hamcrest.core.AllOf +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AllOf +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AllOf +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AllOf +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AllOf +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AllOf +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Iterable<Matcher<? super T>>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>...) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Iterable<Matcher<? super T>>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +
and(Condition.Step<? super T, U>) - +Method in class org.hamcrest.Condition +
  +
and(Matcher<? super T>) - +Method in class org.hamcrest.core.CombinableMatcher +
  +
and(Matcher<? super X>) - +Method in class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher +
  +
any(Class<T>) - +Static method in class org.hamcrest.core.IsInstanceOf +
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object. +
any(Class<T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object. +
any(Class<T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object. +
AnyOf<T> - Class in org.hamcrest.core
Calculates the logical disjunction of multiple matchers.
AnyOf(Iterable<Matcher<? super T>>) - +Constructor for class org.hamcrest.core.AnyOf +
  +
anyOf(Iterable<Matcher<? super T>>) - +Static method in class org.hamcrest.core.AnyOf +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<? super T>...) - +Static method in class org.hamcrest.core.AnyOf +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AnyOf +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AnyOf +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AnyOf +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AnyOf +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.core.AnyOf +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Iterable<Matcher<? super T>>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<? super T>...) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Iterable<Matcher<? super T>>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<T>, Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anyOf(Matcher<? super T>...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +
anything() - +Static method in class org.hamcrest.core.IsAnything +
Creates a matcher that always matches, regardless of the examined object. +
anything(String) - +Static method in class org.hamcrest.core.IsAnything +
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. +
anything() - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that always matches, regardless of the examined object. +
anything(String) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. +
anything() - +Static method in class org.hamcrest.Matchers +
Creates a matcher that always matches, regardless of the examined object. +
anything(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. +
append(String) - +Method in class org.hamcrest.BaseDescription +
Append the String str to the description. +
append(char) - +Method in class org.hamcrest.BaseDescription +
Append the char c to the description. +
append(String) - +Method in class org.hamcrest.StringDescription +
  +
append(char) - +Method in class org.hamcrest.StringDescription +
  +
appendDescriptionOf(SelfDescribing) - +Method in class org.hamcrest.BaseDescription +
  +
appendDescriptionOf(SelfDescribing) - +Method in interface org.hamcrest.Description +
Appends the description of a SelfDescribing value to this description. +
appendDescriptionOf(SelfDescribing) - +Method in class org.hamcrest.Description.NullDescription +
  +
appendList(String, String, String, Iterable<? extends SelfDescribing>) - +Method in class org.hamcrest.BaseDescription +
  +
appendList(String, String, String, Iterable<? extends SelfDescribing>) - +Method in interface org.hamcrest.Description +
Appends a list of SelfDescribing objects + to the description. +
appendList(String, String, String, Iterable<? extends SelfDescribing>) - +Method in class org.hamcrest.Description.NullDescription +
  +
appendText(String) - +Method in class org.hamcrest.BaseDescription +
  +
appendText(String) - +Method in interface org.hamcrest.Description +
Appends some plain text to the description. +
appendText(String) - +Method in class org.hamcrest.Description.NullDescription +
  +
appendTo(StringBuffer) - +Method in class org.hamcrest.integration.EasyMock2Adapter +
  +
appendValue(Object) - +Method in class org.hamcrest.BaseDescription +
  +
appendValue(Object) - +Method in interface org.hamcrest.Description +
Appends an arbitary value to the description. +
appendValue(Object) - +Method in class org.hamcrest.Description.NullDescription +
  +
appendValueList(String, String, String, T...) - +Method in class org.hamcrest.BaseDescription +
  +
appendValueList(String, String, String, Iterable<T>) - +Method in class org.hamcrest.BaseDescription +
  +
appendValueList(String, String, String, T...) - +Method in interface org.hamcrest.Description +
Appends a list of values to the description. +
appendValueList(String, String, String, Iterable<T>) - +Method in interface org.hamcrest.Description +
Appends a list of values to the description. +
appendValueList(String, String, String, T...) - +Method in class org.hamcrest.Description.NullDescription +
  +
appendValueList(String, String, String, Iterable<T>) - +Method in class org.hamcrest.Description.NullDescription +
  +
apply(I, Description) - +Method in interface org.hamcrest.Condition.Step +
  +
array(Matcher<? super T>...) - +Static method in class org.hamcrest.collection.IsArray +
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. +
array(Matcher<? super T>...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. +
arrayContaining(E...) - +Static method in class org.hamcrest.collection.IsArrayContainingInOrder +
Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items. +
arrayContaining(Matcher<? super E>...) - +Static method in class org.hamcrest.collection.IsArrayContainingInOrder +
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers. +
arrayContaining(List<Matcher<? super E>>) - +Static method in class org.hamcrest.collection.IsArrayContainingInOrder +
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. +
arrayContaining(List<Matcher<? super E>>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. +
arrayContaining(E...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items. +
arrayContaining(Matcher<? super E>...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers. +
arrayContainingInAnyOrder(Matcher<? super E>...) - +Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder +
Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers. +
arrayContainingInAnyOrder(Collection<Matcher<? super E>>) - +Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder +
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. +
arrayContainingInAnyOrder(E...) - +Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder +
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. +
arrayContainingInAnyOrder(E...) - +Static method in class org.hamcrest.Matchers +
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. +
arrayContainingInAnyOrder(Matcher<? super E>...) - +Static method in class org.hamcrest.Matchers +
Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers. +
arrayContainingInAnyOrder(Collection<Matcher<? super E>>) - +Static method in class org.hamcrest.Matchers +
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. +
ArrayIterator - Class in org.hamcrest.internal
 
ArrayIterator(Object) - +Constructor for class org.hamcrest.internal.ArrayIterator +
  +
arrayWithSize(Matcher<? super Integer>) - +Static method in class org.hamcrest.collection.IsArrayWithSize +
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. +
arrayWithSize(int) - +Static method in class org.hamcrest.collection.IsArrayWithSize +
Creates a matcher for arrays that matches when the length of the array + equals the specified size. +
arrayWithSize(Matcher<? super Integer>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. +
arrayWithSize(int) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for arrays that matches when the length of the array + equals the specified size. +
assertThat(T, Matcher<? super T>) - +Static method in class org.hamcrest.MatcherAssert +
  +
assertThat(String, T, Matcher<? super T>) - +Static method in class org.hamcrest.MatcherAssert +
  +
assertThat(String, boolean) - +Static method in class org.hamcrest.MatcherAssert +
  +
asString(SelfDescribing) - +Static method in class org.hamcrest.StringDescription +
Alias for StringDescription.toString(SelfDescribing). +
+
+

+B

+
+
BaseDescription - Class in org.hamcrest
A Description that is stored as a string.
BaseDescription() - +Constructor for class org.hamcrest.BaseDescription +
  +
BaseMatcher<T> - Class in org.hamcrest
BaseClass for all Matcher implementations.
BaseMatcher() - +Constructor for class org.hamcrest.BaseMatcher +
  +
BigDecimalCloseTo - Class in org.hamcrest.number
 
BigDecimalCloseTo(BigDecimal, BigDecimal) - +Constructor for class org.hamcrest.number.BigDecimalCloseTo +
  +
both(Matcher<? super LHS>) - +Static method in class org.hamcrest.core.CombinableMatcher +
Creates a matcher that matches when both of the specified matchers match the examined object. +
both(Matcher<? super LHS>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches when both of the specified matchers match the examined object. +
both(Matcher<? super LHS>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when both of the specified matchers match the examined object. +
+
+

+C

+
+
canObtainExpectedTypeFrom(Method) - +Method in class org.hamcrest.internal.ReflectiveTypeFinder +
  +
closeTo(double, double) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. +
closeTo(BigDecimal, BigDecimal) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. +
closeTo(BigDecimal, BigDecimal) - +Static method in class org.hamcrest.number.BigDecimalCloseTo +
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. +
closeTo(double, double) - +Static method in class org.hamcrest.number.IsCloseTo +
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. +
CombinableMatcher<T> - Class in org.hamcrest.core
 
CombinableMatcher(Matcher<? super T>) - +Constructor for class org.hamcrest.core.CombinableMatcher +
  +
CombinableMatcher.CombinableBothMatcher<X> - Class in org.hamcrest.core
 
CombinableMatcher.CombinableBothMatcher(Matcher<? super X>) - +Constructor for class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher +
  +
CombinableMatcher.CombinableEitherMatcher<X> - Class in org.hamcrest.core
 
CombinableMatcher.CombinableEitherMatcher(Matcher<? super X>) - +Constructor for class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher +
  +
comparesEqualTo(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. +
comparesEqualTo(T) - +Static method in class org.hamcrest.number.OrderingComparison +
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. +
Condition<T> - Class in org.hamcrest
A Condition implements part of a multi-step match.
Condition.Step<I,O> - Interface in org.hamcrest
 
contains(E...) - +Static method in class org.hamcrest.collection.IsIterableContainingInOrder +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. +
contains(Matcher<? super E>) - +Static method in class org.hamcrest.collection.IsIterableContainingInOrder +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. +
contains(Matcher<? super E>...) - +Static method in class org.hamcrest.collection.IsIterableContainingInOrder +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. +
contains(List<Matcher<? super E>>) - +Static method in class org.hamcrest.collection.IsIterableContainingInOrder +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. +
contains(Matcher<? super E>...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. +
contains(E...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. +
contains(Matcher<? super E>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. +
contains(List<Matcher<? super E>>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. +
containsInAnyOrder(Matcher<? super E>) - +Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder +
Deprecated. use contains(Matcher itemMatcher) instead +
containsInAnyOrder(Matcher<? super T>...) - +Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder +
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. +
containsInAnyOrder(T...) - +Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder +
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. +
containsInAnyOrder(Collection<Matcher<? super T>>) - +Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder +
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. +
containsInAnyOrder(T...) - +Static method in class org.hamcrest.Matchers +
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. +
containsInAnyOrder(Collection<Matcher<? super T>>) - +Static method in class org.hamcrest.Matchers +
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. +
containsInAnyOrder(Matcher<? super T>...) - +Static method in class org.hamcrest.Matchers +
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. +
containsInAnyOrder(Matcher<? super E>) - +Static method in class org.hamcrest.Matchers +
Deprecated. use contains(Matcher itemMatcher) instead +
containsString(String) - +Static method in class org.hamcrest.core.StringContains +
Creates a matcher that matches if the examined String contains the specified + String anywhere. +
containsString(String) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined String contains the specified + String anywhere. +
containsString(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined String contains the specified + String anywhere. +
CoreMatchers - Class in org.hamcrest
 
CoreMatchers() - +Constructor for class org.hamcrest.CoreMatchers +
  +
CustomMatcher<T> - Class in org.hamcrest
Utility class for writing one off matchers.
CustomMatcher(String) - +Constructor for class org.hamcrest.CustomMatcher +
  +
CustomTypeSafeMatcher<T> - Class in org.hamcrest
Utility class for writing one off matchers.
CustomTypeSafeMatcher(String) - +Constructor for class org.hamcrest.CustomTypeSafeMatcher +
  +
+
+

+D

+
+
DescribedAs<T> - Class in org.hamcrest.core
Provides a custom description to another matcher.
DescribedAs(String, Matcher<T>, Object[]) - +Constructor for class org.hamcrest.core.DescribedAs +
  +
describedAs(String, Matcher<T>, Object...) - +Static method in class org.hamcrest.core.DescribedAs +
Wraps an existing matcher, overriding its description with that specified. +
describedAs(String, Matcher<T>, Object...) - +Static method in class org.hamcrest.CoreMatchers +
Wraps an existing matcher, overriding its description with that specified. +
describedAs(String, Matcher<T>, Object...) - +Static method in class org.hamcrest.Matchers +
Wraps an existing matcher, overriding its description with that specified. +
describeMismatch(Object, Description) - +Method in class org.hamcrest.BaseMatcher +
  +
describeMismatch(Object, Description) - +Method in class org.hamcrest.core.DescribedAs +
  +
describeMismatch(Object, Description) - +Method in class org.hamcrest.core.Is +
  +
describeMismatch(Object, Description) - +Method in class org.hamcrest.DiagnosingMatcher +
  +
describeMismatch(Object, Description) - +Method in interface org.hamcrest.Matcher +
Generate a description of why the matcher has not accepted the item. +
describeMismatch(Object, Description) - +Method in class org.hamcrest.TypeSafeDiagnosingMatcher +
  +
describeMismatch(Object, Description) - +Method in class org.hamcrest.TypeSafeMatcher +
  +
describeMismatchSafely(T, Description) - +Method in class org.hamcrest.beans.HasProperty +
  +
describeMismatchSafely(T[], Description) - +Method in class org.hamcrest.collection.IsArray +
  +
describeMismatchSafely(T[], Description) - +Method in class org.hamcrest.collection.IsArrayContaining +
  +
describeMismatchSafely(E[], Description) - +Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder +
  +
describeMismatchSafely(E[], Description) - +Method in class org.hamcrest.collection.IsArrayContainingInOrder +
  +
describeMismatchSafely(Collection<? extends E>, Description) - +Method in class org.hamcrest.collection.IsEmptyCollection +
  +
describeMismatchSafely(Iterable<? extends E>, Description) - +Method in class org.hamcrest.collection.IsEmptyIterable +
  +
describeMismatchSafely(Map<? extends K, ? extends V>, Description) - +Method in class org.hamcrest.collection.IsMapContaining +
  +
describeMismatchSafely(String, Description) - +Method in class org.hamcrest.core.SubstringMatcher +
  +
describeMismatchSafely(BigDecimal, Description) - +Method in class org.hamcrest.number.BigDecimalCloseTo +
  +
describeMismatchSafely(Double, Description) - +Method in class org.hamcrest.number.IsCloseTo +
  +
describeMismatchSafely(T, Description) - +Method in class org.hamcrest.number.OrderingComparison +
  +
describeMismatchSafely(Class<?>, Description) - +Method in class org.hamcrest.object.IsCompatibleType +
  +
describeMismatchSafely(String, Description) - +Method in class org.hamcrest.text.IsEqualIgnoringCase +
  +
describeMismatchSafely(String, Description) - +Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace +
  +
describeMismatchSafely(String, Description) - +Method in class org.hamcrest.text.StringContainsInOrder +
  +
describeMismatchSafely(T, Description) - +Method in class org.hamcrest.TypeSafeMatcher +
Subclasses should override this. +
describeTo(Description) - +Method in class org.hamcrest.beans.HasProperty +
  +
describeTo(Description) - +Method in class org.hamcrest.beans.HasPropertyWithValue +
  +
describeTo(Description) - +Method in class org.hamcrest.beans.SamePropertyValuesAs +
  +
describeTo(Description) - +Method in class org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsArray +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsArrayContaining +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsArrayContainingInOrder +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsEmptyCollection +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsEmptyIterable +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsIn +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsIterableContainingInAnyOrder +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsIterableContainingInOrder +
  +
describeTo(Description) - +Method in class org.hamcrest.collection.IsMapContaining +
  +
describeTo(Description) - +Method in class org.hamcrest.core.AllOf +
  +
describeTo(Description) - +Method in class org.hamcrest.core.AnyOf +
  +
describeTo(Description) - +Method in class org.hamcrest.core.CombinableMatcher +
  +
describeTo(Description) - +Method in class org.hamcrest.core.DescribedAs +
  +
describeTo(Description) - +Method in class org.hamcrest.core.Every +
  +
describeTo(Description) - +Method in class org.hamcrest.core.Is +
  +
describeTo(Description) - +Method in class org.hamcrest.core.IsAnything +
  +
describeTo(Description) - +Method in class org.hamcrest.core.IsCollectionContaining +
  +
describeTo(Description) - +Method in class org.hamcrest.core.IsEqual +
  +
describeTo(Description) - +Method in class org.hamcrest.core.IsInstanceOf +
  +
describeTo(Description) - +Method in class org.hamcrest.core.IsNot +
  +
describeTo(Description) - +Method in class org.hamcrest.core.IsNull +
  +
describeTo(Description) - +Method in class org.hamcrest.core.IsSame +
  +
describeTo(Description) - +Method in class org.hamcrest.core.SubstringMatcher +
  +
describeTo(Description) - +Method in class org.hamcrest.CustomMatcher +
  +
describeTo(Description) - +Method in class org.hamcrest.CustomTypeSafeMatcher +
  +
describeTo(Description) - +Method in class org.hamcrest.FeatureMatcher +
  +
describeTo(StringBuffer) - +Method in class org.hamcrest.integration.JMock1Adapter +
  +
describeTo(Description) - +Method in class org.hamcrest.internal.SelfDescribingValue +
  +
describeTo(Description) - +Method in class org.hamcrest.number.BigDecimalCloseTo +
  +
describeTo(Description) - +Method in class org.hamcrest.number.IsCloseTo +
  +
describeTo(Description) - +Method in class org.hamcrest.number.OrderingComparison +
  +
describeTo(Description) - +Method in class org.hamcrest.object.IsCompatibleType +
  +
describeTo(Description) - +Method in class org.hamcrest.object.IsEventFrom +
  +
describeTo(Description) - +Method in interface org.hamcrest.SelfDescribing +
Generates a description of the object. +
describeTo(Description) - +Method in class org.hamcrest.text.IsEmptyString +
  +
describeTo(Description) - +Method in class org.hamcrest.text.IsEqualIgnoringCase +
  +
describeTo(Description) - +Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace +
  +
describeTo(Description) - +Method in class org.hamcrest.text.StringContainsInOrder +
  +
describeTo(Description) - +Method in class org.hamcrest.xml.HasXPath +
  +
Description - Interface in org.hamcrest
A description of a Matcher.
Description.NullDescription - Class in org.hamcrest
 
Description.NullDescription() - +Constructor for class org.hamcrest.Description.NullDescription +
  +
descriptionEnd() - +Method in class org.hamcrest.collection.IsArray +
Returns the string that ends the description. +
descriptionSeparator() - +Method in class org.hamcrest.collection.IsArray +
Returns the string that separates the elements in the description. +
descriptionStart() - +Method in class org.hamcrest.collection.IsArray +
Returns the string that starts the description. +
DiagnosingMatcher<T> - Class in org.hamcrest
TODO(ngd): Document.
DiagnosingMatcher() - +Constructor for class org.hamcrest.DiagnosingMatcher +
  +
+
+

+E

+
+
EasyMock2Adapter - Class in org.hamcrest.integration
An adapter allowing a Hamcrest Matcher + to act as an EasyMock IArgumentMatcher.
EasyMock2Adapter(Matcher<?>) - +Constructor for class org.hamcrest.integration.EasyMock2Adapter +
  +
EasyMock2Matchers - Class in org.hamcrest
 
EasyMock2Matchers() - +Constructor for class org.hamcrest.EasyMock2Matchers +
  +
either(Matcher<? super LHS>) - +Static method in class org.hamcrest.core.CombinableMatcher +
Creates a matcher that matches when either of the specified matchers match the examined object. +
either(Matcher<? super LHS>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches when either of the specified matchers match the examined object. +
either(Matcher<? super LHS>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when either of the specified matchers match the examined object. +
empty() - +Static method in class org.hamcrest.collection.IsEmptyCollection +
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +
empty() - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +
emptyArray() - +Static method in class org.hamcrest.collection.IsArrayWithSize +
Creates a matcher for arrays that matches when the length of the array + is zero. +
emptyArray() - +Static method in class org.hamcrest.Matchers +
Creates a matcher for arrays that matches when the length of the array + is zero. +
emptyCollectionOf(Class<E>) - +Static method in class org.hamcrest.collection.IsEmptyCollection +
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +
emptyCollectionOf(Class<E>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +
emptyIterable() - +Static method in class org.hamcrest.collection.IsEmptyIterable +
Creates a matcher for Iterables matching examined iterables that yield no items. +
emptyIterable() - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables matching examined iterables that yield no items. +
emptyIterableOf(Class<E>) - +Static method in class org.hamcrest.collection.IsEmptyIterable +
Creates a matcher for Iterables matching examined iterables that yield no items. +
emptyIterableOf(Class<E>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables matching examined iterables that yield no items. +
endsWith(String) - +Static method in class org.hamcrest.core.StringEndsWith +
Creates a matcher that matches if the examined String ends with the specified + String. +
endsWith(String) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined String ends with the specified + String. +
endsWith(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined String ends with the specified + String. +
equalTo(T) - +Static method in class org.hamcrest.core.IsEqual +
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object. +
equalTo(T) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object. +
equalTo(String) - +Static method in class org.hamcrest.EasyMock2Matchers +
  +
equalTo(String) - +Static method in class org.hamcrest.JMock1Matchers +
  +
equalTo(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object. +
equalToIgnoringCase(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. +
equalToIgnoringCase(String) - +Static method in class org.hamcrest.text.IsEqualIgnoringCase +
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. +
equalToIgnoringWhiteSpace(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. +
equalToIgnoringWhiteSpace(String) - +Static method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace +
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. +
eval(Object) - +Method in class org.hamcrest.integration.JMock1Adapter +
  +
evalSubstringOf(String) - +Method in class org.hamcrest.core.StringContains +
  +
evalSubstringOf(String) - +Method in class org.hamcrest.core.StringEndsWith +
  +
evalSubstringOf(String) - +Method in class org.hamcrest.core.StringStartsWith +
  +
evalSubstringOf(String) - +Method in class org.hamcrest.core.SubstringMatcher +
  +
eventFrom(Class<? extends EventObject>, Object) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. +
eventFrom(Object) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of EventObject that matches any EventObject + announced by source. +
eventFrom(Class<? extends EventObject>, Object) - +Static method in class org.hamcrest.object.IsEventFrom +
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. +
eventFrom(Object) - +Static method in class org.hamcrest.object.IsEventFrom +
Creates a matcher of EventObject that matches any EventObject + announced by source. +
Every<T> - Class in org.hamcrest.core
 
Every(Matcher<? super T>) - +Constructor for class org.hamcrest.core.Every +
  +
everyItem(Matcher<U>) - +Static method in class org.hamcrest.core.Every +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. +
everyItem(Matcher<U>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. +
everyItem(Matcher<U>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. +
expectedTypeFrom(Method) - +Method in class org.hamcrest.internal.ReflectiveTypeFinder +
  +
+
+

+F

+
+
Factory - Annotation Type in org.hamcrest
Marks a Hamcrest static factory method so tools recognise them.
FeatureMatcher<T,U> - Class in org.hamcrest
Supporting class for matching a feature of an object.
FeatureMatcher(Matcher<? super U>, String, String) - +Constructor for class org.hamcrest.FeatureMatcher +
Constructor +
featureValueOf(E[]) - +Method in class org.hamcrest.collection.IsArrayWithSize +
  +
featureValueOf(Collection<? extends E>) - +Method in class org.hamcrest.collection.IsCollectionWithSize +
  +
featureValueOf(Iterable<E>) - +Method in class org.hamcrest.collection.IsIterableWithSize +
  +
featureValueOf(T) - +Method in class org.hamcrest.FeatureMatcher +
Implement this to extract the interesting feature. +
featureValueOf(T) - +Method in class org.hamcrest.object.HasToString +
  +
findExpectedType(Class<?>) - +Method in class org.hamcrest.internal.ReflectiveTypeFinder +
  +
+
+

+G

+
+
getPropertyDescriptor(String, Object) - +Static method in class org.hamcrest.beans.PropertyUtil +
Returns the description of the property with the provided + name on the provided object's interface. +
greaterThan(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. +
greaterThan(T) - +Static method in class org.hamcrest.number.OrderingComparison +
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. +
greaterThanOrEqualTo(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. +
greaterThanOrEqualTo(T) - +Static method in class org.hamcrest.number.OrderingComparison +
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. +
+
+

+H

+
+
hasEntry(Matcher<? super K>, Matcher<? super V>) - +Static method in class org.hamcrest.collection.IsMapContaining +
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. +
hasEntry(K, V) - +Static method in class org.hamcrest.collection.IsMapContaining +
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. +
hasEntry(K, V) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. +
hasEntry(Matcher<? super K>, Matcher<? super V>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. +
hasItem(Matcher<? super T>) - +Static method in class org.hamcrest.core.IsCollectionContaining +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. +
hasItem(T) - +Static method in class org.hamcrest.core.IsCollectionContaining +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. +
hasItem(T) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. +
hasItem(Matcher<? super T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. +
hasItem(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. +
hasItem(Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. +
hasItemInArray(Matcher<? super T>) - +Static method in class org.hamcrest.collection.IsArrayContaining +
Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher. +
hasItemInArray(T) - +Static method in class org.hamcrest.collection.IsArrayContaining +
A shortcut to the frequently used hasItemInArray(equalTo(x)). +
hasItemInArray(T) - +Static method in class org.hamcrest.Matchers +
A shortcut to the frequently used hasItemInArray(equalTo(x)). +
hasItemInArray(Matcher<? super T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher. +
hasItems(Matcher<? super T>...) - +Static method in class org.hamcrest.core.IsCollectionContaining +
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. +
hasItems(T...) - +Static method in class org.hamcrest.core.IsCollectionContaining +
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. +
hasItems(T...) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. +
hasItems(Matcher<? super T>...) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. +
hasItems(T...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. +
hasItems(Matcher<? super T>...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. +
hasKey(Matcher<? super K>) - +Static method in class org.hamcrest.collection.IsMapContaining +
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. +
hasKey(K) - +Static method in class org.hamcrest.collection.IsMapContaining +
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. +
hasKey(Matcher<? super K>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. +
hasKey(K) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. +
hasNext() - +Method in class org.hamcrest.internal.ArrayIterator +
  +
hasNext() - +Method in class org.hamcrest.internal.SelfDescribingValueIterator +
  +
HasProperty<T> - Class in org.hamcrest.beans
A Matcher that checks that an object has a JavaBean property + with the specified name.
HasProperty(String) - +Constructor for class org.hamcrest.beans.HasProperty +
  +
hasProperty(String) - +Static method in class org.hamcrest.beans.HasProperty +
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. +
hasProperty(String, Matcher<?>) - +Static method in class org.hamcrest.beans.HasPropertyWithValue +
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. +
hasProperty(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. +
hasProperty(String, Matcher<?>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. +
HasPropertyWithValue<T> - Class in org.hamcrest.beans
Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
HasPropertyWithValue(String, Matcher<?>) - +Constructor for class org.hamcrest.beans.HasPropertyWithValue +
  +
hasSize(Matcher<? super Integer>) - +Static method in class org.hamcrest.collection.IsCollectionWithSize +
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. +
hasSize(int) - +Static method in class org.hamcrest.collection.IsCollectionWithSize +
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. +
hasSize(Matcher<? super Integer>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. +
hasSize(int) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. +
hasToString(Matcher<? super String>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. +
hasToString(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. +
HasToString<T> - Class in org.hamcrest.object
 
HasToString(Matcher<? super String>) - +Constructor for class org.hamcrest.object.HasToString +
  +
hasToString(Matcher<? super String>) - +Static method in class org.hamcrest.object.HasToString +
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. +
hasToString(String) - +Static method in class org.hamcrest.object.HasToString +
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. +
hasValue(Matcher<? super V>) - +Static method in class org.hamcrest.collection.IsMapContaining +
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. +
hasValue(V) - +Static method in class org.hamcrest.collection.IsMapContaining +
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. +
hasValue(V) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. +
hasValue(Matcher<? super V>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. +
hasXPath(String, NamespaceContext) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. +
hasXPath(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. +
hasXPath(String, NamespaceContext, Matcher<String>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. +
hasXPath(String, Matcher<String>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. +
HasXPath - Class in org.hamcrest.xml
Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
HasXPath(String, Matcher<String>) - +Constructor for class org.hamcrest.xml.HasXPath +
  +
HasXPath(String, NamespaceContext, Matcher<String>) - +Constructor for class org.hamcrest.xml.HasXPath +
  +
hasXPath(String, Matcher<String>) - +Static method in class org.hamcrest.xml.HasXPath +
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. +
hasXPath(String, NamespaceContext, Matcher<String>) - +Static method in class org.hamcrest.xml.HasXPath +
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. +
hasXPath(String) - +Static method in class org.hamcrest.xml.HasXPath +
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. +
hasXPath(String, NamespaceContext) - +Static method in class org.hamcrest.xml.HasXPath +
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. +
+
+

+I

+
+
instanceOf(Class<?>) - +Static method in class org.hamcrest.core.IsInstanceOf +
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object. +
instanceOf(Class<?>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object. +
instanceOf(Class<?>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object. +
Is<T> - Class in org.hamcrest.core
Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
Is(Matcher<T>) - +Constructor for class org.hamcrest.core.Is +
  +
is(Matcher<T>) - +Static method in class org.hamcrest.core.Is +
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. +
is(T) - +Static method in class org.hamcrest.core.Is +
A shortcut to the frequently used is(equalTo(x)). +
is(Class<T>) - +Static method in class org.hamcrest.core.Is +
Deprecated. use isA(Class type) instead. +
is(T) - +Static method in class org.hamcrest.CoreMatchers +
A shortcut to the frequently used is(equalTo(x)). +
is(Matcher<T>) - +Static method in class org.hamcrest.CoreMatchers +
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. +
is(Class<T>) - +Static method in class org.hamcrest.CoreMatchers +
Deprecated. use isA(Class type) instead. +
is(T) - +Static method in class org.hamcrest.Matchers +
A shortcut to the frequently used is(equalTo(x)). +
is(Matcher<T>) - +Static method in class org.hamcrest.Matchers +
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. +
is(Class<T>) - +Static method in class org.hamcrest.Matchers +
Deprecated. use isA(Class type) instead. +
isA(Class<T>) - +Static method in class org.hamcrest.core.Is +
A shortcut to the frequently used is(instanceOf(SomeClass.class)). +
isA(Class<T>) - +Static method in class org.hamcrest.CoreMatchers +
A shortcut to the frequently used is(instanceOf(SomeClass.class)). +
isA(Class<T>) - +Static method in class org.hamcrest.Matchers +
A shortcut to the frequently used is(instanceOf(SomeClass.class)). +
IsAnything<T> - Class in org.hamcrest.core
A matcher that always returns true.
IsAnything() - +Constructor for class org.hamcrest.core.IsAnything +
  +
IsAnything(String) - +Constructor for class org.hamcrest.core.IsAnything +
  +
IsArray<T> - Class in org.hamcrest.collection
Matcher for array whose elements satisfy a sequence of matchers.
IsArray(Matcher<? super T>[]) - +Constructor for class org.hamcrest.collection.IsArray +
  +
IsArrayContaining<T> - Class in org.hamcrest.collection
Matches if an array contains an item satisfying a nested matcher.
IsArrayContaining(Matcher<? super T>) - +Constructor for class org.hamcrest.collection.IsArrayContaining +
  +
IsArrayContainingInAnyOrder<E> - Class in org.hamcrest.collection
 
IsArrayContainingInAnyOrder(Collection<Matcher<? super E>>) - +Constructor for class org.hamcrest.collection.IsArrayContainingInAnyOrder +
  +
IsArrayContainingInOrder<E> - Class in org.hamcrest.collection
 
IsArrayContainingInOrder(List<Matcher<? super E>>) - +Constructor for class org.hamcrest.collection.IsArrayContainingInOrder +
  +
IsArrayWithSize<E> - Class in org.hamcrest.collection
Matches if array size satisfies a nested matcher.
IsArrayWithSize(Matcher<? super Integer>) - +Constructor for class org.hamcrest.collection.IsArrayWithSize +
  +
IsCloseTo - Class in org.hamcrest.number
Is the value a number equal to a value within some range of + acceptable error?
IsCloseTo(double, double) - +Constructor for class org.hamcrest.number.IsCloseTo +
  +
IsCollectionContaining<T> - Class in org.hamcrest.core
 
IsCollectionContaining(Matcher<? super T>) - +Constructor for class org.hamcrest.core.IsCollectionContaining +
  +
IsCollectionWithSize<E> - Class in org.hamcrest.collection
Matches if collection size satisfies a nested matcher.
IsCollectionWithSize(Matcher<? super Integer>) - +Constructor for class org.hamcrest.collection.IsCollectionWithSize +
  +
IsCompatibleType<T> - Class in org.hamcrest.object
 
IsCompatibleType(Class<T>) - +Constructor for class org.hamcrest.object.IsCompatibleType +
  +
IsEmptyCollection<E> - Class in org.hamcrest.collection
Tests if collection is empty.
IsEmptyCollection() - +Constructor for class org.hamcrest.collection.IsEmptyCollection +
  +
IsEmptyIterable<E> - Class in org.hamcrest.collection
Tests if collection is empty.
IsEmptyIterable() - +Constructor for class org.hamcrest.collection.IsEmptyIterable +
  +
isEmptyOrNullString() - +Static method in class org.hamcrest.Matchers +
Creates a matcher of String that matches when the examined string is null, or + has zero length. +
isEmptyOrNullString() - +Static method in class org.hamcrest.text.IsEmptyString +
Creates a matcher of String that matches when the examined string is null, or + has zero length. +
isEmptyString() - +Static method in class org.hamcrest.Matchers +
Creates a matcher of String that matches when the examined string has zero length. +
IsEmptyString - Class in org.hamcrest.text
Matches empty Strings (and null).
IsEmptyString() - +Constructor for class org.hamcrest.text.IsEmptyString +
  +
isEmptyString() - +Static method in class org.hamcrest.text.IsEmptyString +
Creates a matcher of String that matches when the examined string has zero length. +
IsEqual<T> - Class in org.hamcrest.core
Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
IsEqual(T) - +Constructor for class org.hamcrest.core.IsEqual +
  +
IsEqualIgnoringCase - Class in org.hamcrest.text
Tests if a string is equal to another string, regardless of the case.
IsEqualIgnoringCase(String) - +Constructor for class org.hamcrest.text.IsEqualIgnoringCase +
  +
IsEqualIgnoringWhiteSpace - Class in org.hamcrest.text
Tests if a string is equal to another string, ignoring any changes in whitespace.
IsEqualIgnoringWhiteSpace(String) - +Constructor for class org.hamcrest.text.IsEqualIgnoringWhiteSpace +
  +
IsEventFrom - Class in org.hamcrest.object
Tests if the value is an event announced by a specific object.
IsEventFrom(Class<?>, Object) - +Constructor for class org.hamcrest.object.IsEventFrom +
  +
IsIn<T> - Class in org.hamcrest.collection
 
IsIn(Collection<T>) - +Constructor for class org.hamcrest.collection.IsIn +
  +
IsIn(T[]) - +Constructor for class org.hamcrest.collection.IsIn +
  +
isIn(Collection<T>) - +Static method in class org.hamcrest.collection.IsIn +
Creates a matcher that matches when the examined object is found within the + specified collection. +
isIn(T[]) - +Static method in class org.hamcrest.collection.IsIn +
Creates a matcher that matches when the examined object is found within the + specified array. +
isIn(Collection<T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object is found within the + specified collection. +
isIn(T[]) - +Static method in class org.hamcrest.Matchers +
  +
IsInstanceOf - Class in org.hamcrest.core
Tests whether the value is an instance of a class.
IsInstanceOf(Class<?>) - +Constructor for class org.hamcrest.core.IsInstanceOf +
Creates a new instance of IsInstanceOf +
IsIterableContainingInAnyOrder<T> - Class in org.hamcrest.collection
 
IsIterableContainingInAnyOrder(Collection<Matcher<? super T>>) - +Constructor for class org.hamcrest.collection.IsIterableContainingInAnyOrder +
  +
IsIterableContainingInOrder<E> - Class in org.hamcrest.collection
 
IsIterableContainingInOrder(List<Matcher<? super E>>) - +Constructor for class org.hamcrest.collection.IsIterableContainingInOrder +
  +
IsIterableWithSize<E> - Class in org.hamcrest.collection
 
IsIterableWithSize(Matcher<? super Integer>) - +Constructor for class org.hamcrest.collection.IsIterableWithSize +
  +
IsMapContaining<K,V> - Class in org.hamcrest.collection
 
IsMapContaining(Matcher<? super K>, Matcher<? super V>) - +Constructor for class org.hamcrest.collection.IsMapContaining +
  +
IsNot<T> - Class in org.hamcrest.core
Calculates the logical negation of a matcher.
IsNot(Matcher<T>) - +Constructor for class org.hamcrest.core.IsNot +
  +
IsNull<T> - Class in org.hamcrest.core
Is the value null?
IsNull() - +Constructor for class org.hamcrest.core.IsNull +
  +
isOneOf(T...) - +Static method in class org.hamcrest.collection.IsIn +
Creates a matcher that matches when the examined object is equal to one of the + specified elements. +
isOneOf(T...) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object is equal to one of the + specified elements. +
IsSame<T> - Class in org.hamcrest.core
Is the value the same object as another value?
IsSame(T) - +Constructor for class org.hamcrest.core.IsSame +
  +
iterableWithSize(Matcher<? super Integer>) - +Static method in class org.hamcrest.collection.IsIterableWithSize +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. +
iterableWithSize(int) - +Static method in class org.hamcrest.collection.IsIterableWithSize +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. +
iterableWithSize(Matcher<? super Integer>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. +
iterableWithSize(int) - +Static method in class org.hamcrest.Matchers +
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. +
+
+

+J

+
+
JavaLangMatcherAssert - Class in org.hamcrest
Integration method for use with Java's assert keyword.
JMock1Adapter - Class in org.hamcrest.integration
An adapter allowing a Hamcrest Matcher + to act as an jMock1 Constraint.
JMock1Adapter(Matcher<?>) - +Constructor for class org.hamcrest.integration.JMock1Adapter +
  +
JMock1Matchers - Class in org.hamcrest
 
JMock1Matchers() - +Constructor for class org.hamcrest.JMock1Matchers +
  +
+
+

+L

+
+
lessThan(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. +
lessThan(T) - +Static method in class org.hamcrest.number.OrderingComparison +
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. +
lessThanOrEqualTo(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. +
lessThanOrEqualTo(T) - +Static method in class org.hamcrest.number.OrderingComparison +
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. +
+
+

+M

+
+
matched(T, Description) - +Static method in class org.hamcrest.Condition +
  +
Matcher<T> - Interface in org.hamcrest
A matcher over acceptable values.
MatcherAssert - Class in org.hamcrest
 
MatcherAssert() - +Constructor for class org.hamcrest.MatcherAssert +
  +
Matchers - Class in org.hamcrest
 
Matchers() - +Constructor for class org.hamcrest.Matchers +
  +
matches(Object, Description) - +Method in class org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher +
  +
matches(Object) - +Method in class org.hamcrest.collection.IsIn +
  +
matches(Object, Description) - +Method in class org.hamcrest.core.AllOf +
  +
matches(Object) - +Method in class org.hamcrest.core.AnyOf +
  +
matches(Object) - +Method in class org.hamcrest.core.DescribedAs +
  +
matches(Object) - +Method in class org.hamcrest.core.Is +
  +
matches(Object) - +Method in class org.hamcrest.core.IsAnything +
  +
matches(Object) - +Method in class org.hamcrest.core.IsEqual +
  +
matches(Object, Description) - +Method in class org.hamcrest.core.IsInstanceOf +
  +
matches(Object) - +Method in class org.hamcrest.core.IsNot +
  +
matches(Object) - +Method in class org.hamcrest.core.IsNull +
  +
matches(Object) - +Method in class org.hamcrest.core.IsSame +
  +
matches(Object) - +Method in class org.hamcrest.DiagnosingMatcher +
  +
matches(Object, Description) - +Method in class org.hamcrest.DiagnosingMatcher +
  +
matches(Object) - +Method in class org.hamcrest.integration.EasyMock2Adapter +
  +
matches(Object) - +Method in interface org.hamcrest.Matcher +
Evaluates the matcher for argument item. +
matches(Object) - +Method in class org.hamcrest.text.IsEmptyString +
  +
matches(Object) - +Method in class org.hamcrest.TypeSafeDiagnosingMatcher +
  +
matches(Object) - +Method in class org.hamcrest.TypeSafeMatcher +
Methods made final to prevent accidental override. +
matchesSafely(T) - +Method in class org.hamcrest.beans.HasProperty +
  +
matchesSafely(T, Description) - +Method in class org.hamcrest.beans.HasPropertyWithValue +
  +
matchesSafely(T, Description) - +Method in class org.hamcrest.beans.SamePropertyValuesAs +
  +
matchesSafely(T[]) - +Method in class org.hamcrest.collection.IsArray +
  +
matchesSafely(T[]) - +Method in class org.hamcrest.collection.IsArrayContaining +
  +
matchesSafely(E[]) - +Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder +
  +
matchesSafely(E[]) - +Method in class org.hamcrest.collection.IsArrayContainingInOrder +
  +
matchesSafely(Collection<? extends E>) - +Method in class org.hamcrest.collection.IsEmptyCollection +
  +
matchesSafely(Iterable<? extends E>) - +Method in class org.hamcrest.collection.IsEmptyIterable +
  +
matchesSafely(Iterable<? extends T>, Description) - +Method in class org.hamcrest.collection.IsIterableContainingInAnyOrder +
  +
matchesSafely(Iterable<? extends E>, Description) - +Method in class org.hamcrest.collection.IsIterableContainingInOrder +
  +
matchesSafely(Map<? extends K, ? extends V>) - +Method in class org.hamcrest.collection.IsMapContaining +
  +
matchesSafely(T, Description) - +Method in class org.hamcrest.core.CombinableMatcher +
  +
matchesSafely(Iterable<T>, Description) - +Method in class org.hamcrest.core.Every +
  +
matchesSafely(Iterable<? super T>, Description) - +Method in class org.hamcrest.core.IsCollectionContaining +
  +
matchesSafely(String) - +Method in class org.hamcrest.core.SubstringMatcher +
  +
matchesSafely(T, Description) - +Method in class org.hamcrest.FeatureMatcher +
  +
matchesSafely(BigDecimal) - +Method in class org.hamcrest.number.BigDecimalCloseTo +
  +
matchesSafely(Double) - +Method in class org.hamcrest.number.IsCloseTo +
  +
matchesSafely(T) - +Method in class org.hamcrest.number.OrderingComparison +
  +
matchesSafely(Class<?>) - +Method in class org.hamcrest.object.IsCompatibleType +
  +
matchesSafely(EventObject, Description) - +Method in class org.hamcrest.object.IsEventFrom +
  +
matchesSafely(String) - +Method in class org.hamcrest.text.IsEqualIgnoringCase +
  +
matchesSafely(String) - +Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace +
  +
matchesSafely(String) - +Method in class org.hamcrest.text.StringContainsInOrder +
  +
matchesSafely(T, Description) - +Method in class org.hamcrest.TypeSafeDiagnosingMatcher +
Subclasses should implement this. +
matchesSafely(T) - +Method in class org.hamcrest.TypeSafeMatcher +
Subclasses should implement this. +
matchesSafely(Node, Description) - +Method in class org.hamcrest.xml.HasXPath +
  +
matching(Matcher<T>, String) - +Method in class org.hamcrest.Condition +
  +
matching(Matcher<T>) - +Method in class org.hamcrest.Condition +
  +
+
+

+N

+
+
next() - +Method in class org.hamcrest.internal.ArrayIterator +
  +
next() - +Method in class org.hamcrest.internal.SelfDescribingValueIterator +
  +
NO_ARGUMENTS - +Static variable in class org.hamcrest.beans.PropertyUtil +
  +
NO_NAMESPACE_CONTEXT - +Static variable in class org.hamcrest.xml.HasXPath +
  +
NONE - +Static variable in interface org.hamcrest.Description +
A description that consumes input but does nothing. +
not(Matcher<T>) - +Static method in class org.hamcrest.core.IsNot +
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. +
not(T) - +Static method in class org.hamcrest.core.IsNot +
A shortcut to the frequently used not(equalTo(x)). +
not(Matcher<T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. +
not(T) - +Static method in class org.hamcrest.CoreMatchers +
A shortcut to the frequently used not(equalTo(x)). +
not(Matcher<T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. +
not(T) - +Static method in class org.hamcrest.Matchers +
A shortcut to the frequently used not(equalTo(x)). +
NOT_MATCHED - +Static variable in class org.hamcrest.Condition +
  +
notMatched() - +Static method in class org.hamcrest.Condition +
  +
notNullValue() - +Static method in class org.hamcrest.core.IsNull +
A shortcut to the frequently used not(nullValue()). +
notNullValue(Class<T>) - +Static method in class org.hamcrest.core.IsNull +
A shortcut to the frequently used not(nullValue(X.class)). +
notNullValue() - +Static method in class org.hamcrest.CoreMatchers +
A shortcut to the frequently used not(nullValue()). +
notNullValue(Class<T>) - +Static method in class org.hamcrest.CoreMatchers +
A shortcut to the frequently used not(nullValue(X.class)). +
notNullValue() - +Static method in class org.hamcrest.Matchers +
A shortcut to the frequently used not(nullValue()). +
notNullValue(Class<T>) - +Static method in class org.hamcrest.Matchers +
A shortcut to the frequently used not(nullValue(X.class)). +
nullValue() - +Static method in class org.hamcrest.core.IsNull +
Creates a matcher that matches if examined object is null. +
nullValue(Class<T>) - +Static method in class org.hamcrest.core.IsNull +
Creates a matcher that matches if examined object is null. +
nullValue() - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if examined object is null. +
nullValue(Class<T>) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if examined object is null. +
nullValue() - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if examined object is null. +
nullValue(Class<T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if examined object is null. +
+
+

+O

+
+
or(Matcher<? super X>) - +Method in class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher +
  +
or(Matcher<? super T>) - +Method in class org.hamcrest.core.CombinableMatcher +
  +
OrderingComparison<T extends java.lang.Comparable<T>> - Class in org.hamcrest.number
 
org.hamcrest - package org.hamcrest
The stable API defining Matcher and its associated interfaces and classes.
org.hamcrest.beans - package org.hamcrest.beans
Matchers of Java Bean properties and their values.
org.hamcrest.collection - package org.hamcrest.collection
Matchers of arrays and collections.
org.hamcrest.core - package org.hamcrest.core
Fundamental matchers of objects and values, and composite matchers.
org.hamcrest.integration - package org.hamcrest.integration
 
org.hamcrest.internal - package org.hamcrest.internal
 
org.hamcrest.number - package org.hamcrest.number
Matchers that perform numeric comparisons.
org.hamcrest.object - package org.hamcrest.object
Matchers that inspect objects and classes.
org.hamcrest.text - package org.hamcrest.text
Matchers that perform text comparisons.
org.hamcrest.xml - package org.hamcrest.xml
Matchers of XML documents.
+
+

+P

+
+
propertyDescriptorsFor(Object, Class<Object>) - +Static method in class org.hamcrest.beans.PropertyUtil +
Returns all the property descriptors for the class associated with the given object +
PropertyUtil - Class in org.hamcrest.beans
Utility class for accessing properties on JavaBean objects.
PropertyUtil() - +Constructor for class org.hamcrest.beans.PropertyUtil +
  +
+
+

+R

+
+
ReflectiveTypeFinder - Class in org.hamcrest.internal
 
ReflectiveTypeFinder(String, int, int) - +Constructor for class org.hamcrest.internal.ReflectiveTypeFinder +
  +
relationship() - +Method in class org.hamcrest.core.StringContains +
  +
relationship() - +Method in class org.hamcrest.core.StringEndsWith +
  +
relationship() - +Method in class org.hamcrest.core.StringStartsWith +
  +
relationship() - +Method in class org.hamcrest.core.SubstringMatcher +
  +
remove() - +Method in class org.hamcrest.internal.ArrayIterator +
  +
remove() - +Method in class org.hamcrest.internal.SelfDescribingValueIterator +
  +
+
+

+S

+
+
sameInstance(T) - +Static method in class org.hamcrest.core.IsSame +
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +
sameInstance(T) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +
sameInstance(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +
SamePropertyValuesAs<T> - Class in org.hamcrest.beans
 
SamePropertyValuesAs(T) - +Constructor for class org.hamcrest.beans.SamePropertyValuesAs +
  +
samePropertyValuesAs(T) - +Static method in class org.hamcrest.beans.SamePropertyValuesAs +
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. +
samePropertyValuesAs(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. +
SamePropertyValuesAs.PropertyMatcher - Class in org.hamcrest.beans
 
SamePropertyValuesAs.PropertyMatcher(PropertyDescriptor, Object) - +Constructor for class org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher +
  +
SelfDescribing - Interface in org.hamcrest
The ability of an object to describe itself.
SelfDescribingValue<T> - Class in org.hamcrest.internal
 
SelfDescribingValue(T) - +Constructor for class org.hamcrest.internal.SelfDescribingValue +
  +
SelfDescribingValueIterator<T> - Class in org.hamcrest.internal
 
SelfDescribingValueIterator(Iterator<T>) - +Constructor for class org.hamcrest.internal.SelfDescribingValueIterator +
  +
startsWith(String) - +Static method in class org.hamcrest.core.StringStartsWith +
Creates a matcher that matches if the examined String starts with the specified + String. +
startsWith(String) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches if the examined String starts with the specified + String. +
startsWith(String) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches if the examined String starts with the specified + String. +
StringContains - Class in org.hamcrest.core
Tests if the argument is a string that contains a substring.
StringContains(String) - +Constructor for class org.hamcrest.core.StringContains +
  +
stringContainsInOrder(Iterable<String>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance. +
StringContainsInOrder - Class in org.hamcrest.text
 
StringContainsInOrder(Iterable<String>) - +Constructor for class org.hamcrest.text.StringContainsInOrder +
  +
stringContainsInOrder(Iterable<String>) - +Static method in class org.hamcrest.text.StringContainsInOrder +
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance. +
StringDescription - Class in org.hamcrest
A Description that is stored as a string.
StringDescription() - +Constructor for class org.hamcrest.StringDescription +
  +
StringDescription(Appendable) - +Constructor for class org.hamcrest.StringDescription +
  +
StringEndsWith - Class in org.hamcrest.core
Tests if the argument is a string that contains a substring.
StringEndsWith(String) - +Constructor for class org.hamcrest.core.StringEndsWith +
  +
StringStartsWith - Class in org.hamcrest.core
Tests if the argument is a string that contains a substring.
StringStartsWith(String) - +Constructor for class org.hamcrest.core.StringStartsWith +
  +
stripSpace(String) - +Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace +
  +
substring - +Variable in class org.hamcrest.core.SubstringMatcher +
  +
SubstringMatcher - Class in org.hamcrest.core
 
SubstringMatcher(String) - +Constructor for class org.hamcrest.core.SubstringMatcher +
  +
+
+

+T

+
+
that(T, Matcher<? super T>) - +Static method in class org.hamcrest.JavaLangMatcherAssert +
  +
theInstance(T) - +Static method in class org.hamcrest.core.IsSame +
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +
theInstance(T) - +Static method in class org.hamcrest.CoreMatchers +
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +
theInstance(T) - +Static method in class org.hamcrest.Matchers +
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +
then(Condition.Step<? super T, U>) - +Method in class org.hamcrest.Condition +
  +
toString() - +Method in class org.hamcrest.BaseMatcher +
  +
toString() - +Method in class org.hamcrest.Description.NullDescription +
  +
toString(SelfDescribing) - +Static method in class org.hamcrest.StringDescription +
Return the description of a SelfDescribing object as a String. +
toString() - +Method in class org.hamcrest.StringDescription +
Returns the description as a string. +
typeCompatibleWith(Class<T>) - +Static method in class org.hamcrest.Matchers +
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. +
typeCompatibleWith(Class<T>) - +Static method in class org.hamcrest.object.IsCompatibleType +
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. +
TypeSafeDiagnosingMatcher<T> - Class in org.hamcrest
Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
TypeSafeDiagnosingMatcher(Class<?>) - +Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher +
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +
TypeSafeDiagnosingMatcher(ReflectiveTypeFinder) - +Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher +
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +
TypeSafeDiagnosingMatcher() - +Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher +
The default constructor for simple sub types +
TypeSafeMatcher<T> - Class in org.hamcrest
Convenient base class for Matchers that require a non-null value of a specific type.
TypeSafeMatcher() - +Constructor for class org.hamcrest.TypeSafeMatcher +
The default constructor for simple sub types +
TypeSafeMatcher(Class<?>) - +Constructor for class org.hamcrest.TypeSafeMatcher +
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +
TypeSafeMatcher(ReflectiveTypeFinder) - +Constructor for class org.hamcrest.TypeSafeMatcher +
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +
+
+

+_

+
+
_dont_implement_Matcher___instead_extend_BaseMatcher_() - +Method in class org.hamcrest.BaseMatcher +
Deprecated.  +
_dont_implement_Matcher___instead_extend_BaseMatcher_() - +Method in interface org.hamcrest.Matcher +
Deprecated. to make +
+
+A B C D E F G H I J L M N O P R S T _ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/index.html b/docs/javadoc/1.3/index.html new file mode 100644 index 00000000..ff0017d9 --- /dev/null +++ b/docs/javadoc/1.3/index.html @@ -0,0 +1,39 @@ + + + + + + +Hamcrest + + + + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="overview-summary.html">Non-frame version.</A> + + + diff --git a/docs/javadoc/1.3/org/hamcrest/BaseDescription.html b/docs/javadoc/1.3/org/hamcrest/BaseDescription.html new file mode 100644 index 00000000..7e55aea1 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/BaseDescription.html @@ -0,0 +1,514 @@ + + + + + + +BaseDescription (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class BaseDescription

+
+java.lang.Object
+  extended by org.hamcrest.BaseDescription
+
+
+
All Implemented Interfaces:
Description
+
+
+
Direct Known Subclasses:
StringDescription
+
+
+
+
public abstract class BaseDescription
extends java.lang.Object
implements Description
+ + +

+A Description that is stored as a string. +

+ +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from interface org.hamcrest.Description
Description.NullDescription
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface org.hamcrest.Description
NONE
+  + + + + + + + + + + +
+Constructor Summary
BaseDescription() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected abstract  voidappend(char c) + +
+          Append the char c to the description.
+protected  voidappend(java.lang.String str) + +
+          Append the String str to the description.
+ DescriptionappendDescriptionOf(SelfDescribing value) + +
+          Appends the description of a SelfDescribing value to this description.
+ DescriptionappendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+          Appends a list of SelfDescribing objects + to the description.
+ DescriptionappendText(java.lang.String text) + +
+          Appends some plain text to the description.
+ DescriptionappendValue(java.lang.Object value) + +
+          Appends an arbitary value to the description.
+ + + + + +
+<T> Description
+
appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) + +
+          Appends a list of values to the description.
+ + + + + +
+<T> Description
+
appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) + +
+          Appends a list of values to the description.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+BaseDescription

+
+public BaseDescription()
+
+
+ + + + + + + + +
+Method Detail
+ +

+appendText

+
+public Description appendText(java.lang.String text)
+
+
Description copied from interface: Description
+
Appends some plain text to the description. +

+

+
Specified by:
appendText in interface Description
+
+
+
+
+
+
+ +

+appendDescriptionOf

+
+public Description appendDescriptionOf(SelfDescribing value)
+
+
Description copied from interface: Description
+
Appends the description of a SelfDescribing value to this description. +

+

+
Specified by:
appendDescriptionOf in interface Description
+
+
+
+
+
+
+ +

+appendValue

+
+public Description appendValue(java.lang.Object value)
+
+
Description copied from interface: Description
+
Appends an arbitary value to the description. +

+

+
Specified by:
appendValue in interface Description
+
+
+
+
+
+
+ +

+appendValueList

+
+public <T> Description appendValueList(java.lang.String start,
+                                       java.lang.String separator,
+                                       java.lang.String end,
+                                       T... values)
+
+
Description copied from interface: Description
+
Appends a list of values to the description. +

+

+
Specified by:
appendValueList in interface Description
+
+
+
+
+
+
+ +

+appendValueList

+
+public <T> Description appendValueList(java.lang.String start,
+                                       java.lang.String separator,
+                                       java.lang.String end,
+                                       java.lang.Iterable<T> values)
+
+
Description copied from interface: Description
+
Appends a list of values to the description. +

+

+
Specified by:
appendValueList in interface Description
+
+
+
+
+
+
+ +

+appendList

+
+public Description appendList(java.lang.String start,
+                              java.lang.String separator,
+                              java.lang.String end,
+                              java.lang.Iterable<? extends SelfDescribing> values)
+
+
Description copied from interface: Description
+
Appends a list of SelfDescribing objects + to the description. +

+

+
Specified by:
appendList in interface Description
+
+
+
+
+
+
+ +

+append

+
+protected void append(java.lang.String str)
+
+
Append the String str to the description. + The default implementation passes every character to append(char). + Override in subclasses to provide an efficient implementation. +

+

+
+
+
+
+
+
+
+ +

+append

+
+protected abstract void append(char c)
+
+
Append the char c to the description. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/BaseMatcher.html b/docs/javadoc/1.3/org/hamcrest/BaseMatcher.html new file mode 100644 index 00000000..95500177 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/BaseMatcher.html @@ -0,0 +1,346 @@ + + + + + + +BaseMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class BaseMatcher<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
AnyOf, CustomMatcher, DescribedAs, DiagnosingMatcher, Is, IsAnything, IsEmptyString, IsEqual, IsIn, IsNot, IsNull, IsSame, TypeSafeDiagnosingMatcher, TypeSafeMatcher
+
+
+
+
public abstract class BaseMatcher<T>
extends java.lang.Object
implements Matcher<T>
+ + +

+BaseClass for all Matcher implementations. +

+ +

+

+
See Also:
Matcher
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
BaseMatcher() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ void_dont_implement_Matcher___instead_extend_BaseMatcher_() + +
+          Deprecated. 
+ voiddescribeMismatch(java.lang.Object item, + Description description) + +
+          Generate a description of why the matcher has not accepted the item.
+ java.lang.StringtoString() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface org.hamcrest.Matcher
matches
+ + + + + + + +
Methods inherited from interface org.hamcrest.SelfDescribing
describeTo
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+BaseMatcher

+
+public BaseMatcher()
+
+
+ + + + + + + + +
+Method Detail
+ +

+_dont_implement_Matcher___instead_extend_BaseMatcher_

+
+@Deprecated
+public final void _dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
Deprecated.  +

+

Description copied from interface: Matcher
+
This method simply acts a friendly reminder not to implement Matcher directly and + instead extend BaseMatcher. It's easy to ignore JavaDoc, but a bit harder to ignore + compile errors . +

+

+
Specified by:
_dont_implement_Matcher___instead_extend_BaseMatcher_ in interface Matcher<T>
+
+
+
See Also:
Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
+
+ +

+describeMismatch

+
+public void describeMismatch(java.lang.Object item,
+                             Description description)
+
+
Description copied from interface: Matcher
+
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 + will not check this. +

+

+
Specified by:
describeMismatch in interface Matcher<T>
+
+
+
Parameters:
item - The item that the Matcher has rejected.
description - The description to be built or appended to.
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/Condition.Step.html b/docs/javadoc/1.3/org/hamcrest/Condition.Step.html new file mode 100644 index 00000000..c02ac9f5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/Condition.Step.html @@ -0,0 +1,211 @@ + + + + + + +Condition.Step (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Interface Condition.Step<I,O>

+
+
Enclosing class:
Condition<T>
+
+
+
+
public static interface Condition.Step<I,O>
+ + +

+


+ +

+ + + + + + + + + + + + +
+Method Summary
+ Condition<O>apply(I value, + Description mismatch) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+apply

+
+Condition<O> apply(I value,
+                   Description mismatch)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/Condition.html b/docs/javadoc/1.3/org/hamcrest/Condition.html new file mode 100644 index 00000000..768c4174 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/Condition.html @@ -0,0 +1,412 @@ + + + + + + +Condition (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class Condition<T>

+
+java.lang.Object
+  extended by org.hamcrest.Condition<T>
+
+
+
+
public abstract class Condition<T>
extends java.lang.Object
+ + +

+A Condition implements part of a multi-step match. We sometimes need to write matchers + that have a sequence of steps, where each step depends on the result of the previous + step and we can stop processing as soon as a step fails. These classes provide + infrastructure for writing such a sequence. + + Based on https://github.com/npryce/maybe-java +

+ +

+

+
Author:
+
Steve Freeman 2012 http://www.hamcrest.com
+
+
+ +

+ + + + + + + + + + + +
+Nested Class Summary
+static interfaceCondition.Step<I,O> + +
+           
+ + + + + + + + + + +
+Field Summary
+static org.hamcrest.Condition.NotMatched<java.lang.Object>NOT_MATCHED + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+abstract + + + + +
+<U> Condition<U>
+
and(Condition.Step<? super T,U> mapping) + +
+           
+static + + + + +
+<T> Condition<T>
+
matched(T theValue, + Description mismatch) + +
+           
+ booleanmatching(Matcher<T> match) + +
+           
+abstract  booleanmatching(Matcher<T> match, + java.lang.String message) + +
+           
+static + + + + +
+<T> Condition<T>
+
notMatched() + +
+           
+ + + + + +
+<U> Condition<U>
+
then(Condition.Step<? super T,U> mapping) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+NOT_MATCHED

+
+public static final org.hamcrest.Condition.NotMatched<java.lang.Object> NOT_MATCHED
+
+
+
+
+ + + + + + + + +
+Method Detail
+ +

+matching

+
+public abstract boolean matching(Matcher<T> match,
+                                 java.lang.String message)
+
+
+
+
+
+
+ +

+and

+
+public abstract <U> Condition<U> and(Condition.Step<? super T,U> mapping)
+
+
+
+
+
+
+ +

+matching

+
+public final boolean matching(Matcher<T> match)
+
+
+
+
+
+
+ +

+then

+
+public final <U> Condition<U> then(Condition.Step<? super T,U> mapping)
+
+
+
+
+
+
+ +

+notMatched

+
+public static <T> Condition<T> notMatched()
+
+
+
+
+
+
+ +

+matched

+
+public static <T> Condition<T> matched(T theValue,
+                                       Description mismatch)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/CoreMatchers.html b/docs/javadoc/1.3/org/hamcrest/CoreMatchers.html new file mode 100644 index 00000000..88aa9166 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/CoreMatchers.html @@ -0,0 +1,1629 @@ + + + + + + +CoreMatchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class CoreMatchers

+
+java.lang.Object
+  extended by org.hamcrest.CoreMatchers
+
+
+
+
public class CoreMatchers
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
CoreMatchers() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> Matcher<T>
+
allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
any(java.lang.Class<T> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static Matcher<java.lang.Object>anything() + +
+          Creates a matcher that always matches, regardless of the examined object.
+static Matcher<java.lang.Object>anything(java.lang.String description) + +
+          Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+static Matcher<java.lang.String>containsString(java.lang.String substring) + +
+          Creates a matcher that matches if the examined String contains the specified + String anywhere.
+static + + + + +
+<T> Matcher<T>
+
describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+static Matcher<java.lang.String>endsWith(java.lang.String suffix) + +
+          Creates a matcher that matches if the examined String ends with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
equalTo(T operand) + +
+          Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
hasItem(T item) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
hasItems(T... items) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+static + + + + +
+<T> Matcher<T>
+
instanceOf(java.lang.Class<?> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> Matcher<T>
+
is(java.lang.Class<T> type) + +
+          Deprecated. use isA(Class type) instead.
+static + + + + +
+<T> Matcher<T>
+
is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
is(T value) + +
+          A shortcut to the frequently used is(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
isA(java.lang.Class<T> type) + +
+          A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+static + + + + +
+<T> Matcher<T>
+
not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
not(T value) + +
+          A shortcut to the frequently used not(equalTo(x)).
+static Matcher<java.lang.Object>notNullValue() + +
+          A shortcut to the frequently used not(nullValue()).
+static + + + + +
+<T> Matcher<T>
+
notNullValue(java.lang.Class<T> type) + +
+          A shortcut to the frequently used not(nullValue(X.class)).
+static Matcher<java.lang.Object>nullValue() + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
nullValue(java.lang.Class<T> type) + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
sameInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static Matcher<java.lang.String>startsWith(java.lang.String prefix) + +
+          Creates a matcher that matches if the examined String starts with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
theInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CoreMatchers

+
+public CoreMatchers()
+
+
+ + + + + + + + +
+Method Detail
+ +

+allOf

+
+public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third,
+                                   Matcher<? super T> fourth)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third,
+                                   Matcher<? super T> fourth,
+                                   Matcher<? super T> fifth)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> 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)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth,
+                                 Matcher<? super T> fifth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth,
+                                 Matcher<? super T> fifth,
+                                 Matcher<? super T> sixth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+both

+
+public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
+
+
Creates a matcher that matches when both of the specified matchers match the examined object. +

+ For example: +

assertThat("fab", both(containsString("a")).and(containsString("b")))
+

+

+
+
+
+
+ +

+either

+
+public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
+
+
Creates a matcher that matches when either of the specified matchers match the examined object. +

+ For example: +

assertThat("fan", either(containsString("a")).and(containsString("b")))
+

+

+
+
+
+
+ +

+describedAs

+
+public static <T> Matcher<T> describedAs(java.lang.String description,
+                                         Matcher<T> matcher,
+                                         java.lang.Object... values)
+
+
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())
+

+

+
Parameters:
description - the new description for the wrapped matcher
matcher - the matcher to wrap
values - optional values to insert into the tokenised description
+
+
+
+ +

+everyItem

+
+public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. +

+ For example: +

assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
+

+

+
Parameters:
itemMatcher - the matcher to apply to every item provided by the examined Iterable
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(T value)
+
+
A shortcut to the frequently used is(equalTo(x)). +

+ For example: +

assertThat(cheese, is(smelly))
+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
+

+

+
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(Matcher<T> matcher)
+
+
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))
+

+

+
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(java.lang.Class<T> type)
+
+
Deprecated. use isA(Class type) instead. +

+

A shortcut to the frequently used is(instanceOf(SomeClass.class)). +

+ For example: +

assertThat(cheese, is(Cheddar.class))
+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
+

+

+
+
+
+
+ +

+isA

+
+public static <T> Matcher<T> isA(java.lang.Class<T> type)
+
+
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)))
+

+

+
+
+
+
+ +

+anything

+
+public static Matcher<java.lang.Object> anything()
+
+
Creates a matcher that always matches, regardless of the examined object. +

+

+
+
+
+
+ +

+anything

+
+public static Matcher<java.lang.Object> anything(java.lang.String description)
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. +

+

+
Parameters:
description - a meaningful String used when describing itself
+
+
+
+ +

+hasItem

+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
+

+

+
Parameters:
item - the item to compare against the items provided by the examined Iterable
+
+
+
+ +

+hasItem

+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
+

+

+
Parameters:
itemMatcher - the matcher to apply to items provided by the examined Iterable
+
+
+
+ +

+hasItems

+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
+

+

+
Parameters:
items - the items to compare against the items provided by the examined Iterable
+
+
+
+ +

+hasItems

+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
+

+

+
Parameters:
itemMatchers - the matchers to apply to items provided by the examined Iterable
+
+
+
+ +

+equalTo

+
+public static <T> Matcher<T> equalTo(T operand)
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

+

+ For example: +

+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ 
+

+

+
+
+
+
+ +

+any

+
+public static <T> Matcher<T> any(java.lang.Class<T> type)
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
+

+

+
+
+
+
+ +

+instanceOf

+
+public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

+

+ For example: +

assertThat(new Canoe(), instanceOf(Paddlable.class));
+

+

+
+
+
+
+ +

+not

+
+public static <T> Matcher<T> not(Matcher<T> matcher)
+
+
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))))
+

+

+
Parameters:
matcher - the matcher whose sense should be inverted
+
+
+
+ +

+not

+
+public static <T> Matcher<T> not(T value)
+
+
A shortcut to the frequently used not(equalTo(x)). +

+ For example: +

assertThat(cheese, is(not(smelly)))
+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
+

+

+
Parameters:
value - the value that any examined object should not equal
+
+
+
+ +

+nullValue

+
+public static Matcher<java.lang.Object> nullValue()
+
+
Creates a matcher that matches if examined object is null. +

+ For example: +

assertThat(cheese, is(nullValue())
+

+

+
+
+
+
+ +

+nullValue

+
+public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
+
+
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))
+

+

+
Parameters:
type - dummy parameter used to infer the generic type of the returned matcher
+
+
+
+ +

+notNullValue

+
+public static Matcher<java.lang.Object> notNullValue()
+
+
A shortcut to the frequently used not(nullValue()). +

+ For example: +

assertThat(cheese, is(notNullValue()))
+ instead of: +
assertThat(cheese, is(not(nullValue())))
+

+

+
+
+
+
+ +

+notNullValue

+
+public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
+
+
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))))
+

+

+
Parameters:
type - dummy parameter used to infer the generic type of the returned matcher
+
+
+
+ +

+sameInstance

+
+public static <T> Matcher<T> sameInstance(T target)
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +

+

+
Parameters:
target - the target instance against which others should be assessed
+
+
+
+ +

+theInstance

+
+public static <T> Matcher<T> theInstance(T target)
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +

+

+
Parameters:
target - the target instance against which others should be assessed
+
+
+
+ +

+containsString

+
+public static Matcher<java.lang.String> containsString(java.lang.String substring)
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere. +

+ For example: +

assertThat("myStringOfNote", containsString("ring"))
+

+

+
Parameters:
substring - the substring that the returned matcher will expect to find within any examined string
+
+
+
+ +

+startsWith

+
+public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
+
+
Creates a matcher that matches if the examined String starts with the specified + String. +

+ For example: +

assertThat("myStringOfNote", startsWith("my"))
+

+

+
Parameters:
prefix - the substring that the returned matcher will expect at the start of any examined string
+
+
+
+ +

+endsWith

+
+public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
+
+
Creates a matcher that matches if the examined String ends with the specified + String. +

+ For example: +

assertThat("myStringOfNote", endsWith("Note"))
+

+

+
Parameters:
suffix - the substring that the returned matcher will expect at the end of any examined string
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/CustomMatcher.html b/docs/javadoc/1.3/org/hamcrest/CustomMatcher.html new file mode 100644 index 00000000..8ddd0c68 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/CustomMatcher.html @@ -0,0 +1,302 @@ + + + + + + +CustomMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class CustomMatcher<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.CustomMatcher<T>
+
+
+
Type Parameters:
T - The type of object being matched.
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public abstract class CustomMatcher<T>
extends BaseMatcher<T>
+ + +

+Utility class for writing one off matchers. + For example: +

+ Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
+   public boolean matches(Object object) {
+     return ((object instanceof String) && !((String) object).isEmpty();
+   }
+ };
+ 
+

+ This class is designed for scenarios where an anonymous inner class + matcher makes sense. It should not be used by API designers implementing + matchers. +

+ +

+

+
Author:
+
Neil Dunn
+
See Also:
for a type safe variant of this class that you probably + want to use.
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
CustomMatcher(java.lang.String description) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface org.hamcrest.Matcher
matches
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CustomMatcher

+
+public CustomMatcher(java.lang.String description)
+
+
+ + + + + + + + +
+Method Detail
+ +

+describeTo

+
+public final void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/CustomTypeSafeMatcher.html b/docs/javadoc/1.3/org/hamcrest/CustomTypeSafeMatcher.html new file mode 100644 index 00000000..d9d00a48 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/CustomTypeSafeMatcher.html @@ -0,0 +1,305 @@ + + + + + + +CustomTypeSafeMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class CustomTypeSafeMatcher<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<T>
+          extended by org.hamcrest.CustomTypeSafeMatcher<T>
+
+
+
Type Parameters:
T - The type of object being matched
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public abstract class CustomTypeSafeMatcher<T>
extends TypeSafeMatcher<T>
+ + +

+Utility class for writing one off matchers. + For example: +

+ Matcher<String> aNonEmptyString = new CustomTypeSafeMatcher<String>("a non empty string") {
+   public boolean matchesSafely(String string) {
+     return !string.isEmpty();
+   }
+   public void describeMismatchSafely(String string, Description mismatchDescription) {
+     mismatchDescription.appendText("was empty");
+   }
+ };
+ 
+ This is a variant of CustomMatcher that first type checks + the argument being matched. By the time TypeSafeMatcher.matchesSafely(T) is + is called the argument is guaranteed to be non-null and of the correct + type. +

+ +

+

+
Author:
+
Neil Dunn
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
CustomTypeSafeMatcher(java.lang.String description) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, describeMismatchSafely, matches, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CustomTypeSafeMatcher

+
+public CustomTypeSafeMatcher(java.lang.String description)
+
+
+ + + + + + + + +
+Method Detail
+ +

+describeTo

+
+public final void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/Description.NullDescription.html b/docs/javadoc/1.3/org/hamcrest/Description.NullDescription.html new file mode 100644 index 00000000..d9e46f4b --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/Description.NullDescription.html @@ -0,0 +1,482 @@ + + + + + + +Description.NullDescription (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class Description.NullDescription

+
+java.lang.Object
+  extended by org.hamcrest.Description.NullDescription
+
+
+
All Implemented Interfaces:
Description
+
+
+
Enclosing interface:
Description
+
+
+
+
public static final class Description.NullDescription
extends java.lang.Object
implements Description
+ + +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from interface org.hamcrest.Description
Description.NullDescription
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface org.hamcrest.Description
NONE
+  + + + + + + + + + + +
+Constructor Summary
Description.NullDescription() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ DescriptionappendDescriptionOf(SelfDescribing value) + +
+          Appends the description of a SelfDescribing value to this description.
+ DescriptionappendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+          Appends a list of SelfDescribing objects + to the description.
+ DescriptionappendText(java.lang.String text) + +
+          Appends some plain text to the description.
+ DescriptionappendValue(java.lang.Object value) + +
+          Appends an arbitary value to the description.
+ + + + + +
+<T> Description
+
appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) + +
+          Appends a list of values to the description.
+ + + + + +
+<T> Description
+
appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) + +
+          Appends a list of values to the description.
+ java.lang.StringtoString() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Description.NullDescription

+
+public Description.NullDescription()
+
+
+ + + + + + + + +
+Method Detail
+ +

+appendDescriptionOf

+
+public Description appendDescriptionOf(SelfDescribing value)
+
+
Description copied from interface: Description
+
Appends the description of a SelfDescribing value to this description. +

+

+
Specified by:
appendDescriptionOf in interface Description
+
+
+
+
+
+
+ +

+appendList

+
+public Description appendList(java.lang.String start,
+                              java.lang.String separator,
+                              java.lang.String end,
+                              java.lang.Iterable<? extends SelfDescribing> values)
+
+
Description copied from interface: Description
+
Appends a list of SelfDescribing objects + to the description. +

+

+
Specified by:
appendList in interface Description
+
+
+
+
+
+
+ +

+appendText

+
+public Description appendText(java.lang.String text)
+
+
Description copied from interface: Description
+
Appends some plain text to the description. +

+

+
Specified by:
appendText in interface Description
+
+
+
+
+
+
+ +

+appendValue

+
+public Description appendValue(java.lang.Object value)
+
+
Description copied from interface: Description
+
Appends an arbitary value to the description. +

+

+
Specified by:
appendValue in interface Description
+
+
+
+
+
+
+ +

+appendValueList

+
+public <T> Description appendValueList(java.lang.String start,
+                                       java.lang.String separator,
+                                       java.lang.String end,
+                                       T... values)
+
+
Description copied from interface: Description
+
Appends a list of values to the description. +

+

+
Specified by:
appendValueList in interface Description
+
+
+
+
+
+
+ +

+appendValueList

+
+public <T> Description appendValueList(java.lang.String start,
+                                       java.lang.String separator,
+                                       java.lang.String end,
+                                       java.lang.Iterable<T> values)
+
+
Description copied from interface: Description
+
Appends a list of values to the description. +

+

+
Specified by:
appendValueList in interface Description
+
+
+
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/Description.html b/docs/javadoc/1.3/org/hamcrest/Description.html new file mode 100644 index 00000000..a261a899 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/Description.html @@ -0,0 +1,412 @@ + + + + + + +Description (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Interface Description

+
+
All Known Implementing Classes:
BaseDescription, Description.NullDescription, StringDescription
+
+
+
+
public interface Description
+ + +

+A description of a Matcher. A Matcher will describe itself to a description + which can later be used for reporting. +

+ +

+

+
See Also:
SelfDescribing.describeTo(Description)
+
+ +

+ + + + + + + + + + + +
+Nested Class Summary
+static classDescription.NullDescription + +
+           
+ + + + + + + + + + +
+Field Summary
+static DescriptionNONE + +
+          A description that consumes input but does nothing.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ DescriptionappendDescriptionOf(SelfDescribing value) + +
+          Appends the description of a SelfDescribing value to this description.
+ DescriptionappendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+          Appends a list of SelfDescribing objects + to the description.
+ DescriptionappendText(java.lang.String text) + +
+          Appends some plain text to the description.
+ DescriptionappendValue(java.lang.Object value) + +
+          Appends an arbitary value to the description.
+ + + + + +
+<T> Description
+
appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) + +
+          Appends a list of values to the description.
+ + + + + +
+<T> Description
+
appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) + +
+          Appends a list of values to the description.
+  +

+ + + + + + + + +
+Field Detail
+ +

+NONE

+
+static final Description NONE
+
+
A description that consumes input but does nothing. +

+

+
+
+ + + + + + + + +
+Method Detail
+ +

+appendText

+
+Description appendText(java.lang.String text)
+
+
Appends some plain text to the description. +

+

+
+
+
+
+ +

+appendDescriptionOf

+
+Description appendDescriptionOf(SelfDescribing value)
+
+
Appends the description of a SelfDescribing value to this description. +

+

+
+
+
+
+ +

+appendValue

+
+Description appendValue(java.lang.Object value)
+
+
Appends an arbitary value to the description. +

+

+
+
+
+
+ +

+appendValueList

+
+<T> Description appendValueList(java.lang.String start,
+                                java.lang.String separator,
+                                java.lang.String end,
+                                T... values)
+
+
Appends a list of values to the description. +

+

+
+
+
+
+ +

+appendValueList

+
+<T> Description appendValueList(java.lang.String start,
+                                java.lang.String separator,
+                                java.lang.String end,
+                                java.lang.Iterable<T> values)
+
+
Appends a list of values to the description. +

+

+
+
+
+
+ +

+appendList

+
+Description appendList(java.lang.String start,
+                       java.lang.String separator,
+                       java.lang.String end,
+                       java.lang.Iterable<? extends SelfDescribing> values)
+
+
Appends a list of SelfDescribing objects + to the description. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/DiagnosingMatcher.html b/docs/javadoc/1.3/org/hamcrest/DiagnosingMatcher.html new file mode 100644 index 00000000..a3e89ebe --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/DiagnosingMatcher.html @@ -0,0 +1,344 @@ + + + + + + +DiagnosingMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class DiagnosingMatcher<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.DiagnosingMatcher<T>
+
+
+
Type Parameters:
T -
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
AllOf, IsInstanceOf, SamePropertyValuesAs.PropertyMatcher
+
+
+
+
public abstract class DiagnosingMatcher<T>
extends BaseMatcher<T>
+ + +

+TODO(ngd): Document. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
DiagnosingMatcher() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+          Generate a description of why the matcher has not accepted the item.
+ booleanmatches(java.lang.Object item) + +
+          Evaluates the matcher for argument item.
+protected abstract  booleanmatches(java.lang.Object item, + Description mismatchDescription) + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface org.hamcrest.SelfDescribing
describeTo
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+DiagnosingMatcher

+
+public DiagnosingMatcher()
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public final boolean matches(java.lang.Object item)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
item - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeMismatch

+
+public final void describeMismatch(java.lang.Object item,
+                                   Description mismatchDescription)
+
+
Description copied from interface: Matcher
+
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 + will not check this. +

+

+
Specified by:
describeMismatch in interface Matcher<T>
Overrides:
describeMismatch in class BaseMatcher<T>
+
+
+
Parameters:
item - The item that the Matcher has rejected.
mismatchDescription - The description to be built or appended to.
+
+
+
+ +

+matches

+
+protected abstract boolean matches(java.lang.Object item,
+                                   Description mismatchDescription)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/EasyMock2Matchers.html b/docs/javadoc/1.3/org/hamcrest/EasyMock2Matchers.html new file mode 100644 index 00000000..6c02f5d5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/EasyMock2Matchers.html @@ -0,0 +1,256 @@ + + + + + + +EasyMock2Matchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class EasyMock2Matchers

+
+java.lang.Object
+  extended by org.hamcrest.EasyMock2Matchers
+
+
+
+
public class EasyMock2Matchers
extends java.lang.Object
+ + +

+

+
Author:
+
Joe Walnes
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
EasyMock2Matchers() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static java.lang.StringequalTo(java.lang.String string) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+EasyMock2Matchers

+
+public EasyMock2Matchers()
+
+
+ + + + + + + + +
+Method Detail
+ +

+equalTo

+
+public static java.lang.String equalTo(java.lang.String string)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/Factory.html b/docs/javadoc/1.3/org/hamcrest/Factory.html new file mode 100644 index 00000000..5fb6900f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/Factory.html @@ -0,0 +1,178 @@ + + + + + + +Factory (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Annotation Type Factory

+
+
+
@Retention(value=RUNTIME)
+@Target(value=METHOD)
+public @interface Factory
+ + +

+Marks a Hamcrest static factory method so tools recognise them. + A factory method is an equivalent to a named constructor. +

+ +

+

+
Author:
+
Joe Walnes
+
+ +

+ +

+ +


+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/FeatureMatcher.html b/docs/javadoc/1.3/org/hamcrest/FeatureMatcher.html new file mode 100644 index 00000000..20078aac --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/FeatureMatcher.html @@ -0,0 +1,348 @@ + + + + + + +FeatureMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class FeatureMatcher<T,U>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.FeatureMatcher<T,U>
+
+
+
Type Parameters:
T - The type of the object to be matched
U - The type of the feature to be matched
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
HasToString, IsArrayWithSize, IsCollectionWithSize, IsIterableWithSize
+
+
+
+
public abstract class FeatureMatcher<T,U>
extends TypeSafeDiagnosingMatcher<T>
+ + +

+Supporting class for matching a feature of an object. Implement featureValueOf() + in a subclass to pull out the feature to be matched against. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
FeatureMatcher(Matcher<? super U> subMatcher, + java.lang.String featureDescription, + java.lang.String featureName) + +
+          Constructor
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+protected abstract  UfeatureValueOf(T actual) + +
+          Implement this to extract the interesting feature.
+protected  booleanmatchesSafely(T actual, + Description mismatch) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+FeatureMatcher

+
+public FeatureMatcher(Matcher<? super U> subMatcher,
+                      java.lang.String featureDescription,
+                      java.lang.String featureName)
+
+
Constructor +

+

+
Parameters:
subMatcher - The matcher to apply to the feature
featureDescription - Descriptive text to use in describeTo
featureName - Identifying text for mismatch message
+
+ + + + + + + + +
+Method Detail
+ +

+featureValueOf

+
+protected abstract U featureValueOf(T actual)
+
+
Implement this to extract the interesting feature. +

+

+
Parameters:
actual - the target object +
Returns:
the feature to be matched
+
+
+
+ +

+matchesSafely

+
+protected boolean matchesSafely(T actual,
+                                Description mismatch)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<T>
+
+
+
+
+
+
+ +

+describeTo

+
+public final void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/JMock1Matchers.html b/docs/javadoc/1.3/org/hamcrest/JMock1Matchers.html new file mode 100644 index 00000000..5ede24f2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/JMock1Matchers.html @@ -0,0 +1,252 @@ + + + + + + +JMock1Matchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class JMock1Matchers

+
+java.lang.Object
+  extended by org.hamcrest.JMock1Matchers
+
+
+
+
public class JMock1Matchers
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
JMock1Matchers() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static org.jmock.core.ConstraintequalTo(java.lang.String string) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JMock1Matchers

+
+public JMock1Matchers()
+
+
+ + + + + + + + +
+Method Detail
+ +

+equalTo

+
+public static org.jmock.core.Constraint equalTo(java.lang.String string)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/JavaLangMatcherAssert.html b/docs/javadoc/1.3/org/hamcrest/JavaLangMatcherAssert.html new file mode 100644 index 00000000..1e418dd8 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/JavaLangMatcherAssert.html @@ -0,0 +1,240 @@ + + + + + + +JavaLangMatcherAssert (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class JavaLangMatcherAssert

+
+java.lang.Object
+  extended by org.hamcrest.JavaLangMatcherAssert
+
+
+
+
public class JavaLangMatcherAssert
extends java.lang.Object
+ + +

+Integration method for use with Java's assert keyword. + Example: +

+ assert that("Foo", startsWith("f"));
+ 
+

+ +

+

+
Author:
+
Neil Dunn
+
+
+ +

+ + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> boolean
+
that(T argument, + Matcher<? super T> matcher) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Method Detail
+ +

+that

+
+public static <T> boolean that(T argument,
+                               Matcher<? super T> matcher)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/Matcher.html b/docs/javadoc/1.3/org/hamcrest/Matcher.html new file mode 100644 index 00000000..c8c6d8d9 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/Matcher.html @@ -0,0 +1,310 @@ + + + + + + +Matcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Interface Matcher<T>

+
+
All Superinterfaces:
SelfDescribing
+
+
+
All Known Implementing Classes:
AllOf, AnyOf, BaseMatcher, BigDecimalCloseTo, CombinableMatcher, CustomMatcher, CustomTypeSafeMatcher, DescribedAs, DiagnosingMatcher, Every, FeatureMatcher, HasProperty, HasPropertyWithValue, HasToString, HasXPath, Is, IsAnything, IsArray, IsArrayContaining, IsArrayContainingInAnyOrder, IsArrayContainingInOrder, IsArrayWithSize, IsCloseTo, IsCollectionContaining, IsCollectionWithSize, IsCompatibleType, IsEmptyCollection, IsEmptyIterable, IsEmptyString, IsEqual, IsEqualIgnoringCase, IsEqualIgnoringWhiteSpace, IsEventFrom, IsIn, IsInstanceOf, IsIterableContainingInAnyOrder, IsIterableContainingInOrder, IsIterableWithSize, IsMapContaining, IsNot, IsNull, IsSame, OrderingComparison, SamePropertyValuesAs, SamePropertyValuesAs.PropertyMatcher, StringContains, StringContainsInOrder, StringEndsWith, StringStartsWith, SubstringMatcher, TypeSafeDiagnosingMatcher, TypeSafeMatcher
+
+
+
+
public interface Matcher<T>
extends SelfDescribing
+ + +

+A matcher over acceptable values. + A matcher is able to describe itself to give feedback when it fails. +

+ Matcher implementations should NOT directly implement this interface. + Instead, extend the BaseMatcher abstract class, + which will ensure that the Matcher API can grow to support + new features and remain compatible with all Matcher implementations. +

+ For easy access to common Matcher implementations, use the static factory + methods in CoreMatchers. +

+ N.B. Well designed matchers should be immutable. +

+ +

+

+
See Also:
CoreMatchers, +BaseMatcher
+
+ +

+ + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ void_dont_implement_Matcher___instead_extend_BaseMatcher_() + +
+          Deprecated. to make
+ voiddescribeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+          Generate a description of why the matcher has not accepted the item.
+ booleanmatches(java.lang.Object item) + +
+          Evaluates the matcher for argument item.
+ + + + + + + +
Methods inherited from interface org.hamcrest.SelfDescribing
describeTo
+  +

+ + + + + + + + +
+Method Detail
+ +

+matches

+
+boolean matches(java.lang.Object item)
+
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
+
+
+
Parameters:
item - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeMismatch

+
+void describeMismatch(java.lang.Object item,
+                      Description mismatchDescription)
+
+
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 + will not check this. +

+

+
+
+
+
Parameters:
item - The item that the Matcher has rejected.
mismatchDescription - The description to be built or appended to.
+
+
+
+ +

+_dont_implement_Matcher___instead_extend_BaseMatcher_

+
+@Deprecated
+void _dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
Deprecated. to make +

+

This method simply acts a friendly reminder not to implement Matcher directly and + instead extend BaseMatcher. It's easy to ignore JavaDoc, but a bit harder to ignore + compile errors . +

+

+
+
+
+
See Also:
for reasons why., +BaseMatcher
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/MatcherAssert.html b/docs/javadoc/1.3/org/hamcrest/MatcherAssert.html new file mode 100644 index 00000000..0f0874d8 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/MatcherAssert.html @@ -0,0 +1,312 @@ + + + + + + +MatcherAssert (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class MatcherAssert

+
+java.lang.Object
+  extended by org.hamcrest.MatcherAssert
+
+
+
+
public class MatcherAssert
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
MatcherAssert() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static voidassertThat(java.lang.String reason, + boolean assertion) + +
+           
+static + + + + +
+<T> void
+
assertThat(java.lang.String reason, + T actual, + Matcher<? super T> matcher) + +
+           
+static + + + + +
+<T> void
+
assertThat(T actual, + Matcher<? super T> matcher) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+MatcherAssert

+
+public MatcherAssert()
+
+
+ + + + + + + + +
+Method Detail
+ +

+assertThat

+
+public static <T> void assertThat(T actual,
+                                  Matcher<? super T> matcher)
+
+
+
+
+
+
+ +

+assertThat

+
+public static <T> void assertThat(java.lang.String reason,
+                                  T actual,
+                                  Matcher<? super T> matcher)
+
+
+
+
+
+
+ +

+assertThat

+
+public static void assertThat(java.lang.String reason,
+                              boolean assertion)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/Matchers.html b/docs/javadoc/1.3/org/hamcrest/Matchers.html new file mode 100644 index 00000000..23072ad2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/Matchers.html @@ -0,0 +1,3658 @@ + + + + + + +Matchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class Matchers

+
+java.lang.Object
+  extended by org.hamcrest.Matchers
+
+
+
+
public class Matchers
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Matchers() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> Matcher<T>
+
allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
any(java.lang.Class<T> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static Matcher<java.lang.Object>anything() + +
+          Creates a matcher that always matches, regardless of the examined object.
+static Matcher<java.lang.Object>anything(java.lang.String description) + +
+          Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+static + + + + +
+<T> IsArray<T>
+
array(Matcher<? super T>... elementMatchers) + +
+          Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContaining(E... items) + +
+          Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContaining(java.util.List<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContaining(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContainingInAnyOrder(E... items) + +
+          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.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContainingInAnyOrder(Matcher<? super E>... 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.
+static + + + + +
+<E> Matcher<E[]>
+
arrayWithSize(int size) + +
+          Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+static + + + + +
+<E> Matcher<E[]>
+
arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+static Matcher<java.math.BigDecimal>closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error) + +
+          Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+static Matcher<java.lang.Double>closeTo(double operand, + double error) + +
+          Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
comparesEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(E... items) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(java.util.List<Matcher<? super E>> itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(Matcher<? super E> itemMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
containsInAnyOrder(Matcher<? super E> itemMatcher) + +
+          Deprecated. use contains(Matcher itemMatcher) instead
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
containsInAnyOrder(Matcher<? super T>... itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
containsInAnyOrder(T... items) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+static Matcher<java.lang.String>containsString(java.lang.String substring) + +
+          Creates a matcher that matches if the examined String contains the specified + String anywhere.
+static + + + + +
+<T> Matcher<T>
+
describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
empty() + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<E[]>
+
emptyArray() + +
+          Creates a matcher for arrays that matches when the length of the array + is zero.
+static + + + + +
+<E> Matcher<java.util.Collection<E>>
+
emptyCollectionOf(java.lang.Class<E> type) + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
emptyIterable() + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
emptyIterableOf(java.lang.Class<E> type) + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static Matcher<java.lang.String>endsWith(java.lang.String suffix) + +
+          Creates a matcher that matches if the examined String ends with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
equalTo(T operand) + +
+          Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+static Matcher<java.lang.String>equalToIgnoringCase(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+static Matcher<java.lang.String>equalToIgnoringWhiteSpace(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+static Matcher<java.util.EventObject>eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+static Matcher<java.util.EventObject>eventFrom(java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any EventObject + announced by source.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
greaterThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
greaterThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
hasEntry(K key, + V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
hasItem(T item) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+static + + + + +
+<T> Matcher<T[]>
+
hasItemInArray(Matcher<? super T> elementMatcher) + +
+          Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
hasItemInArray(T element) + +
+          A shortcut to the frequently used hasItemInArray(equalTo(x)).
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
hasItems(T... items) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
hasKey(K key) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
hasKey(Matcher<? super K> keyMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
hasProperty(java.lang.String propertyName) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+static + + + + +
+<T> Matcher<T>
+
hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
hasSize(int size) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
hasSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
hasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
hasToString(java.lang.String expectedToString) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
hasValue(Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
hasValue(V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+static + + + + +
+<T> Matcher<T>
+
instanceOf(java.lang.Class<?> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> Matcher<T>
+
is(java.lang.Class<T> type) + +
+          Deprecated. use isA(Class type) instead.
+static + + + + +
+<T> Matcher<T>
+
is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
is(T value) + +
+          A shortcut to the frequently used is(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
isA(java.lang.Class<T> type) + +
+          A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+static Matcher<java.lang.String>isEmptyOrNullString() + +
+          Creates a matcher of String that matches when the examined string is null, or + has zero length.
+static Matcher<java.lang.String>isEmptyString() + +
+          Creates a matcher of String that matches when the examined string has zero length.
+static + + + + +
+<T> Matcher<T>
+
isIn(java.util.Collection<T> collection) + +
+          Creates a matcher that matches when the examined object is found within the + specified collection.
+static + + + + +
+<T> Matcher<T>
+
isIn(T[] param1) + +
+           
+static + + + + +
+<T> Matcher<T>
+
isOneOf(T... elements) + +
+          Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
iterableWithSize(int size) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
lessThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
lessThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+static + + + + +
+<T> Matcher<T>
+
not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
not(T value) + +
+          A shortcut to the frequently used not(equalTo(x)).
+static Matcher<java.lang.Object>notNullValue() + +
+          A shortcut to the frequently used not(nullValue()).
+static + + + + +
+<T> Matcher<T>
+
notNullValue(java.lang.Class<T> type) + +
+          A shortcut to the frequently used not(nullValue(X.class)).
+static Matcher<java.lang.Object>nullValue() + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
nullValue(java.lang.Class<T> type) + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
sameInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static + + + + +
+<T> Matcher<T>
+
samePropertyValuesAs(T expectedBean) + +
+          Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+static Matcher<java.lang.String>startsWith(java.lang.String prefix) + +
+          Creates a matcher that matches if the examined String starts with the specified + String.
+static Matcher<java.lang.String>stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) + +
+          Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance.
+static + + + + +
+<T> Matcher<T>
+
theInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static + + + + +
+<T> Matcher<java.lang.Class<?>>
+
typeCompatibleWith(java.lang.Class<T> baseType) + +
+          Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Matchers

+
+public Matchers()
+
+
+ + + + + + + + +
+Method Detail
+ +

+allOf

+
+public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third,
+                                   Matcher<? super T> fourth)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third,
+                                   Matcher<? super T> fourth,
+                                   Matcher<? super T> fifth)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> 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)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth,
+                                 Matcher<? super T> fifth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth,
+                                 Matcher<? super T> fifth,
+                                 Matcher<? super T> sixth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+both

+
+public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
+
+
Creates a matcher that matches when both of the specified matchers match the examined object. +

+ For example: +

assertThat("fab", both(containsString("a")).and(containsString("b")))
+

+

+
+
+
+
+ +

+either

+
+public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
+
+
Creates a matcher that matches when either of the specified matchers match the examined object. +

+ For example: +

assertThat("fan", either(containsString("a")).and(containsString("b")))
+

+

+
+
+
+
+ +

+describedAs

+
+public static <T> Matcher<T> describedAs(java.lang.String description,
+                                         Matcher<T> matcher,
+                                         java.lang.Object... values)
+
+
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())
+

+

+
Parameters:
description - the new description for the wrapped matcher
matcher - the matcher to wrap
values - optional values to insert into the tokenised description
+
+
+
+ +

+everyItem

+
+public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. +

+ For example: +

assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
+

+

+
Parameters:
itemMatcher - the matcher to apply to every item provided by the examined Iterable
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(T value)
+
+
A shortcut to the frequently used is(equalTo(x)). +

+ For example: +

assertThat(cheese, is(smelly))
+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
+

+

+
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(Matcher<T> matcher)
+
+
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))
+

+

+
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(java.lang.Class<T> type)
+
+
Deprecated. use isA(Class type) instead. +

+

A shortcut to the frequently used is(instanceOf(SomeClass.class)). +

+ For example: +

assertThat(cheese, is(Cheddar.class))
+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
+

+

+
+
+
+
+ +

+isA

+
+public static <T> Matcher<T> isA(java.lang.Class<T> type)
+
+
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)))
+

+

+
+
+
+
+ +

+anything

+
+public static Matcher<java.lang.Object> anything()
+
+
Creates a matcher that always matches, regardless of the examined object. +

+

+
+
+
+
+ +

+anything

+
+public static Matcher<java.lang.Object> anything(java.lang.String description)
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. +

+

+
Parameters:
description - a meaningful String used when describing itself
+
+
+
+ +

+hasItem

+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
+

+

+
Parameters:
item - the item to compare against the items provided by the examined Iterable
+
+
+
+ +

+hasItem

+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
+

+

+
Parameters:
itemMatcher - the matcher to apply to items provided by the examined Iterable
+
+
+
+ +

+hasItems

+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
+

+

+
Parameters:
items - the items to compare against the items provided by the examined Iterable
+
+
+
+ +

+hasItems

+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
+

+

+
Parameters:
itemMatchers - the matchers to apply to items provided by the examined Iterable
+
+
+
+ +

+equalTo

+
+public static <T> Matcher<T> equalTo(T operand)
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

+

+ For example: +

+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ 
+

+

+
+
+
+
+ +

+any

+
+public static <T> Matcher<T> any(java.lang.Class<T> type)
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
+

+

+
+
+
+
+ +

+instanceOf

+
+public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

+

+ For example: +

assertThat(new Canoe(), instanceOf(Paddlable.class));
+

+

+
+
+
+
+ +

+not

+
+public static <T> Matcher<T> not(Matcher<T> matcher)
+
+
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))))
+

+

+
Parameters:
matcher - the matcher whose sense should be inverted
+
+
+
+ +

+not

+
+public static <T> Matcher<T> not(T value)
+
+
A shortcut to the frequently used not(equalTo(x)). +

+ For example: +

assertThat(cheese, is(not(smelly)))
+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
+

+

+
Parameters:
value - the value that any examined object should not equal
+
+
+
+ +

+nullValue

+
+public static Matcher<java.lang.Object> nullValue()
+
+
Creates a matcher that matches if examined object is null. +

+ For example: +

assertThat(cheese, is(nullValue())
+

+

+
+
+
+
+ +

+nullValue

+
+public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
+
+
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))
+

+

+
Parameters:
type - dummy parameter used to infer the generic type of the returned matcher
+
+
+
+ +

+notNullValue

+
+public static Matcher<java.lang.Object> notNullValue()
+
+
A shortcut to the frequently used not(nullValue()). +

+ For example: +

assertThat(cheese, is(notNullValue()))
+ instead of: +
assertThat(cheese, is(not(nullValue())))
+

+

+
+
+
+
+ +

+notNullValue

+
+public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
+
+
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))))
+

+

+
Parameters:
type - dummy parameter used to infer the generic type of the returned matcher
+
+
+
+ +

+sameInstance

+
+public static <T> Matcher<T> sameInstance(T target)
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +

+

+
Parameters:
target - the target instance against which others should be assessed
+
+
+
+ +

+theInstance

+
+public static <T> Matcher<T> theInstance(T target)
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +

+

+
Parameters:
target - the target instance against which others should be assessed
+
+
+
+ +

+containsString

+
+public static Matcher<java.lang.String> containsString(java.lang.String substring)
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere. +

+ For example: +

assertThat("myStringOfNote", containsString("ring"))
+

+

+
Parameters:
substring - the substring that the returned matcher will expect to find within any examined string
+
+
+
+ +

+startsWith

+
+public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
+
+
Creates a matcher that matches if the examined String starts with the specified + String. +

+ For example: +

assertThat("myStringOfNote", startsWith("my"))
+

+

+
Parameters:
prefix - the substring that the returned matcher will expect at the start of any examined string
+
+
+
+ +

+endsWith

+
+public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
+
+
Creates a matcher that matches if the examined String ends with the specified + String. +

+ For example: +

assertThat("myStringOfNote", endsWith("Note"))
+

+

+
Parameters:
suffix - the substring that the returned matcher will expect at the end of any examined string
+
+
+
+ +

+array

+
+public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)
+
+
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: +

assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
+

+

+
Parameters:
elementMatchers - the matchers that the elements of examined arrays should satisfy
+
+
+
+ +

+hasItemInArray

+
+public static <T> Matcher<T[]> hasItemInArray(T element)
+
+
A shortcut to the frequently used hasItemInArray(equalTo(x)). +

+ For example: +

assertThat(hasItemInArray(x))
+ instead of: +
assertThat(hasItemInArray(equalTo(x)))
+

+

+
Parameters:
element - the element that should be present in examined arrays
+
+
+
+ +

+hasItemInArray

+
+public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
+
+
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: +

assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
+

+

+
Parameters:
elementMatcher - the matcher to apply to elements in examined arrays
+
+
+
+ +

+arrayContaining

+
+public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> 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: +

assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
+
+
+
+ +

+arrayContaining

+
+public static <E> Matcher<E[]> arrayContaining(E... items)
+
+
Creates a matcher for arrays that matcheswhen 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: +

assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
+

+

+
Parameters:
items - the items that must equal the items within an examined array
+
+
+
+ +

+arrayContaining

+
+public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
+
+
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: +

assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
+

+

+
Parameters:
itemMatchers - the matchers that must be satisfied by the items in the examined array
+
+
+
+ +

+arrayContainingInAnyOrder

+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
+
+
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. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
+

+

+
Parameters:
items - the items that must equal the entries of an examined array, in any order
+
+
+
+ +

+arrayContainingInAnyOrder

+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... 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. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
+
+
+
+ +

+arrayContainingInAnyOrder

+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
+
+
+
+ +

+arrayWithSize

+
+public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
+

+

+
Parameters:
sizeMatcher - a matcher for the length of an examined array
+
+
+
+ +

+arrayWithSize

+
+public static <E> Matcher<E[]> arrayWithSize(int size)
+
+
Creates a matcher for arrays that matches when the length of the array + equals the specified size. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
+

+

+
Parameters:
size - the length that an examined array must have for a positive match
+
+
+
+ +

+emptyArray

+
+public static <E> Matcher<E[]> emptyArray()
+
+
Creates a matcher for arrays that matches when the length of the array + is zero. +

+ For example: +

assertThat(new String[0], emptyArray())
+

+

+
+
+
+
+ +

+hasSize

+
+public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
+

+

+
Parameters:
sizeMatcher - a matcher for the size of an examined Collection
+
+
+
+ +

+hasSize

+
+public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
+
+
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasSize(2))
+

+

+
Parameters:
size - the expected size of an examined Collection
+
+
+
+ +

+empty

+
+public static <E> Matcher<java.util.Collection<? extends E>> empty()
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +

+ For example: +

assertThat(new ArrayList<String>(), is(empty()))
+

+

+
+
+
+
+ +

+emptyCollectionOf

+
+public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> type)
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +

+ For example: +

assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
+

+

+
Parameters:
type - the type of the collection's content
+
+
+
+ +

+emptyIterable

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()
+
+
Creates a matcher for Iterables matching examined iterables that yield no items. +

+ For example: +

assertThat(new ArrayList<String>(), is(emptyIterable()))
+

+

+
+
+
+
+ +

+emptyIterableOf

+
+public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> type)
+
+
Creates a matcher for Iterables matching examined iterables that yield no items. +

+ For example: +

assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
+

+

+
Parameters:
type - the type of the iterable's content
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. For a positive match, the examined iterable + must be of the same length as the number of specified matchers. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
+

+

+
Parameters:
itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. For a positive match, the examined iterable + must be of the same length as the number of specified items. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
+

+

+
Parameters:
items - the items that must equal the items provided by an examined Iterable
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. +

+ For example: +

assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
+

+

+
Parameters:
itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. For a positive match, the examined iterable + must be of the same length as the specified list of matchers. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
+
+
+
+ +

+containsInAnyOrder

+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
+
+
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. For a positive match, the examined iterable + 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 + iterable. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
+

+

+
Parameters:
items - the items that must equal the items provided by an examined Iterable in any order
+
+
+
+ +

+containsInAnyOrder

+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. For a positive match, the examined iterable + 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 iterable. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
+
+
+
+ +

+containsInAnyOrder

+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. For a positive match, the examined iterable 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 + iterable. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
+
+
+
+ +

+containsInAnyOrder

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> containsInAnyOrder(Matcher<? super E> itemMatcher)
+
+
Deprecated. use contains(Matcher itemMatcher) instead +

+

Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. +

+ For example: +

assertThat(Arrays.asList("foo"), containsInAnyOrder(equalTo("foo")))
+

+

+
Parameters:
itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
+
+
+
+ +

+iterableWithSize

+
+public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
+

+

+
Parameters:
sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
+
+
+
+ +

+iterableWithSize

+
+public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
+

+

+
Parameters:
size - the number of items that should be yielded by an examined Iterable
+
+
+
+ +

+hasEntry

+
+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
+                                                                             V value)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. +

+ For example: +

assertThat(myMap, hasEntry("bar", "foo"))
+

+

+
Parameters:
key - the key that, in combination with the value, must be describe at least one entry
value - the value that, in combination with the key, must be describe at least one entry
+
+
+
+ +

+hasEntry

+
+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
+                                                                             Matcher<? super V> valueMatcher)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. +

+ For example: +

assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
+

+

+
Parameters:
keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry
valueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry
+
+
+
+ +

+hasKey

+
+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. +

+ For example: +

assertThat(myMap, hasKey(equalTo("bar")))
+

+

+
Parameters:
keyMatcher - the matcher that must be satisfied by at least one key
+
+
+
+ +

+hasKey

+
+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. +

+ For example: +

assertThat(myMap, hasKey("bar"))
+

+

+
Parameters:
key - the key that satisfying maps must contain
+
+
+
+ +

+hasValue

+
+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. +

+ For example: +

assertThat(myMap, hasValue("foo"))
+

+

+
Parameters:
value - the value that satisfying maps must contain
+
+
+
+ +

+hasValue

+
+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. +

+ For example: +

assertThat(myMap, hasValue(equalTo("foo")))
+

+

+
Parameters:
valueMatcher - the matcher that must be satisfied by at least one value
+
+
+
+ +

+isIn

+
+public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
+
+
Creates a matcher that matches when the examined object is found within the + specified collection. +

+ For example: +

assertThat("foo", isIn(Arrays.asList("bar", "foo")))
+

+

+
Parameters:
collection - the collection in which matching items must be found
+
+
+
+ +

+isIn

+
+public static <T> Matcher<T> isIn(T[] param1)
+
+
+
+
+
+
+ +

+isOneOf

+
+public static <T> Matcher<T> isOneOf(T... elements)
+
+
Creates a matcher that matches when the examined object is equal to one of the + specified elements. +

+ For example: +

assertThat("foo", isIn("bar", "foo"))
+

+

+
Parameters:
elements - the elements amongst which matching items will be found
+
+
+
+ +

+closeTo

+
+public static Matcher<java.lang.Double> closeTo(double operand,
+                                                double error)
+
+
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. +

+ For example: +

assertThat(1.03, is(closeTo(1.0, 0.03)))
+

+

+
Parameters:
operand - the expected value of matching doubles
error - the delta (+/-) within which matches will be allowed
+
+
+
+ +

+closeTo

+
+public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand,
+                                                    java.math.BigDecimal error)
+
+
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. The comparison for equality + is done by BigDecimals BigDecimal.compareTo(java.math.BigDecimal) method. +

+ For example: +

assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
+

+

+
Parameters:
operand - the expected value of matching BigDecimals
error - the delta (+/-) within which matches will be allowed
+
+
+
+ +

+comparesEqualTo

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. +

+ For example: +

assertThat(1, comparesEqualTo(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return zero
+
+
+
+ +

+greaterThan

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. +

+ For example: +

assertThat(2, greaterThan(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
+
+
+
+ +

+greaterThanOrEqualTo

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. +

+ For example: +

assertThat(1, greaterThanOrEqualTo(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
+
+
+
+ +

+lessThan

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. +

+ For example: +

assertThat(1, lessThan(2))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
+
+
+
+ +

+lessThanOrEqualTo

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. +

+ For example: +

assertThat(1, lessThanOrEqualTo(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
+
+
+
+ +

+equalToIgnoringCase

+
+public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. +

+ For example: +

assertThat("Foo", equalToIgnoringCase("FOO"))
+

+

+
Parameters:
expectedString - the expected value of matched strings
+
+
+
+ +

+equalToIgnoringWhiteSpace

+
+public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. To be + exact, the following whitespace rules are applied: +
    +
  • all leading and trailing whitespace of both the expectedString and the examined string are ignored
  • +
  • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
  • +
+

+ For example: +

assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
+

+

+
Parameters:
expectedString - the expected value of matched strings
+
+
+
+ +

+isEmptyString

+
+public static Matcher<java.lang.String> isEmptyString()
+
+
Creates a matcher of String that matches when the examined string has zero length. +

+ For example: +

assertThat("", isEmptyString())
+

+

+
+
+
+
+ +

+isEmptyOrNullString

+
+public static Matcher<java.lang.String> isEmptyOrNullString()
+
+
Creates a matcher of String that matches when the examined string is null, or + has zero length. +

+ For example: +

assertThat(((String)null), isEmptyString())
+

+

+
+
+
+
+ +

+stringContainsInOrder

+
+public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance. +

+ For example: +

assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
+

+

+
Parameters:
substrings - the substrings that must be contained within matching strings
+
+
+
+ +

+hasToString

+
+public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
+
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. +

+ For example: +

assertThat(true, hasToString(equalTo("TRUE")))
+

+

+
Parameters:
toStringMatcher - the matcher used to verify the toString result
+
+
+
+ +

+hasToString

+
+public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
+
+
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. +

+ For example: +

assertThat(true, hasToString("TRUE"))
+

+

+
Parameters:
expectedToString - the expected toString result
+
+
+
+ +

+typeCompatibleWith

+
+public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
+
+
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. +

+ For example: +

assertThat(Integer.class, typeCompatibleWith(Number.class))
+

+

+
Parameters:
baseType - the base class to examine classes against
+
+
+
+ +

+eventFrom

+
+public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+                                                       java.lang.Object source)
+
+
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. +

+ For example: +
assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
+

+

+
Parameters:
eventClass - the class of the event to match on
source - the source of the event
+
+
+
+ +

+eventFrom

+
+public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
+
+
Creates a matcher of EventObject that matches any EventObject + announced by source. +

+ For example: +
assertThat(myEvent, is(eventFrom(myBean)))
+

+

+
Parameters:
source - the source of the event
+
+
+
+ +

+hasProperty

+
+public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. +

+ For example: +

assertThat(myBean, hasProperty("foo"))
+

+

+
Parameters:
propertyName - the name of the JavaBean property that examined beans should possess
+
+
+
+ +

+hasProperty

+
+public static <T> Matcher<T> hasProperty(java.lang.String propertyName,
+                                         Matcher<?> valueMatcher)
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. +

+ For example: +

assertThat(myBean, hasProperty("foo", equalTo("bar"))
+

+

+
Parameters:
propertyName - the name of the JavaBean property that examined beans should possess
valueMatcher - a matcher for the value of the specified property of the examined bean
+
+
+
+ +

+samePropertyValuesAs

+
+public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)
+
+
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. +

+ For example: +

assertThat(myBean, samePropertyValuesAs(myExpectedBean))
+

+

+
Parameters:
expectedBean - the bean against which examined beans are compared
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
+                                                 javax.xml.namespace.NamespaceContext namespaceContext)
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
+

+

+
Parameters:
xPath - the target xpath
namespaceContext - the namespace for matching nodes
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese"))
+

+

+
Parameters:
xPath - the target xpath
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
+                                                 javax.xml.namespace.NamespaceContext namespaceContext,
+                                                 Matcher<java.lang.String> valueMatcher)
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
+

+

+
Parameters:
xPath - the target xpath
namespaceContext - the namespace for matching nodes
valueMatcher - matcher for the value at the specified xpath
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
+                                                 Matcher<java.lang.String> valueMatcher)
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
+

+

+
Parameters:
xPath - the target xpath
valueMatcher - matcher for the value at the specified xpath
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/SelfDescribing.html b/docs/javadoc/1.3/org/hamcrest/SelfDescribing.html new file mode 100644 index 00000000..2f8e5909 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/SelfDescribing.html @@ -0,0 +1,220 @@ + + + + + + +SelfDescribing (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Interface SelfDescribing

+
+
All Known Subinterfaces:
Matcher<T>
+
+
+
All Known Implementing Classes:
AllOf, AnyOf, BaseMatcher, BigDecimalCloseTo, CombinableMatcher, CustomMatcher, CustomTypeSafeMatcher, DescribedAs, DiagnosingMatcher, Every, FeatureMatcher, HasProperty, HasPropertyWithValue, HasToString, HasXPath, Is, IsAnything, IsArray, IsArrayContaining, IsArrayContainingInAnyOrder, IsArrayContainingInOrder, IsArrayWithSize, IsCloseTo, IsCollectionContaining, IsCollectionWithSize, IsCompatibleType, IsEmptyCollection, IsEmptyIterable, IsEmptyString, IsEqual, IsEqualIgnoringCase, IsEqualIgnoringWhiteSpace, IsEventFrom, IsIn, IsInstanceOf, IsIterableContainingInAnyOrder, IsIterableContainingInOrder, IsIterableWithSize, IsMapContaining, IsNot, IsNull, IsSame, OrderingComparison, SamePropertyValuesAs, SamePropertyValuesAs.PropertyMatcher, SelfDescribingValue, StringContains, StringContainsInOrder, StringEndsWith, StringStartsWith, SubstringMatcher, TypeSafeDiagnosingMatcher, TypeSafeMatcher
+
+
+
+
public interface SelfDescribing
+ + +

+The ability of an object to describe itself. +

+ +

+


+ +

+ + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+  +

+ + + + + + + + +
+Method Detail
+ +

+describeTo

+
+void describeTo(Description description)
+
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/StringDescription.html b/docs/javadoc/1.3/org/hamcrest/StringDescription.html new file mode 100644 index 00000000..ce87692d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/StringDescription.html @@ -0,0 +1,420 @@ + + + + + + +StringDescription (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class StringDescription

+
+java.lang.Object
+  extended by org.hamcrest.BaseDescription
+      extended by org.hamcrest.StringDescription
+
+
+
All Implemented Interfaces:
Description
+
+
+
+
public class StringDescription
extends BaseDescription
+ + +

+A Description that is stored as a string. +

+ +

+


+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from interface org.hamcrest.Description
Description.NullDescription
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface org.hamcrest.Description
NONE
+  + + + + + + + + + + + + + +
+Constructor Summary
StringDescription() + +
+           
StringDescription(java.lang.Appendable out) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected  voidappend(char c) + +
+          Append the char c to the description.
+protected  voidappend(java.lang.String str) + +
+          Append the String str to the description.
+static java.lang.StringasString(SelfDescribing selfDescribing) + +
+          Alias for toString(SelfDescribing).
+ java.lang.StringtoString() + +
+          Returns the description as a string.
+static java.lang.StringtoString(SelfDescribing selfDescribing) + +
+          Return the description of a SelfDescribing object as a String.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseDescription
appendDescriptionOf, appendList, appendText, appendValue, appendValueList, appendValueList
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StringDescription

+
+public StringDescription()
+
+
+
+ +

+StringDescription

+
+public StringDescription(java.lang.Appendable out)
+
+
+ + + + + + + + +
+Method Detail
+ +

+toString

+
+public static java.lang.String toString(SelfDescribing selfDescribing)
+
+
Return the description of a SelfDescribing object as a String. +

+

+
Parameters:
selfDescribing - The object to be described. +
Returns:
The description of the object.
+
+
+
+ +

+asString

+
+public static java.lang.String asString(SelfDescribing selfDescribing)
+
+
Alias for toString(SelfDescribing). +

+

+
+
+
+
+ +

+append

+
+protected void append(java.lang.String str)
+
+
Description copied from class: BaseDescription
+
Append the String str to the description. + The default implementation passes every character to BaseDescription.append(char). + Override in subclasses to provide an efficient implementation. +

+

+
Overrides:
append in class BaseDescription
+
+
+
+
+
+
+ +

+append

+
+protected void append(char c)
+
+
Description copied from class: BaseDescription
+
Append the char c to the description. +

+

+
Specified by:
append in class BaseDescription
+
+
+
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
Returns the description as a string. +

+

+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/TypeSafeDiagnosingMatcher.html b/docs/javadoc/1.3/org/hamcrest/TypeSafeDiagnosingMatcher.html new file mode 100644 index 00000000..7c0e9e8e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/TypeSafeDiagnosingMatcher.html @@ -0,0 +1,402 @@ + + + + + + +TypeSafeDiagnosingMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class TypeSafeDiagnosingMatcher<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+
+
+
Type Parameters:
T -
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
CombinableMatcher, Every, FeatureMatcher, HasPropertyWithValue, HasXPath, IsCollectionContaining, IsEventFrom, IsIterableContainingInAnyOrder, IsIterableContainingInOrder, SamePropertyValuesAs
+
+
+
+
public abstract class TypeSafeDiagnosingMatcher<T>
extends BaseMatcher<T>
+ + +

+Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. + This implements the null check, checks the type and then casts. + To use, implement

matchesSafely()
. +

+ +

+

+
Author:
+
Neil Dunn, Nat Pryce, Steve Freeman
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
+protected TypeSafeDiagnosingMatcher() + +
+          The default constructor for simple sub types
+protected TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType) + +
+          Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder) + +
+          Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+          Generate a description of why the matcher has not accepted the item.
+ booleanmatches(java.lang.Object item) + +
+          Evaluates the matcher for argument item.
+protected abstract  booleanmatchesSafely(T item, + Description mismatchDescription) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface org.hamcrest.SelfDescribing
describeTo
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+TypeSafeDiagnosingMatcher

+
+protected TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +

+

+
Parameters:
expectedType - The expectedType of the actual value.
+
+
+ +

+TypeSafeDiagnosingMatcher

+
+protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +

+

+
Parameters:
typeFinder - A type finder to extract the type
+
+
+ +

+TypeSafeDiagnosingMatcher

+
+protected TypeSafeDiagnosingMatcher()
+
+
The default constructor for simple sub types +

+

+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+protected abstract boolean matchesSafely(T item,
+                                         Description mismatchDescription)
+
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
+
+
+
+ +

+matches

+
+public final boolean matches(java.lang.Object item)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
item - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeMismatch

+
+public final void describeMismatch(java.lang.Object item,
+                                   Description mismatchDescription)
+
+
Description copied from interface: Matcher
+
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 + will not check this. +

+

+
Specified by:
describeMismatch in interface Matcher<T>
Overrides:
describeMismatch in class BaseMatcher<T>
+
+
+
Parameters:
item - The item that the Matcher has rejected.
mismatchDescription - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/TypeSafeMatcher.html b/docs/javadoc/1.3/org/hamcrest/TypeSafeMatcher.html new file mode 100644 index 00000000..424994ff --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/TypeSafeMatcher.html @@ -0,0 +1,416 @@ + + + + + + +TypeSafeMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest +
+Class TypeSafeMatcher<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
BigDecimalCloseTo, CustomTypeSafeMatcher, HasProperty, IsArray, IsArrayContaining, IsArrayContainingInAnyOrder, IsArrayContainingInOrder, IsCloseTo, IsCompatibleType, IsEmptyCollection, IsEmptyIterable, IsEqualIgnoringCase, IsEqualIgnoringWhiteSpace, IsMapContaining, OrderingComparison, StringContainsInOrder, SubstringMatcher
+
+
+
+
public abstract class TypeSafeMatcher<T>
extends BaseMatcher<T>
+ + +

+Convenient base class for Matchers that require a non-null value of a specific type. + This simply implements the null check, checks the type and then casts. +

+ +

+

+
Author:
+
Joe Walnes, Steve Freeman, Nat Pryce
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
+protected TypeSafeMatcher() + +
+          The default constructor for simple sub types
+protected TypeSafeMatcher(java.lang.Class<?> expectedType) + +
+          Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder) + +
+          Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatch(java.lang.Object item, + Description description) + +
+          Generate a description of why the matcher has not accepted the item.
+protected  voiddescribeMismatchSafely(T item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ booleanmatches(java.lang.Object item) + +
+          Methods made final to prevent accidental override.
+protected abstract  booleanmatchesSafely(T item) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface org.hamcrest.SelfDescribing
describeTo
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+TypeSafeMatcher

+
+protected TypeSafeMatcher()
+
+
The default constructor for simple sub types +

+

+
+ +

+TypeSafeMatcher

+
+protected TypeSafeMatcher(java.lang.Class<?> expectedType)
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +

+

+
Parameters:
expectedType - The expectedType of the actual value.
+
+
+ +

+TypeSafeMatcher

+
+protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder)
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type. +

+

+
Parameters:
typeFinder - A type finder to extract the type
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+protected abstract boolean matchesSafely(T item)
+
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
+
+
+
+ +

+describeMismatchSafely

+
+protected void describeMismatchSafely(T item,
+                                      Description mismatchDescription)
+
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
+
+
+
+ +

+matches

+
+public final boolean matches(java.lang.Object item)
+
+
Methods made final to prevent accidental override. + If you need to override this, there's no point on extending TypeSafeMatcher. + Instead, extend the BaseMatcher. +

+

+
Parameters:
item - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeMismatch

+
+public final void describeMismatch(java.lang.Object item,
+                                   Description description)
+
+
Description copied from interface: Matcher
+
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 + will not check this. +

+

+
Specified by:
describeMismatch in interface Matcher<T>
Overrides:
describeMismatch in class BaseMatcher<T>
+
+
+
Parameters:
item - The item that the Matcher has rejected.
description - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/HasProperty.html b/docs/javadoc/1.3/org/hamcrest/beans/HasProperty.html new file mode 100644 index 00000000..78503763 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/HasProperty.html @@ -0,0 +1,377 @@ + + + + + + +HasProperty (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.beans +
+Class HasProperty<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<T>
+          extended by org.hamcrest.beans.HasProperty<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class HasProperty<T>
extends TypeSafeMatcher<T>
+ + +

+A Matcher that checks that an object has a JavaBean property + with the specified name. If an error occurs during introspection + of the object then this is treated as a mismatch. +

+ +

+

+
Author:
+
Iain McGinniss, Nat Pryce, Steve Freeman
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
HasProperty(java.lang.String propertyName) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(T item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<T>
+
hasProperty(java.lang.String propertyName) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+ booleanmatchesSafely(T obj) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+HasProperty

+
+public HasProperty(java.lang.String propertyName)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(T obj)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<T>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(T item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<T>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+hasProperty

+
+public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. +

+ For example: +

assertThat(myBean, hasProperty("foo"))
+

+

+
Parameters:
propertyName - the name of the JavaBean property that examined beans should possess
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/HasPropertyWithValue.html b/docs/javadoc/1.3/org/hamcrest/beans/HasPropertyWithValue.html new file mode 100644 index 00000000..d98948cf --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/HasPropertyWithValue.html @@ -0,0 +1,397 @@ + + + + + + +HasPropertyWithValue (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.beans +
+Class HasPropertyWithValue<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.beans.HasPropertyWithValue<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class HasPropertyWithValue<T>
extends TypeSafeDiagnosingMatcher<T>
+ + +

+Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. This is useful for when objects + are created within code under test and passed to a mock object, and you wish + to assert that the created object has certain properties. +

+

Example Usage

+ Consider the situation where we have a class representing a person, which + follows the basic JavaBean convention of having get() and possibly set() + methods for it's properties: +
+ public class Person {
+   private String name;
+   public Person(String person) {
+     this.person = person;
+   }
+   public String getName() {
+     return name;
+   }
+ }
+ + And that these person objects are generated within a piece of code under test + (a class named PersonGenerator). This object is sent to one of our mock objects + which overrides the PersonGenerationListener interface: +
+ public interface PersonGenerationListener {
+   public void personGenerated(Person person);
+ }
+ + In order to check that the code under test generates a person with name + "Iain" we would do the following: +
+ Mock personGenListenerMock = mock(PersonGenerationListener.class);
+ personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain")));
+ PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy();
+ + If an exception is thrown by the getter method for a property, the property + does not exist, is not readable, or a reflection related exception is thrown + when trying to invoke it then this is treated as an evaluation failure and + the matches method will return false. +

+ This matcher class will also work with JavaBean objects that have explicit + bean descriptions via an associated BeanInfo description class. See the + JavaBeans specification for more information: +

+ http://java.sun.com/products/javabeans/docs/index.html +

+ +

+

+
Author:
+
Iain McGinniss, Nat Pryce, Steve Freeman
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
HasPropertyWithValue(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<T>
+
hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+ booleanmatchesSafely(T bean, + Description mismatch) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+HasPropertyWithValue

+
+public HasPropertyWithValue(java.lang.String propertyName,
+                            Matcher<?> valueMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(T bean,
+                             Description mismatch)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<T>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+hasProperty

+
+public static <T> Matcher<T> hasProperty(java.lang.String propertyName,
+                                         Matcher<?> valueMatcher)
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. +

+ For example: +

assertThat(myBean, hasProperty("foo", equalTo("bar"))
+

+

+
Parameters:
propertyName - the name of the JavaBean property that examined beans should possess
valueMatcher - a matcher for the value of the specified property of the examined bean
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/PropertyUtil.html b/docs/javadoc/1.3/org/hamcrest/beans/PropertyUtil.html new file mode 100644 index 00000000..f59fba1c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/PropertyUtil.html @@ -0,0 +1,338 @@ + + + + + + +PropertyUtil (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.beans +
+Class PropertyUtil

+
+java.lang.Object
+  extended by org.hamcrest.beans.PropertyUtil
+
+
+
+
public class PropertyUtil
extends java.lang.Object
+ + +

+Utility class for accessing properties on JavaBean objects. +

+ See http://java.sun.com/products/javabeans/docs/index.html for + more information on JavaBeans. +

+ +

+

+
Since:
+
1.1.0
+
Author:
+
Iain McGinniss, Steve Freeman
+
+
+ +

+ + + + + + + + + + + +
+Field Summary
+static java.lang.Object[]NO_ARGUMENTS + +
+           
+  + + + + + + + + + + +
+Constructor Summary
PropertyUtil() + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+static java.beans.PropertyDescriptorgetPropertyDescriptor(java.lang.String propertyName, + java.lang.Object fromObj) + +
+          Returns the description of the property with the provided + name on the provided object's interface.
+static java.beans.PropertyDescriptor[]propertyDescriptorsFor(java.lang.Object fromObj, + java.lang.Class<java.lang.Object> stopClass) + +
+          Returns all the property descriptors for the class associated with the given object
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+NO_ARGUMENTS

+
+public static final java.lang.Object[] NO_ARGUMENTS
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PropertyUtil

+
+public PropertyUtil()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getPropertyDescriptor

+
+public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName,
+                                                                  java.lang.Object fromObj)
+                                                           throws java.lang.IllegalArgumentException
+
+
Returns the description of the property with the provided + name on the provided object's interface. +

+

+ +
Returns:
the descriptor of the property, or null if the property does not exist. +
Throws: +
java.lang.IllegalArgumentException - if there's a introspection failure
+
+
+
+ +

+propertyDescriptorsFor

+
+public static java.beans.PropertyDescriptor[] propertyDescriptorsFor(java.lang.Object fromObj,
+                                                                     java.lang.Class<java.lang.Object> stopClass)
+                                                              throws java.lang.IllegalArgumentException
+
+
Returns all the property descriptors for the class associated with the given object +

+

+
Parameters:
fromObj - Use the class of this object
stopClass - Don't include any properties from this ancestor class upwards. +
Returns:
Property descriptors +
Throws: +
java.lang.IllegalArgumentException - if there's a introspection failure
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/SamePropertyValuesAs.PropertyMatcher.html b/docs/javadoc/1.3/org/hamcrest/beans/SamePropertyValuesAs.PropertyMatcher.html new file mode 100644 index 00000000..23163396 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/SamePropertyValuesAs.PropertyMatcher.html @@ -0,0 +1,309 @@ + + + + + + +SamePropertyValuesAs.PropertyMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.beans +
+Class SamePropertyValuesAs.PropertyMatcher

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.DiagnosingMatcher<java.lang.Object>
+          extended by org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Object>, SelfDescribing
+
+
+
Enclosing class:
SamePropertyValuesAs<T>
+
+
+
+
public static class SamePropertyValuesAs.PropertyMatcher
extends DiagnosingMatcher<java.lang.Object>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
SamePropertyValuesAs.PropertyMatcher(java.beans.PropertyDescriptor descriptor, + java.lang.Object expectedObject) + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatches(java.lang.Object actual, + Description mismatch) + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.DiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SamePropertyValuesAs.PropertyMatcher

+
+public SamePropertyValuesAs.PropertyMatcher(java.beans.PropertyDescriptor descriptor,
+                                            java.lang.Object expectedObject)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object actual,
+                       Description mismatch)
+
+
+
Specified by:
matches in class DiagnosingMatcher<java.lang.Object>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/SamePropertyValuesAs.html b/docs/javadoc/1.3/org/hamcrest/beans/SamePropertyValuesAs.html new file mode 100644 index 00000000..616aa082 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/SamePropertyValuesAs.html @@ -0,0 +1,360 @@ + + + + + + +SamePropertyValuesAs (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.beans +
+Class SamePropertyValuesAs<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.beans.SamePropertyValuesAs<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class SamePropertyValuesAs<T>
extends TypeSafeDiagnosingMatcher<T>
+ + +

+


+ +

+ + + + + + + + + + + +
+Nested Class Summary
+static classSamePropertyValuesAs.PropertyMatcher + +
+           
+  + + + + + + + + + + +
+Constructor Summary
SamePropertyValuesAs(T expectedBean) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatchesSafely(T bean, + Description mismatch) + +
+          Subclasses should implement this.
+static + + + + +
+<T> Matcher<T>
+
samePropertyValuesAs(T expectedBean) + +
+          Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SamePropertyValuesAs

+
+public SamePropertyValuesAs(T expectedBean)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(T bean,
+                             Description mismatch)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<T>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+samePropertyValuesAs

+
+public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)
+
+
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. +

+ For example: +

assertThat(myBean, samePropertyValuesAs(myExpectedBean))
+

+

+
Parameters:
expectedBean - the bean against which examined beans are compared
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/class-use/HasProperty.html b/docs/javadoc/1.3/org/hamcrest/beans/class-use/HasProperty.html new file mode 100644 index 00000000..0af2be89 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/class-use/HasProperty.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.beans.HasProperty (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.beans.HasProperty

+
+No usage of org.hamcrest.beans.HasProperty +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/class-use/HasPropertyWithValue.html b/docs/javadoc/1.3/org/hamcrest/beans/class-use/HasPropertyWithValue.html new file mode 100644 index 00000000..1e7b6283 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/class-use/HasPropertyWithValue.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.beans.HasPropertyWithValue (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.beans.HasPropertyWithValue

+
+No usage of org.hamcrest.beans.HasPropertyWithValue +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/class-use/PropertyUtil.html b/docs/javadoc/1.3/org/hamcrest/beans/class-use/PropertyUtil.html new file mode 100644 index 00000000..91aa2618 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/class-use/PropertyUtil.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.beans.PropertyUtil (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.beans.PropertyUtil

+
+No usage of org.hamcrest.beans.PropertyUtil +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/class-use/SamePropertyValuesAs.PropertyMatcher.html b/docs/javadoc/1.3/org/hamcrest/beans/class-use/SamePropertyValuesAs.PropertyMatcher.html new file mode 100644 index 00000000..d1dbe44f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/class-use/SamePropertyValuesAs.PropertyMatcher.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher

+
+No usage of org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/class-use/SamePropertyValuesAs.html b/docs/javadoc/1.3/org/hamcrest/beans/class-use/SamePropertyValuesAs.html new file mode 100644 index 00000000..7e7024f4 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/class-use/SamePropertyValuesAs.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.beans.SamePropertyValuesAs (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.beans.SamePropertyValuesAs

+
+No usage of org.hamcrest.beans.SamePropertyValuesAs +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/package-frame.html b/docs/javadoc/1.3/org/hamcrest/beans/package-frame.html new file mode 100644 index 00000000..46a7f301 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/package-frame.html @@ -0,0 +1,40 @@ + + + + + + +org.hamcrest.beans (Hamcrest) + + + + + + + + + + + +org.hamcrest.beans + + + + +
+Classes  + +
+HasProperty +
+HasPropertyWithValue +
+PropertyUtil +
+SamePropertyValuesAs +
+SamePropertyValuesAs.PropertyMatcher
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/package-summary.html b/docs/javadoc/1.3/org/hamcrest/beans/package-summary.html new file mode 100644 index 00000000..acee4529 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/package-summary.html @@ -0,0 +1,190 @@ + + + + + + +org.hamcrest.beans (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.beans +

+Matchers of Java Bean properties and their values. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
HasProperty<T>A Matcher that checks that an object has a JavaBean property + with the specified name.
HasPropertyWithValue<T>Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
PropertyUtilUtility class for accessing properties on JavaBean objects.
SamePropertyValuesAs<T> 
SamePropertyValuesAs.PropertyMatcher 
+  + +

+

+Package org.hamcrest.beans Description +

+ +

+

Matchers of Java Bean properties and their values.

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/package-tree.html b/docs/javadoc/1.3/org/hamcrest/beans/package-tree.html new file mode 100644 index 00000000..b8cc4926 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/package-tree.html @@ -0,0 +1,162 @@ + + + + + + +org.hamcrest.beans Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.beans +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/beans/package-use.html b/docs/javadoc/1.3/org/hamcrest/beans/package-use.html new file mode 100644 index 00000000..31c98554 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/beans/package-use.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Package org.hamcrest.beans (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.beans

+
+No usage of org.hamcrest.beans +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/BaseDescription.html b/docs/javadoc/1.3/org/hamcrest/class-use/BaseDescription.html new file mode 100644 index 00000000..1d5ebded --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/BaseDescription.html @@ -0,0 +1,180 @@ + + + + + + +Uses of Class org.hamcrest.BaseDescription (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.BaseDescription

+
+ + + + + + + + + +
+Packages that use BaseDescription
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
+  +

+ + + + + +
+Uses of BaseDescription in org.hamcrest
+  +

+ + + + + + + + + +
Subclasses of BaseDescription in org.hamcrest
+ classStringDescription + +
+          A Description that is stored as a string.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/BaseMatcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/BaseMatcher.html new file mode 100644 index 00000000..b1a92bad --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/BaseMatcher.html @@ -0,0 +1,733 @@ + + + + + + +Uses of Class org.hamcrest.BaseMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.BaseMatcher

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use BaseMatcher
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.numberMatchers that perform numeric comparisons. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.textMatchers that perform text comparisons. 
org.hamcrest.xmlMatchers of XML documents. 
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest
+ classCustomMatcher<T> + +
+          Utility class for writing one off matchers.
+ classCustomTypeSafeMatcher<T> + +
+          Utility class for writing one off matchers.
+ classDiagnosingMatcher<T> + +
+          TODO(ngd): Document.
+ classFeatureMatcher<T,U> + +
+          Supporting class for matching a feature of an object.
+ classTypeSafeDiagnosingMatcher<T> + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
+ classTypeSafeMatcher<T> + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest.beans
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest.beans
+ classHasProperty<T> + +
+          A Matcher that checks that an object has a JavaBean property + with the specified name.
+ classHasPropertyWithValue<T> + +
+          Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
+ classSamePropertyValuesAs<T> + +
+           
+static classSamePropertyValuesAs.PropertyMatcher + +
+           
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest.collection
+ classIsArray<T> + +
+          Matcher for array whose elements satisfy a sequence of matchers.
+ classIsArrayContaining<T> + +
+          Matches if an array contains an item satisfying a nested matcher.
+ classIsArrayContainingInAnyOrder<E> + +
+           
+ classIsArrayContainingInOrder<E> + +
+           
+ classIsArrayWithSize<E> + +
+          Matches if array size satisfies a nested matcher.
+ classIsCollectionWithSize<E> + +
+          Matches if collection size satisfies a nested matcher.
+ classIsEmptyCollection<E> + +
+          Tests if collection is empty.
+ classIsEmptyIterable<E> + +
+          Tests if collection is empty.
+ classIsIn<T> + +
+           
+ classIsIterableContainingInAnyOrder<T> + +
+           
+ classIsIterableContainingInOrder<E> + +
+           
+ classIsIterableWithSize<E> + +
+           
+ classIsMapContaining<K,V> + +
+           
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest.core
+ classAllOf<T> + +
+          Calculates the logical conjunction of multiple matchers.
+ classAnyOf<T> + +
+          Calculates the logical disjunction of multiple matchers.
+ classCombinableMatcher<T> + +
+           
+ classDescribedAs<T> + +
+          Provides a custom description to another matcher.
+ classEvery<T> + +
+           
+ classIs<T> + +
+          Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
+ classIsAnything<T> + +
+          A matcher that always returns true.
+ classIsCollectionContaining<T> + +
+           
+ classIsEqual<T> + +
+          Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
+ classIsInstanceOf + +
+          Tests whether the value is an instance of a class.
+ classIsNot<T> + +
+          Calculates the logical negation of a matcher.
+ classIsNull<T> + +
+          Is the value null?
+ classIsSame<T> + +
+          Is the value the same object as another value?
+ classStringContains + +
+          Tests if the argument is a string that contains a substring.
+ classStringEndsWith + +
+          Tests if the argument is a string that contains a substring.
+ classStringStartsWith + +
+          Tests if the argument is a string that contains a substring.
+ classSubstringMatcher + +
+           
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest.number
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest.number
+ classBigDecimalCloseTo + +
+           
+ classIsCloseTo + +
+          Is the value a number equal to a value within some range of + acceptable error?
+ classOrderingComparison<T extends Comparable<T>> + +
+           
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest.object
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest.object
+ classHasToString<T> + +
+           
+ classIsCompatibleType<T> + +
+           
+ classIsEventFrom + +
+          Tests if the value is an event announced by a specific object.
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest.text
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest.text
+ classIsEmptyString + +
+          Matches empty Strings (and null).
+ classIsEqualIgnoringCase + +
+          Tests if a string is equal to another string, regardless of the case.
+ classIsEqualIgnoringWhiteSpace + +
+          Tests if a string is equal to another string, ignoring any changes in whitespace.
+ classStringContainsInOrder + +
+           
+  +

+ + + + + +
+Uses of BaseMatcher in org.hamcrest.xml
+  +

+ + + + + + + + + +
Subclasses of BaseMatcher in org.hamcrest.xml
+ classHasXPath + +
+          Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/Condition.Step.html b/docs/javadoc/1.3/org/hamcrest/class-use/Condition.Step.html new file mode 100644 index 00000000..ae10e7b0 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/Condition.Step.html @@ -0,0 +1,202 @@ + + + + + + +Uses of Interface org.hamcrest.Condition.Step (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
org.hamcrest.Condition.Step

+
+ + + + + + + + + +
+Packages that use Condition.Step
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
+  +

+ + + + + +
+Uses of Condition.Step in org.hamcrest
+  +

+ + + + + + + + + + + + + +
Methods in org.hamcrest with parameters of type Condition.Step
+abstract + + + + +
+<U> Condition<U>
+
Condition.and(Condition.Step<? super T,U> mapping) + +
+           
+ + + + + +
+<U> Condition<U>
+
Condition.then(Condition.Step<? super T,U> mapping) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/Condition.html b/docs/javadoc/1.3/org/hamcrest/class-use/Condition.html new file mode 100644 index 00000000..9b35546c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/Condition.html @@ -0,0 +1,242 @@ + + + + + + +Uses of Class org.hamcrest.Condition (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.Condition

+
+ + + + + + + + + +
+Packages that use Condition
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
+  +

+ + + + + +
+Uses of Condition in org.hamcrest
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest that return Condition
+abstract + + + + +
+<U> Condition<U>
+
Condition.and(Condition.Step<? super T,U> mapping) + +
+           
+ Condition<O>Condition.Step.apply(I value, + Description mismatch) + +
+           
+static + + + + +
+<T> Condition<T>
+
Condition.matched(T theValue, + Description mismatch) + +
+           
+static + + + + +
+<T> Condition<T>
+
Condition.notMatched() + +
+           
+ + + + + +
+<U> Condition<U>
+
Condition.then(Condition.Step<? super T,U> mapping) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/CoreMatchers.html b/docs/javadoc/1.3/org/hamcrest/class-use/CoreMatchers.html new file mode 100644 index 00000000..4c3d84f9 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/CoreMatchers.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.CoreMatchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.CoreMatchers

+
+No usage of org.hamcrest.CoreMatchers +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/CustomMatcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/CustomMatcher.html new file mode 100644 index 00000000..905c7cb4 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/CustomMatcher.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.CustomMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.CustomMatcher

+
+No usage of org.hamcrest.CustomMatcher +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/CustomTypeSafeMatcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/CustomTypeSafeMatcher.html new file mode 100644 index 00000000..a854d9b5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/CustomTypeSafeMatcher.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.CustomTypeSafeMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.CustomTypeSafeMatcher

+
+No usage of org.hamcrest.CustomTypeSafeMatcher +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/Description.NullDescription.html b/docs/javadoc/1.3/org/hamcrest/class-use/Description.NullDescription.html new file mode 100644 index 00000000..b67d1deb --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/Description.NullDescription.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.Description.NullDescription (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.Description.NullDescription

+
+No usage of org.hamcrest.Description.NullDescription +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/Description.html b/docs/javadoc/1.3/org/hamcrest/class-use/Description.html new file mode 100644 index 00000000..c405c28a --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/Description.html @@ -0,0 +1,1330 @@ + + + + + + +Uses of Interface org.hamcrest.Description (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
org.hamcrest.Description

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use Description
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.internal  
org.hamcrest.numberMatchers that perform numeric comparisons. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.textMatchers that perform text comparisons. 
org.hamcrest.xmlMatchers of XML documents. 
+  +

+ + + + + +
+Uses of Description in org.hamcrest
+  +

+ + + + + + + + + + + + + + + + + +
Classes in org.hamcrest that implement Description
+ classBaseDescription + +
+          A Description that is stored as a string.
+static classDescription.NullDescription + +
+           
+ classStringDescription + +
+          A Description that is stored as a string.
+  +

+ + + + + + + + + +
Fields in org.hamcrest declared as Description
+static DescriptionDescription.NONE + +
+          A description that consumes input but does nothing.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest that return Description
+ DescriptionDescription.appendDescriptionOf(SelfDescribing value) + +
+          Appends the description of a SelfDescribing value to this description.
+ DescriptionDescription.NullDescription.appendDescriptionOf(SelfDescribing value) + +
+           
+ DescriptionBaseDescription.appendDescriptionOf(SelfDescribing value) + +
+           
+ DescriptionDescription.appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+          Appends a list of SelfDescribing objects + to the description.
+ DescriptionDescription.NullDescription.appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+           
+ DescriptionBaseDescription.appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+           
+ DescriptionDescription.appendText(java.lang.String text) + +
+          Appends some plain text to the description.
+ DescriptionDescription.NullDescription.appendText(java.lang.String text) + +
+           
+ DescriptionBaseDescription.appendText(java.lang.String text) + +
+           
+ DescriptionDescription.appendValue(java.lang.Object value) + +
+          Appends an arbitary value to the description.
+ DescriptionDescription.NullDescription.appendValue(java.lang.Object value) + +
+           
+ DescriptionBaseDescription.appendValue(java.lang.Object value) + +
+           
+ + + + + +
+<T> Description
+
Description.appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) + +
+          Appends a list of values to the description.
+ + + + + +
+<T> Description
+
Description.NullDescription.appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) + +
+           
+ + + + + +
+<T> Description
+
BaseDescription.appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) + +
+           
+ + + + + +
+<T> Description
+
Description.appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) + +
+          Appends a list of values to the description.
+ + + + + +
+<T> Description
+
Description.NullDescription.appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) + +
+           
+ + + + + +
+<T> Description
+
BaseDescription.appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest with parameters of type Description
+ Condition<O>Condition.Step.apply(I value, + Description mismatch) + +
+           
+ voidTypeSafeMatcher.describeMismatch(java.lang.Object item, + Description description) + +
+           
+ voidTypeSafeDiagnosingMatcher.describeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+           
+ voidMatcher.describeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+          Generate a description of why the matcher has not accepted the item.
+ voidDiagnosingMatcher.describeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+           
+ voidBaseMatcher.describeMismatch(java.lang.Object item, + Description description) + +
+           
+protected  voidTypeSafeMatcher.describeMismatchSafely(T item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voidSelfDescribing.describeTo(Description description) + +
+          Generates a description of the object.
+ voidFeatureMatcher.describeTo(Description description) + +
+           
+ voidCustomTypeSafeMatcher.describeTo(Description description) + +
+           
+ voidCustomMatcher.describeTo(Description description) + +
+           
+static + + + + +
+<T> Condition<T>
+
Condition.matched(T theValue, + Description mismatch) + +
+           
+protected abstract  booleanDiagnosingMatcher.matches(java.lang.Object item, + Description mismatchDescription) + +
+           
+protected abstract  booleanTypeSafeDiagnosingMatcher.matchesSafely(T item, + Description mismatchDescription) + +
+          Subclasses should implement this.
+protected  booleanFeatureMatcher.matchesSafely(T actual, + Description mismatch) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.beans
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.beans with parameters of type Description
+ voidHasProperty.describeMismatchSafely(T item, + Description mismatchDescription) + +
+           
+ voidSamePropertyValuesAs.describeTo(Description description) + +
+           
+ voidSamePropertyValuesAs.PropertyMatcher.describeTo(Description description) + +
+           
+ voidHasPropertyWithValue.describeTo(Description description) + +
+           
+ voidHasProperty.describeTo(Description description) + +
+           
+ booleanSamePropertyValuesAs.PropertyMatcher.matches(java.lang.Object actual, + Description mismatch) + +
+           
+ booleanSamePropertyValuesAs.matchesSafely(T bean, + Description mismatch) + +
+           
+ booleanHasPropertyWithValue.matchesSafely(T bean, + Description mismatch) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.collection with parameters of type Description
+ voidIsEmptyCollection.describeMismatchSafely(java.util.Collection<? extends E> item, + Description mismatchDescription) + +
+           
+ voidIsArrayContainingInOrder.describeMismatchSafely(E[] item, + Description mismatchDescription) + +
+           
+ voidIsArrayContainingInAnyOrder.describeMismatchSafely(E[] item, + Description mismatchDescription) + +
+           
+ voidIsEmptyIterable.describeMismatchSafely(java.lang.Iterable<? extends E> iter, + Description mismatchDescription) + +
+           
+ voidIsMapContaining.describeMismatchSafely(java.util.Map<? extends K,? extends V> map, + Description mismatchDescription) + +
+           
+ voidIsArrayContaining.describeMismatchSafely(T[] item, + Description mismatchDescription) + +
+           
+ voidIsArray.describeMismatchSafely(T[] actual, + Description mismatchDescription) + +
+           
+ voidIsMapContaining.describeTo(Description description) + +
+           
+ voidIsIterableContainingInOrder.describeTo(Description description) + +
+           
+ voidIsIterableContainingInAnyOrder.describeTo(Description description) + +
+           
+ voidIsIn.describeTo(Description buffer) + +
+           
+ voidIsEmptyIterable.describeTo(Description description) + +
+           
+ voidIsEmptyCollection.describeTo(Description description) + +
+           
+ voidIsArrayContainingInOrder.describeTo(Description description) + +
+           
+ voidIsArrayContainingInAnyOrder.describeTo(Description description) + +
+           
+ voidIsArrayContaining.describeTo(Description description) + +
+           
+ voidIsArray.describeTo(Description description) + +
+           
+protected  booleanIsIterableContainingInOrder.matchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription) + +
+           
+protected  booleanIsIterableContainingInAnyOrder.matchesSafely(java.lang.Iterable<? extends T> items, + Description mismatchDescription) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.core with parameters of type Description
+ voidIs.describeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+           
+ voidDescribedAs.describeMismatch(java.lang.Object item, + Description description) + +
+           
+ voidSubstringMatcher.describeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+           
+ voidSubstringMatcher.describeTo(Description description) + +
+           
+ voidIsSame.describeTo(Description description) + +
+           
+ voidIsNull.describeTo(Description description) + +
+           
+ voidIsNot.describeTo(Description description) + +
+           
+ voidIsInstanceOf.describeTo(Description description) + +
+           
+ voidIsEqual.describeTo(Description description) + +
+           
+ voidIsCollectionContaining.describeTo(Description description) + +
+           
+ voidIsAnything.describeTo(Description description) + +
+           
+ voidIs.describeTo(Description description) + +
+           
+ voidEvery.describeTo(Description description) + +
+           
+ voidDescribedAs.describeTo(Description description) + +
+           
+ voidCombinableMatcher.describeTo(Description description) + +
+           
+ voidAnyOf.describeTo(Description description) + +
+           
+ voidAllOf.describeTo(Description description) + +
+           
+protected  booleanIsInstanceOf.matches(java.lang.Object item, + Description mismatch) + +
+           
+ booleanAllOf.matches(java.lang.Object o, + Description mismatch) + +
+           
+protected  booleanIsCollectionContaining.matchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription) + +
+           
+ booleanEvery.matchesSafely(java.lang.Iterable<T> collection, + Description mismatchDescription) + +
+           
+protected  booleanCombinableMatcher.matchesSafely(T item, + Description mismatch) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.internal
+  +

+ + + + + + + + + +
Methods in org.hamcrest.internal with parameters of type Description
+ voidSelfDescribingValue.describeTo(Description description) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.number
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.number with parameters of type Description
+ voidBigDecimalCloseTo.describeMismatchSafely(java.math.BigDecimal item, + Description mismatchDescription) + +
+           
+ voidIsCloseTo.describeMismatchSafely(java.lang.Double item, + Description mismatchDescription) + +
+           
+ voidOrderingComparison.describeMismatchSafely(T actual, + Description mismatchDescription) + +
+           
+ voidOrderingComparison.describeTo(Description description) + +
+           
+ voidIsCloseTo.describeTo(Description description) + +
+           
+ voidBigDecimalCloseTo.describeTo(Description description) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.object
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.object with parameters of type Description
+ voidIsCompatibleType.describeMismatchSafely(java.lang.Class<?> cls, + Description mismatchDescription) + +
+           
+ voidIsEventFrom.describeTo(Description description) + +
+           
+ voidIsCompatibleType.describeTo(Description description) + +
+           
+ booleanIsEventFrom.matchesSafely(java.util.EventObject item, + Description mismatchDescription) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.text
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.text with parameters of type Description
+ voidStringContainsInOrder.describeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+           
+ voidIsEqualIgnoringWhiteSpace.describeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+           
+ voidIsEqualIgnoringCase.describeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+           
+ voidStringContainsInOrder.describeTo(Description description) + +
+           
+ voidIsEqualIgnoringWhiteSpace.describeTo(Description description) + +
+           
+ voidIsEqualIgnoringCase.describeTo(Description description) + +
+           
+ voidIsEmptyString.describeTo(Description description) + +
+           
+  +

+ + + + + +
+Uses of Description in org.hamcrest.xml
+  +

+ + + + + + + + + + + + + +
Methods in org.hamcrest.xml with parameters of type Description
+ voidHasXPath.describeTo(Description description) + +
+           
+ booleanHasXPath.matchesSafely(org.w3c.dom.Node item, + Description mismatch) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/DiagnosingMatcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/DiagnosingMatcher.html new file mode 100644 index 00000000..d14aa9d5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/DiagnosingMatcher.html @@ -0,0 +1,217 @@ + + + + + + +Uses of Class org.hamcrest.DiagnosingMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.DiagnosingMatcher

+
+ + + + + + + + + + + + + +
+Packages that use DiagnosingMatcher
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
+  +

+ + + + + +
+Uses of DiagnosingMatcher in org.hamcrest.beans
+  +

+ + + + + + + + + +
Subclasses of DiagnosingMatcher in org.hamcrest.beans
+static classSamePropertyValuesAs.PropertyMatcher + +
+           
+  +

+ + + + + +
+Uses of DiagnosingMatcher in org.hamcrest.core
+  +

+ + + + + + + + + + + + + +
Subclasses of DiagnosingMatcher in org.hamcrest.core
+ classAllOf<T> + +
+          Calculates the logical conjunction of multiple matchers.
+ classIsInstanceOf + +
+          Tests whether the value is an instance of a class.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/EasyMock2Matchers.html b/docs/javadoc/1.3/org/hamcrest/class-use/EasyMock2Matchers.html new file mode 100644 index 00000000..fe5291de --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/EasyMock2Matchers.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.EasyMock2Matchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.EasyMock2Matchers

+
+No usage of org.hamcrest.EasyMock2Matchers +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/Factory.html b/docs/javadoc/1.3/org/hamcrest/class-use/Factory.html new file mode 100644 index 00000000..6a6b0002 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/Factory.html @@ -0,0 +1,1851 @@ + + + + + + +Uses of Class org.hamcrest.Factory (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.Factory

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use Factory
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.numberMatchers that perform numeric comparisons. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.textMatchers that perform text comparisons. 
org.hamcrest.xmlMatchers of XML documents. 
+  +

+ + + + + +
+Uses of Factory in org.hamcrest.beans
+  +

+ + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.beans with annotations of type Factory
+static + + + + +
+<T> Matcher<T>
+
HasProperty.hasProperty(java.lang.String propertyName) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+static + + + + +
+<T> Matcher<T>
+
HasPropertyWithValue.hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
SamePropertyValuesAs.samePropertyValuesAs(T expectedBean) + +
+          Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+  +

+ + + + + +
+Uses of Factory in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.collection with annotations of type Factory
+static + + + + +
+<T> IsArray<T>
+
IsArray.array(Matcher<? super T>... elementMatchers) + +
+          Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(E... items) + +
+          Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(java.util.List<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(E... items) + +
+          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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayWithSize.arrayWithSize(int size) + +
+          Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayWithSize.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(E... items) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(java.util.List<Matcher<? super E>> itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super E> itemMatcher) + +
+          Deprecated. use contains(Matcher itemMatcher) instead
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(T... items) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
IsEmptyCollection.empty() + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayWithSize.emptyArray() + +
+          Creates a matcher for arrays that matches when the length of the array + is zero.
+static + + + + +
+<E> Matcher<java.util.Collection<E>>
+
IsEmptyCollection.emptyCollectionOf(java.lang.Class<E> type) + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsEmptyIterable.emptyIterable() + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
IsEmptyIterable.emptyIterableOf(java.lang.Class<E> type) + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
IsMapContaining.hasEntry(K key, + V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
IsMapContaining.hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
IsArrayContaining.hasItemInArray(Matcher<? super T> elementMatcher) + +
+          Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
IsArrayContaining.hasItemInArray(T element) + +
+          A shortcut to the frequently used hasItemInArray(equalTo(x)).
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
IsMapContaining.hasKey(K key) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
IsMapContaining.hasKey(Matcher<? super K> keyMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
IsCollectionWithSize.hasSize(int size) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
IsCollectionWithSize.hasSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
IsMapContaining.hasValue(Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
IsMapContaining.hasValue(V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+static + + + + +
+<T> Matcher<T>
+
IsIn.isIn(java.util.Collection<T> collection) + +
+          Creates a matcher that matches when the examined object is found within the + specified collection.
+static + + + + +
+<T> Matcher<T>
+
IsIn.isIn(T[] elements) + +
+          Creates a matcher that matches when the examined object is found within the + specified array.
+static + + + + +
+<T> Matcher<T>
+
IsIn.isOneOf(T... elements) + +
+          Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
IsIterableWithSize.iterableWithSize(int size) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
IsIterableWithSize.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+  +

+ + + + + +
+Uses of Factory in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.core with annotations of type Factory
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
IsInstanceOf.any(java.lang.Class<T> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static Matcher<java.lang.Object>IsAnything.anything() + +
+          Creates a matcher that always matches, regardless of the examined object.
+static Matcher<java.lang.Object>IsAnything.anything(java.lang.String description) + +
+          Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
CombinableMatcher.both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+static Matcher<java.lang.String>StringContains.containsString(java.lang.String substring) + +
+          Creates a matcher that matches if the examined String contains the specified + String anywhere.
+static + + + + +
+<T> Matcher<T>
+
DescribedAs.describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
CombinableMatcher.either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+static Matcher<java.lang.String>StringEndsWith.endsWith(java.lang.String suffix) + +
+          Creates a matcher that matches if the examined String ends with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
IsEqual.equalTo(T operand) + +
+          Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
Every.everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
IsCollectionContaining.hasItem(T item) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
IsCollectionContaining.hasItems(T... items) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+static + + + + +
+<T> Matcher<T>
+
IsInstanceOf.instanceOf(java.lang.Class<?> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> Matcher<T>
+
Is.is(java.lang.Class<T> type) + +
+          Deprecated. use isA(Class type) instead.
+static + + + + +
+<T> Matcher<T>
+
Is.is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
Is.is(T value) + +
+          A shortcut to the frequently used is(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
Is.isA(java.lang.Class<T> type) + +
+          A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+static + + + + +
+<T> Matcher<T>
+
IsNot.not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
IsNot.not(T value) + +
+          A shortcut to the frequently used not(equalTo(x)).
+static Matcher<java.lang.Object>IsNull.notNullValue() + +
+          A shortcut to the frequently used not(nullValue()).
+static + + + + +
+<T> Matcher<T>
+
IsNull.notNullValue(java.lang.Class<T> type) + +
+          A shortcut to the frequently used not(nullValue(X.class)).
+static Matcher<java.lang.Object>IsNull.nullValue() + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
IsNull.nullValue(java.lang.Class<T> type) + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
IsSame.sameInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static Matcher<java.lang.String>StringStartsWith.startsWith(java.lang.String prefix) + +
+          Creates a matcher that matches if the examined String starts with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
IsSame.theInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+  +

+ + + + + +
+Uses of Factory in org.hamcrest.number
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.number with annotations of type Factory
+static Matcher<java.math.BigDecimal>BigDecimalCloseTo.closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error) + +
+          Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+static Matcher<java.lang.Double>IsCloseTo.closeTo(double operand, + double error) + +
+          Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.comparesEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.greaterThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.greaterThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.lessThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.lessThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+  +

+ + + + + +
+Uses of Factory in org.hamcrest.object
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.object with annotations of type Factory
+static Matcher<java.util.EventObject>IsEventFrom.eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+static Matcher<java.util.EventObject>IsEventFrom.eventFrom(java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any EventObject + announced by source.
+static + + + + +
+<T> Matcher<T>
+
HasToString.hasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
HasToString.hasToString(java.lang.String expectedToString) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+static + + + + +
+<T> Matcher<java.lang.Class<?>>
+
IsCompatibleType.typeCompatibleWith(java.lang.Class<T> baseType) + +
+          Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+  +

+ + + + + +
+Uses of Factory in org.hamcrest.text
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.text with annotations of type Factory
+static Matcher<java.lang.String>IsEqualIgnoringCase.equalToIgnoringCase(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+static Matcher<java.lang.String>IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+static Matcher<java.lang.String>IsEmptyString.isEmptyOrNullString() + +
+          Creates a matcher of String that matches when the examined string is null, or + has zero length.
+static Matcher<java.lang.String>IsEmptyString.isEmptyString() + +
+          Creates a matcher of String that matches when the examined string has zero length.
+static Matcher<java.lang.String>StringContainsInOrder.stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) + +
+          Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance.
+  +

+ + + + + +
+Uses of Factory in org.hamcrest.xml
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.xml with annotations of type Factory
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/FeatureMatcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/FeatureMatcher.html new file mode 100644 index 00000000..0dd3606a --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/FeatureMatcher.html @@ -0,0 +1,225 @@ + + + + + + +Uses of Class org.hamcrest.FeatureMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.FeatureMatcher

+
+ + + + + + + + + + + + + +
+Packages that use FeatureMatcher
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.objectMatchers that inspect objects and classes. 
+  +

+ + + + + +
+Uses of FeatureMatcher in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of FeatureMatcher in org.hamcrest.collection
+ classIsArrayWithSize<E> + +
+          Matches if array size satisfies a nested matcher.
+ classIsCollectionWithSize<E> + +
+          Matches if collection size satisfies a nested matcher.
+ classIsIterableWithSize<E> + +
+           
+  +

+ + + + + +
+Uses of FeatureMatcher in org.hamcrest.object
+  +

+ + + + + + + + + +
Subclasses of FeatureMatcher in org.hamcrest.object
+ classHasToString<T> + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/JMock1Matchers.html b/docs/javadoc/1.3/org/hamcrest/class-use/JMock1Matchers.html new file mode 100644 index 00000000..6a97465d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/JMock1Matchers.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.JMock1Matchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.JMock1Matchers

+
+No usage of org.hamcrest.JMock1Matchers +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/JavaLangMatcherAssert.html b/docs/javadoc/1.3/org/hamcrest/class-use/JavaLangMatcherAssert.html new file mode 100644 index 00000000..e7a91317 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/JavaLangMatcherAssert.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.JavaLangMatcherAssert (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.JavaLangMatcherAssert

+
+No usage of org.hamcrest.JavaLangMatcherAssert +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/Matcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/Matcher.html new file mode 100644 index 00000000..d5012c30 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/Matcher.html @@ -0,0 +1,8051 @@ + + + + + + +Uses of Interface org.hamcrest.Matcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
org.hamcrest.Matcher

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use Matcher
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.integration  
org.hamcrest.numberMatchers that perform numeric comparisons. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.textMatchers that perform text comparisons. 
org.hamcrest.xmlMatchers of XML documents. 
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest that implement Matcher
+ classBaseMatcher<T> + +
+          BaseClass for all Matcher implementations.
+ classCustomMatcher<T> + +
+          Utility class for writing one off matchers.
+ classCustomTypeSafeMatcher<T> + +
+          Utility class for writing one off matchers.
+ classDiagnosingMatcher<T> + +
+          TODO(ngd): Document.
+ classFeatureMatcher<T,U> + +
+          Supporting class for matching a feature of an object.
+ classTypeSafeDiagnosingMatcher<T> + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
+ classTypeSafeMatcher<T> + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest that return Matcher
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.any(java.lang.Class<T> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.any(java.lang.Class<T> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static Matcher<java.lang.Object>Matchers.anything() + +
+          Creates a matcher that always matches, regardless of the examined object.
+static Matcher<java.lang.Object>CoreMatchers.anything() + +
+          Creates a matcher that always matches, regardless of the examined object.
+static Matcher<java.lang.Object>Matchers.anything(java.lang.String description) + +
+          Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+static Matcher<java.lang.Object>CoreMatchers.anything(java.lang.String description) + +
+          Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContaining(E... items) + +
+          Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContaining(java.util.List<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContaining(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContainingInAnyOrder(E... items) + +
+          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.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContainingInAnyOrder(Matcher<? super E>... 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.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayWithSize(int size) + +
+          Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+static Matcher<java.math.BigDecimal>Matchers.closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error) + +
+          Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+static Matcher<java.lang.Double>Matchers.closeTo(double operand, + double error) + +
+          Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
Matchers.comparesEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.contains(E... items) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.contains(java.util.List<Matcher<? super E>> itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.contains(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.contains(Matcher<? super E> itemMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
Matchers.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.containsInAnyOrder(Matcher<? super E> itemMatcher) + +
+          Deprecated. use contains(Matcher itemMatcher) instead
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
Matchers.containsInAnyOrder(T... items) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+static Matcher<java.lang.String>Matchers.containsString(java.lang.String substring) + +
+          Creates a matcher that matches if the examined String contains the specified + String anywhere.
+static Matcher<java.lang.String>CoreMatchers.containsString(java.lang.String substring) + +
+          Creates a matcher that matches if the examined String contains the specified + String anywhere.
+static + + + + +
+<T> Matcher<T>
+
Matchers.describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
Matchers.empty() + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.emptyArray() + +
+          Creates a matcher for arrays that matches when the length of the array + is zero.
+static + + + + +
+<E> Matcher<java.util.Collection<E>>
+
Matchers.emptyCollectionOf(java.lang.Class<E> type) + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.emptyIterable() + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
Matchers.emptyIterableOf(java.lang.Class<E> type) + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static Matcher<java.lang.String>Matchers.endsWith(java.lang.String suffix) + +
+          Creates a matcher that matches if the examined String ends with the specified + String.
+static Matcher<java.lang.String>CoreMatchers.endsWith(java.lang.String suffix) + +
+          Creates a matcher that matches if the examined String ends with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
Matchers.equalTo(T operand) + +
+          Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.equalTo(T operand) + +
+          Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+static Matcher<java.lang.String>Matchers.equalToIgnoringCase(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+static Matcher<java.lang.String>Matchers.equalToIgnoringWhiteSpace(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+static Matcher<java.util.EventObject>Matchers.eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+static Matcher<java.util.EventObject>Matchers.eventFrom(java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any EventObject + announced by source.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
Matchers.everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
CoreMatchers.everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
Matchers.greaterThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
Matchers.greaterThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
Matchers.hasEntry(K key, + V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
Matchers.hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
Matchers.hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
CoreMatchers.hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
Matchers.hasItem(T item) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
CoreMatchers.hasItem(T item) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+static + + + + +
+<T> Matcher<T[]>
+
Matchers.hasItemInArray(Matcher<? super T> elementMatcher) + +
+          Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
Matchers.hasItemInArray(T element) + +
+          A shortcut to the frequently used hasItemInArray(equalTo(x)).
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
Matchers.hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
CoreMatchers.hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
Matchers.hasItems(T... items) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
CoreMatchers.hasItems(T... items) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
Matchers.hasKey(K key) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
Matchers.hasKey(Matcher<? super K> keyMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
Matchers.hasProperty(java.lang.String propertyName) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+static + + + + +
+<T> Matcher<T>
+
Matchers.hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
Matchers.hasSize(int size) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
Matchers.hasSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
Matchers.hasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
Matchers.hasToString(java.lang.String expectedToString) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
Matchers.hasValue(Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
Matchers.hasValue(V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+static Matcher<org.w3c.dom.Node>Matchers.hasXPath(java.lang.String xPath) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+static Matcher<org.w3c.dom.Node>Matchers.hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>Matchers.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+static Matcher<org.w3c.dom.Node>Matchers.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+static + + + + +
+<T> Matcher<T>
+
Matchers.instanceOf(java.lang.Class<?> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.instanceOf(java.lang.Class<?> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> Matcher<T>
+
Matchers.is(java.lang.Class<T> type) + +
+          Deprecated. use isA(Class type) instead.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.is(java.lang.Class<T> type) + +
+          Deprecated. use isA(Class type) instead.
+static + + + + +
+<T> Matcher<T>
+
Matchers.is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
Matchers.is(T value) + +
+          A shortcut to the frequently used is(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.is(T value) + +
+          A shortcut to the frequently used is(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
Matchers.isA(java.lang.Class<T> type) + +
+          A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.isA(java.lang.Class<T> type) + +
+          A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+static Matcher<java.lang.String>Matchers.isEmptyOrNullString() + +
+          Creates a matcher of String that matches when the examined string is null, or + has zero length.
+static Matcher<java.lang.String>Matchers.isEmptyString() + +
+          Creates a matcher of String that matches when the examined string has zero length.
+static + + + + +
+<T> Matcher<T>
+
Matchers.isIn(java.util.Collection<T> collection) + +
+          Creates a matcher that matches when the examined object is found within the + specified collection.
+static + + + + +
+<T> Matcher<T>
+
Matchers.isIn(T[] param1) + +
+           
+static + + + + +
+<T> Matcher<T>
+
Matchers.isOneOf(T... elements) + +
+          Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
Matchers.iterableWithSize(int size) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
Matchers.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
Matchers.lessThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
Matchers.lessThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+static + + + + +
+<T> Matcher<T>
+
Matchers.not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
Matchers.not(T value) + +
+          A shortcut to the frequently used not(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.not(T value) + +
+          A shortcut to the frequently used not(equalTo(x)).
+static Matcher<java.lang.Object>Matchers.notNullValue() + +
+          A shortcut to the frequently used not(nullValue()).
+static Matcher<java.lang.Object>CoreMatchers.notNullValue() + +
+          A shortcut to the frequently used not(nullValue()).
+static + + + + +
+<T> Matcher<T>
+
Matchers.notNullValue(java.lang.Class<T> type) + +
+          A shortcut to the frequently used not(nullValue(X.class)).
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.notNullValue(java.lang.Class<T> type) + +
+          A shortcut to the frequently used not(nullValue(X.class)).
+static Matcher<java.lang.Object>Matchers.nullValue() + +
+          Creates a matcher that matches if examined object is null.
+static Matcher<java.lang.Object>CoreMatchers.nullValue() + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
Matchers.nullValue(java.lang.Class<T> type) + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.nullValue(java.lang.Class<T> type) + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
Matchers.sameInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.sameInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static + + + + +
+<T> Matcher<T>
+
Matchers.samePropertyValuesAs(T expectedBean) + +
+          Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+static Matcher<java.lang.String>Matchers.startsWith(java.lang.String prefix) + +
+          Creates a matcher that matches if the examined String starts with the specified + String.
+static Matcher<java.lang.String>CoreMatchers.startsWith(java.lang.String prefix) + +
+          Creates a matcher that matches if the examined String starts with the specified + String.
+static Matcher<java.lang.String>Matchers.stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) + +
+          Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance.
+static + + + + +
+<T> Matcher<T>
+
Matchers.theInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.theInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static + + + + +
+<T> Matcher<java.lang.Class<?>>
+
Matchers.typeCompatibleWith(java.lang.Class<T> baseType) + +
+          Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest with parameters of type Matcher
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> IsArray<T>
+
Matchers.array(Matcher<? super T>... elementMatchers) + +
+          Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContaining(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContainingInAnyOrder(Matcher<? super E>... 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.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+static + + + + +
+<T> void
+
MatcherAssert.assertThat(java.lang.String reason, + T actual, + Matcher<? super T> matcher) + +
+           
+static + + + + +
+<T> void
+
MatcherAssert.assertThat(T actual, + Matcher<? super T> matcher) + +
+           
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
Matchers.both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
CoreMatchers.both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.contains(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.contains(Matcher<? super E> itemMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.containsInAnyOrder(Matcher<? super E> itemMatcher) + +
+          Deprecated. use contains(Matcher itemMatcher) instead
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
Matchers.describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
Matchers.either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
CoreMatchers.either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
Matchers.everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
CoreMatchers.everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
Matchers.hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
Matchers.hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
Matchers.hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
CoreMatchers.hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
Matchers.hasItemInArray(Matcher<? super T> elementMatcher) + +
+          Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
Matchers.hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
CoreMatchers.hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
Matchers.hasKey(Matcher<? super K> keyMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
Matchers.hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
Matchers.hasSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
Matchers.hasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
Matchers.hasValue(Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>Matchers.hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>Matchers.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+static + + + + +
+<T> Matcher<T>
+
Matchers.is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
Matchers.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+ booleanCondition.matching(Matcher<T> match) + +
+           
+abstract  booleanCondition.matching(Matcher<T> match, + java.lang.String message) + +
+           
+static + + + + +
+<T> Matcher<T>
+
Matchers.not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> boolean
+
JavaLangMatcherAssert.that(T argument, + Matcher<? super T> matcher) + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method parameters in org.hamcrest with type arguments of type Matcher
+static + + + + +
+<T> Matcher<T>
+
Matchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
CoreMatchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContaining(java.util.List<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
Matchers.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
Matchers.contains(java.util.List<Matcher<? super E>> itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
Matchers.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+  +

+ + + + + + + + +
Constructors in org.hamcrest with parameters of type Matcher
FeatureMatcher(Matcher<? super U> subMatcher, + java.lang.String featureDescription, + java.lang.String featureName) + +
+          Constructor
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.beans
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.beans that implement Matcher
+ classHasProperty<T> + +
+          A Matcher that checks that an object has a JavaBean property + with the specified name.
+ classHasPropertyWithValue<T> + +
+          Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
+ classSamePropertyValuesAs<T> + +
+           
+static classSamePropertyValuesAs.PropertyMatcher + +
+           
+  +

+ + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.beans that return Matcher
+static + + + + +
+<T> Matcher<T>
+
HasProperty.hasProperty(java.lang.String propertyName) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+static + + + + +
+<T> Matcher<T>
+
HasPropertyWithValue.hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
SamePropertyValuesAs.samePropertyValuesAs(T expectedBean) + +
+          Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+  +

+ + + + + + + + + +
Methods in org.hamcrest.beans with parameters of type Matcher
+static + + + + +
+<T> Matcher<T>
+
HasPropertyWithValue.hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+          Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+  +

+ + + + + + + + +
Constructors in org.hamcrest.beans with parameters of type Matcher
HasPropertyWithValue(java.lang.String propertyName, + Matcher<?> valueMatcher) + +
+           
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.collection that implement Matcher
+ classIsArray<T> + +
+          Matcher for array whose elements satisfy a sequence of matchers.
+ classIsArrayContaining<T> + +
+          Matches if an array contains an item satisfying a nested matcher.
+ classIsArrayContainingInAnyOrder<E> + +
+           
+ classIsArrayContainingInOrder<E> + +
+           
+ classIsArrayWithSize<E> + +
+          Matches if array size satisfies a nested matcher.
+ classIsCollectionWithSize<E> + +
+          Matches if collection size satisfies a nested matcher.
+ classIsEmptyCollection<E> + +
+          Tests if collection is empty.
+ classIsEmptyIterable<E> + +
+          Tests if collection is empty.
+ classIsIn<T> + +
+           
+ classIsIterableContainingInAnyOrder<T> + +
+           
+ classIsIterableContainingInOrder<E> + +
+           
+ classIsIterableWithSize<E> + +
+           
+ classIsMapContaining<K,V> + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.collection that return Matcher
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(E... items) + +
+          Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(java.util.List<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(E... items) + +
+          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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayWithSize.arrayWithSize(int size) + +
+          Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayWithSize.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(E... items) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(java.util.List<Matcher<? super E>> itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super E> itemMatcher) + +
+          Deprecated. use contains(Matcher itemMatcher) instead
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(T... items) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
IsEmptyCollection.empty() + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayWithSize.emptyArray() + +
+          Creates a matcher for arrays that matches when the length of the array + is zero.
+static + + + + +
+<E> Matcher<java.util.Collection<E>>
+
IsEmptyCollection.emptyCollectionOf(java.lang.Class<E> type) + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsEmptyIterable.emptyIterable() + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
IsEmptyIterable.emptyIterableOf(java.lang.Class<E> type) + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
IsMapContaining.hasEntry(K key, + V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
IsMapContaining.hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
IsArrayContaining.hasItemInArray(Matcher<? super T> elementMatcher) + +
+          Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
IsArrayContaining.hasItemInArray(T element) + +
+          A shortcut to the frequently used hasItemInArray(equalTo(x)).
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
IsMapContaining.hasKey(K key) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
IsMapContaining.hasKey(Matcher<? super K> keyMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
IsCollectionWithSize.hasSize(int size) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
IsCollectionWithSize.hasSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
IsMapContaining.hasValue(Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
IsMapContaining.hasValue(V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+static + + + + +
+<T> Matcher<T>
+
IsIn.isIn(java.util.Collection<T> collection) + +
+          Creates a matcher that matches when the examined object is found within the + specified collection.
+static + + + + +
+<T> Matcher<T>
+
IsIn.isIn(T[] elements) + +
+          Creates a matcher that matches when the examined object is found within the + specified array.
+static + + + + +
+<T> Matcher<T>
+
IsIn.isOneOf(T... elements) + +
+          Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
IsIterableWithSize.iterableWithSize(int size) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
IsIterableWithSize.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.collection with parameters of type Matcher
+static + + + + +
+<T> IsArray<T>
+
IsArray.array(Matcher<? super T>... elementMatchers) + +
+          Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayWithSize.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super E> itemMatcher) + +
+          Deprecated. use contains(Matcher itemMatcher) instead
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
IsMapContaining.hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
IsMapContaining.hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
IsArrayContaining.hasItemInArray(Matcher<? super T> elementMatcher) + +
+          Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
IsMapContaining.hasKey(Matcher<? super K> keyMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
IsCollectionWithSize.hasSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
IsMapContaining.hasValue(Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
IsIterableWithSize.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Method parameters in org.hamcrest.collection with type arguments of type Matcher
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInOrder.arrayContaining(java.util.List<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
IsIterableContainingInOrder.contains(java.util.List<Matcher<? super E>> itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
IsIterableContainingInAnyOrder.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Constructors in org.hamcrest.collection with parameters of type Matcher
IsArray(Matcher<? super T>[] elementMatchers) + +
+           
IsArrayContaining(Matcher<? super T> elementMatcher) + +
+           
IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+           
IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+           
IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+           
IsMapContaining(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+           
IsMapContaining(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+           
+  +

+ + + + + + + + + + + + + + + + + +
Constructor parameters in org.hamcrest.collection with type arguments of type Matcher
IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers) + +
+           
IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers) + +
+           
IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers) + +
+           
IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers) + +
+           
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.core that implement Matcher
+ classAllOf<T> + +
+          Calculates the logical conjunction of multiple matchers.
+ classAnyOf<T> + +
+          Calculates the logical disjunction of multiple matchers.
+ classCombinableMatcher<T> + +
+           
+ classDescribedAs<T> + +
+          Provides a custom description to another matcher.
+ classEvery<T> + +
+           
+ classIs<T> + +
+          Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
+ classIsAnything<T> + +
+          A matcher that always returns true.
+ classIsCollectionContaining<T> + +
+           
+ classIsEqual<T> + +
+          Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
+ classIsInstanceOf + +
+          Tests whether the value is an instance of a class.
+ classIsNot<T> + +
+          Calculates the logical negation of a matcher.
+ classIsNull<T> + +
+          Is the value null?
+ classIsSame<T> + +
+          Is the value the same object as another value?
+ classStringContains + +
+          Tests if the argument is a string that contains a substring.
+ classStringEndsWith + +
+          Tests if the argument is a string that contains a substring.
+ classStringStartsWith + +
+          Tests if the argument is a string that contains a substring.
+ classSubstringMatcher + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.core that return Matcher
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
IsInstanceOf.any(java.lang.Class<T> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static Matcher<java.lang.Object>IsAnything.anything() + +
+          Creates a matcher that always matches, regardless of the examined object.
+static Matcher<java.lang.Object>IsAnything.anything(java.lang.String description) + +
+          Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+static Matcher<java.lang.String>StringContains.containsString(java.lang.String substring) + +
+          Creates a matcher that matches if the examined String contains the specified + String anywhere.
+static + + + + +
+<T> Matcher<T>
+
DescribedAs.describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static Matcher<java.lang.String>StringEndsWith.endsWith(java.lang.String suffix) + +
+          Creates a matcher that matches if the examined String ends with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
IsEqual.equalTo(T operand) + +
+          Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
Every.everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
IsCollectionContaining.hasItem(T item) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
IsCollectionContaining.hasItems(T... items) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+static + + + + +
+<T> Matcher<T>
+
IsInstanceOf.instanceOf(java.lang.Class<?> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+static + + + + +
+<T> Matcher<T>
+
Is.is(java.lang.Class<T> type) + +
+          Deprecated. use isA(Class type) instead.
+static + + + + +
+<T> Matcher<T>
+
Is.is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
Is.is(T value) + +
+          A shortcut to the frequently used is(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
Is.isA(java.lang.Class<T> type) + +
+          A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+static + + + + +
+<T> Matcher<T>
+
IsNot.not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
IsNot.not(T value) + +
+          A shortcut to the frequently used not(equalTo(x)).
+static Matcher<java.lang.Object>IsNull.notNullValue() + +
+          A shortcut to the frequently used not(nullValue()).
+static + + + + +
+<T> Matcher<T>
+
IsNull.notNullValue(java.lang.Class<T> type) + +
+          A shortcut to the frequently used not(nullValue(X.class)).
+static Matcher<java.lang.Object>IsNull.nullValue() + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
IsNull.nullValue(java.lang.Class<T> type) + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
IsSame.sameInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static Matcher<java.lang.String>StringStartsWith.startsWith(java.lang.String prefix) + +
+          Creates a matcher that matches if the examined String starts with the specified + String.
+static + + + + +
+<T> Matcher<T>
+
IsSame.theInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.core with parameters of type Matcher
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
AllOf.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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ CombinableMatcher<T>CombinableMatcher.and(Matcher<? super T> other) + +
+           
+ CombinableMatcher<X>CombinableMatcher.CombinableBothMatcher.and(Matcher<? super X> other) + +
+           
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
CombinableMatcher.both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+static + + + + +
+<T> Matcher<T>
+
DescribedAs.describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
CombinableMatcher.either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
Every.everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<T>
+
Is.is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
IsNot.not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+ CombinableMatcher<T>CombinableMatcher.or(Matcher<? super T> other) + +
+           
+ CombinableMatcher<X>CombinableMatcher.CombinableEitherMatcher.or(Matcher<? super X> other) + +
+           
+  +

+ + + + + + + + + + + + + +
Method parameters in org.hamcrest.core with type arguments of type Matcher
+static + + + + +
+<T> Matcher<T>
+
AllOf.allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Constructors in org.hamcrest.core with parameters of type Matcher
CombinableMatcher.CombinableBothMatcher(Matcher<? super X> matcher) + +
+           
CombinableMatcher.CombinableEitherMatcher(Matcher<? super X> matcher) + +
+           
CombinableMatcher(Matcher<? super T> matcher) + +
+           
DescribedAs(java.lang.String descriptionTemplate, + Matcher<T> matcher, + java.lang.Object[] values) + +
+           
Every(Matcher<? super T> matcher) + +
+           
Is(Matcher<T> matcher) + +
+           
IsCollectionContaining(Matcher<? super T> elementMatcher) + +
+           
IsNot(Matcher<T> matcher) + +
+           
+  +

+ + + + + + + + + + + +
Constructor parameters in org.hamcrest.core with type arguments of type Matcher
AllOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+           
AnyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+           
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.integration
+  +

+ + + + + + + + + + + + + +
Methods in org.hamcrest.integration with parameters of type Matcher
+static org.jmock.core.ConstraintJMock1Adapter.adapt(Matcher<?> matcher) + +
+          Convenience factory method that will adapt a + Hamcrest Matcher to act as an + jMock Constraint.
+static org.easymock.IArgumentMatcherEasyMock2Adapter.adapt(Matcher<?> matcher) + +
+          Convenience factory method that will adapt a + Hamcrest Matcher to act as an + EasyMock IArgumentMatcher and + report it to EasyMock so it can be kept track of.
+  +

+ + + + + + + + + + + +
Constructors in org.hamcrest.integration with parameters of type Matcher
EasyMock2Adapter(Matcher<?> matcher) + +
+           
JMock1Adapter(Matcher<?> matcher) + +
+           
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.number
+  +

+ + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.number that implement Matcher
+ classBigDecimalCloseTo + +
+           
+ classIsCloseTo + +
+          Is the value a number equal to a value within some range of + acceptable error?
+ classOrderingComparison<T extends Comparable<T>> + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.number that return Matcher
+static Matcher<java.math.BigDecimal>BigDecimalCloseTo.closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error) + +
+          Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+static Matcher<java.lang.Double>IsCloseTo.closeTo(double operand, + double error) + +
+          Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.comparesEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.greaterThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.greaterThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.lessThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
OrderingComparison.lessThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.object
+  +

+ + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.object that implement Matcher
+ classHasToString<T> + +
+           
+ classIsCompatibleType<T> + +
+           
+ classIsEventFrom + +
+          Tests if the value is an event announced by a specific object.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.object that return Matcher
+static Matcher<java.util.EventObject>IsEventFrom.eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+static Matcher<java.util.EventObject>IsEventFrom.eventFrom(java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any EventObject + announced by source.
+static + + + + +
+<T> Matcher<T>
+
HasToString.hasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
HasToString.hasToString(java.lang.String expectedToString) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+static + + + + +
+<T> Matcher<java.lang.Class<?>>
+
IsCompatibleType.typeCompatibleWith(java.lang.Class<T> baseType) + +
+          Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+  +

+ + + + + + + + + +
Methods in org.hamcrest.object with parameters of type Matcher
+static + + + + +
+<T> Matcher<T>
+
HasToString.hasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+  +

+ + + + + + + + +
Constructors in org.hamcrest.object with parameters of type Matcher
HasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+           
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.text
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.text that implement Matcher
+ classIsEmptyString + +
+          Matches empty Strings (and null).
+ classIsEqualIgnoringCase + +
+          Tests if a string is equal to another string, regardless of the case.
+ classIsEqualIgnoringWhiteSpace + +
+          Tests if a string is equal to another string, ignoring any changes in whitespace.
+ classStringContainsInOrder + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.text that return Matcher
+static Matcher<java.lang.String>IsEqualIgnoringCase.equalToIgnoringCase(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+static Matcher<java.lang.String>IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+static Matcher<java.lang.String>IsEmptyString.isEmptyOrNullString() + +
+          Creates a matcher of String that matches when the examined string is null, or + has zero length.
+static Matcher<java.lang.String>IsEmptyString.isEmptyString() + +
+          Creates a matcher of String that matches when the examined string has zero length.
+static Matcher<java.lang.String>StringContainsInOrder.stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) + +
+          Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance.
+  +

+ + + + + +
+Uses of Matcher in org.hamcrest.xml
+  +

+ + + + + + + + + +
Classes in org.hamcrest.xml that implement Matcher
+ classHasXPath + +
+          Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.xml that return Matcher
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+  +

+ + + + + + + + + + + + + +
Methods in org.hamcrest.xml with parameters of type Matcher
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>HasXPath.hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+  +

+ + + + + + + + + + + +
Constructors in org.hamcrest.xml with parameters of type Matcher
HasXPath(java.lang.String xPathExpression, + Matcher<java.lang.String> valueMatcher) + +
+           
HasXPath(java.lang.String xPathExpression, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/MatcherAssert.html b/docs/javadoc/1.3/org/hamcrest/class-use/MatcherAssert.html new file mode 100644 index 00000000..39aee6e7 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/MatcherAssert.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.MatcherAssert (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.MatcherAssert

+
+No usage of org.hamcrest.MatcherAssert +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/Matchers.html b/docs/javadoc/1.3/org/hamcrest/class-use/Matchers.html new file mode 100644 index 00000000..4bfd62be --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/Matchers.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.Matchers (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.Matchers

+
+No usage of org.hamcrest.Matchers +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/SelfDescribing.html b/docs/javadoc/1.3/org/hamcrest/class-use/SelfDescribing.html new file mode 100644 index 00000000..9bd0b4c2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/SelfDescribing.html @@ -0,0 +1,892 @@ + + + + + + +Uses of Interface org.hamcrest.SelfDescribing (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
org.hamcrest.SelfDescribing

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use SelfDescribing
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.internal  
org.hamcrest.numberMatchers that perform numeric comparisons. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.textMatchers that perform text comparisons. 
org.hamcrest.xmlMatchers of XML documents. 
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest
+  +

+ + + + + + + + + +
Subinterfaces of SelfDescribing in org.hamcrest
+ interfaceMatcher<T> + +
+          A matcher over acceptable values.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest that implement SelfDescribing
+ classBaseMatcher<T> + +
+          BaseClass for all Matcher implementations.
+ classCustomMatcher<T> + +
+          Utility class for writing one off matchers.
+ classCustomTypeSafeMatcher<T> + +
+          Utility class for writing one off matchers.
+ classDiagnosingMatcher<T> + +
+          TODO(ngd): Document.
+ classFeatureMatcher<T,U> + +
+          Supporting class for matching a feature of an object.
+ classTypeSafeDiagnosingMatcher<T> + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
+ classTypeSafeMatcher<T> + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest with parameters of type SelfDescribing
+ DescriptionDescription.appendDescriptionOf(SelfDescribing value) + +
+          Appends the description of a SelfDescribing value to this description.
+ DescriptionDescription.NullDescription.appendDescriptionOf(SelfDescribing value) + +
+           
+ DescriptionBaseDescription.appendDescriptionOf(SelfDescribing value) + +
+           
+static java.lang.StringStringDescription.asString(SelfDescribing selfDescribing) + +
+          Alias for StringDescription.toString(SelfDescribing).
+static java.lang.StringStringDescription.toString(SelfDescribing selfDescribing) + +
+          Return the description of a SelfDescribing object as a String.
+  +

+ + + + + + + + + + + + + + + + + +
Method parameters in org.hamcrest with type arguments of type SelfDescribing
+ DescriptionDescription.appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+          Appends a list of SelfDescribing objects + to the description.
+ DescriptionDescription.NullDescription.appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+           
+ DescriptionBaseDescription.appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) + +
+           
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.beans
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.beans that implement SelfDescribing
+ classHasProperty<T> + +
+          A Matcher that checks that an object has a JavaBean property + with the specified name.
+ classHasPropertyWithValue<T> + +
+          Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
+ classSamePropertyValuesAs<T> + +
+           
+static classSamePropertyValuesAs.PropertyMatcher + +
+           
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.collection that implement SelfDescribing
+ classIsArray<T> + +
+          Matcher for array whose elements satisfy a sequence of matchers.
+ classIsArrayContaining<T> + +
+          Matches if an array contains an item satisfying a nested matcher.
+ classIsArrayContainingInAnyOrder<E> + +
+           
+ classIsArrayContainingInOrder<E> + +
+           
+ classIsArrayWithSize<E> + +
+          Matches if array size satisfies a nested matcher.
+ classIsCollectionWithSize<E> + +
+          Matches if collection size satisfies a nested matcher.
+ classIsEmptyCollection<E> + +
+          Tests if collection is empty.
+ classIsEmptyIterable<E> + +
+          Tests if collection is empty.
+ classIsIn<T> + +
+           
+ classIsIterableContainingInAnyOrder<T> + +
+           
+ classIsIterableContainingInOrder<E> + +
+           
+ classIsIterableWithSize<E> + +
+           
+ classIsMapContaining<K,V> + +
+           
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.core that implement SelfDescribing
+ classAllOf<T> + +
+          Calculates the logical conjunction of multiple matchers.
+ classAnyOf<T> + +
+          Calculates the logical disjunction of multiple matchers.
+ classCombinableMatcher<T> + +
+           
+ classDescribedAs<T> + +
+          Provides a custom description to another matcher.
+ classEvery<T> + +
+           
+ classIs<T> + +
+          Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
+ classIsAnything<T> + +
+          A matcher that always returns true.
+ classIsCollectionContaining<T> + +
+           
+ classIsEqual<T> + +
+          Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
+ classIsInstanceOf + +
+          Tests whether the value is an instance of a class.
+ classIsNot<T> + +
+          Calculates the logical negation of a matcher.
+ classIsNull<T> + +
+          Is the value null?
+ classIsSame<T> + +
+          Is the value the same object as another value?
+ classStringContains + +
+          Tests if the argument is a string that contains a substring.
+ classStringEndsWith + +
+          Tests if the argument is a string that contains a substring.
+ classStringStartsWith + +
+          Tests if the argument is a string that contains a substring.
+ classSubstringMatcher + +
+           
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.internal
+  +

+ + + + + + + + + +
Classes in org.hamcrest.internal that implement SelfDescribing
+ classSelfDescribingValue<T> + +
+           
+  +

+ + + + + + + + + +
Methods in org.hamcrest.internal that return SelfDescribing
+ SelfDescribingSelfDescribingValueIterator.next() + +
+           
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.number
+  +

+ + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.number that implement SelfDescribing
+ classBigDecimalCloseTo + +
+           
+ classIsCloseTo + +
+          Is the value a number equal to a value within some range of + acceptable error?
+ classOrderingComparison<T extends Comparable<T>> + +
+           
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.object
+  +

+ + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.object that implement SelfDescribing
+ classHasToString<T> + +
+           
+ classIsCompatibleType<T> + +
+           
+ classIsEventFrom + +
+          Tests if the value is an event announced by a specific object.
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.text
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Classes in org.hamcrest.text that implement SelfDescribing
+ classIsEmptyString + +
+          Matches empty Strings (and null).
+ classIsEqualIgnoringCase + +
+          Tests if a string is equal to another string, regardless of the case.
+ classIsEqualIgnoringWhiteSpace + +
+          Tests if a string is equal to another string, ignoring any changes in whitespace.
+ classStringContainsInOrder + +
+           
+  +

+ + + + + +
+Uses of SelfDescribing in org.hamcrest.xml
+  +

+ + + + + + + + + +
Classes in org.hamcrest.xml that implement SelfDescribing
+ classHasXPath + +
+          Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/StringDescription.html b/docs/javadoc/1.3/org/hamcrest/class-use/StringDescription.html new file mode 100644 index 00000000..adf936c2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/StringDescription.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.StringDescription (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.StringDescription

+
+No usage of org.hamcrest.StringDescription +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/TypeSafeDiagnosingMatcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/TypeSafeDiagnosingMatcher.html new file mode 100644 index 00000000..6b00ab48 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/TypeSafeDiagnosingMatcher.html @@ -0,0 +1,390 @@ + + + + + + +Uses of Class org.hamcrest.TypeSafeDiagnosingMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.TypeSafeDiagnosingMatcher

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use TypeSafeDiagnosingMatcher
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.xmlMatchers of XML documents. 
+  +

+ + + + + +
+Uses of TypeSafeDiagnosingMatcher in org.hamcrest
+  +

+ + + + + + + + + +
Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest
+ classFeatureMatcher<T,U> + +
+          Supporting class for matching a feature of an object.
+  +

+ + + + + +
+Uses of TypeSafeDiagnosingMatcher in org.hamcrest.beans
+  +

+ + + + + + + + + + + + + +
Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.beans
+ classHasPropertyWithValue<T> + +
+          Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
+ classSamePropertyValuesAs<T> + +
+           
+  +

+ + + + + +
+Uses of TypeSafeDiagnosingMatcher in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.collection
+ classIsArrayWithSize<E> + +
+          Matches if array size satisfies a nested matcher.
+ classIsCollectionWithSize<E> + +
+          Matches if collection size satisfies a nested matcher.
+ classIsIterableContainingInAnyOrder<T> + +
+           
+ classIsIterableContainingInOrder<E> + +
+           
+ classIsIterableWithSize<E> + +
+           
+  +

+ + + + + +
+Uses of TypeSafeDiagnosingMatcher in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.core
+ classCombinableMatcher<T> + +
+           
+ classEvery<T> + +
+           
+ classIsCollectionContaining<T> + +
+           
+  +

+ + + + + +
+Uses of TypeSafeDiagnosingMatcher in org.hamcrest.object
+  +

+ + + + + + + + + + + + + +
Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.object
+ classHasToString<T> + +
+           
+ classIsEventFrom + +
+          Tests if the value is an event announced by a specific object.
+  +

+ + + + + +
+Uses of TypeSafeDiagnosingMatcher in org.hamcrest.xml
+  +

+ + + + + + + + + +
Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.xml
+ classHasXPath + +
+          Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/class-use/TypeSafeMatcher.html b/docs/javadoc/1.3/org/hamcrest/class-use/TypeSafeMatcher.html new file mode 100644 index 00000000..845c4c32 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/class-use/TypeSafeMatcher.html @@ -0,0 +1,460 @@ + + + + + + +Uses of Class org.hamcrest.TypeSafeMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.TypeSafeMatcher

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use TypeSafeMatcher
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.numberMatchers that perform numeric comparisons. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.textMatchers that perform text comparisons. 
+  +

+ + + + + +
+Uses of TypeSafeMatcher in org.hamcrest
+  +

+ + + + + + + + + +
Subclasses of TypeSafeMatcher in org.hamcrest
+ classCustomTypeSafeMatcher<T> + +
+          Utility class for writing one off matchers.
+  +

+ + + + + +
+Uses of TypeSafeMatcher in org.hamcrest.beans
+  +

+ + + + + + + + + +
Subclasses of TypeSafeMatcher in org.hamcrest.beans
+ classHasProperty<T> + +
+          A Matcher that checks that an object has a JavaBean property + with the specified name.
+  +

+ + + + + +
+Uses of TypeSafeMatcher in org.hamcrest.collection
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Subclasses of TypeSafeMatcher in org.hamcrest.collection
+ classIsArray<T> + +
+          Matcher for array whose elements satisfy a sequence of matchers.
+ classIsArrayContaining<T> + +
+          Matches if an array contains an item satisfying a nested matcher.
+ classIsArrayContainingInAnyOrder<E> + +
+           
+ classIsArrayContainingInOrder<E> + +
+           
+ classIsEmptyCollection<E> + +
+          Tests if collection is empty.
+ classIsEmptyIterable<E> + +
+          Tests if collection is empty.
+ classIsMapContaining<K,V> + +
+           
+  +

+ + + + + +
+Uses of TypeSafeMatcher in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Subclasses of TypeSafeMatcher in org.hamcrest.core
+ classStringContains + +
+          Tests if the argument is a string that contains a substring.
+ classStringEndsWith + +
+          Tests if the argument is a string that contains a substring.
+ classStringStartsWith + +
+          Tests if the argument is a string that contains a substring.
+ classSubstringMatcher + +
+           
+  +

+ + + + + +
+Uses of TypeSafeMatcher in org.hamcrest.number
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of TypeSafeMatcher in org.hamcrest.number
+ classBigDecimalCloseTo + +
+           
+ classIsCloseTo + +
+          Is the value a number equal to a value within some range of + acceptable error?
+ classOrderingComparison<T extends Comparable<T>> + +
+           
+  +

+ + + + + +
+Uses of TypeSafeMatcher in org.hamcrest.object
+  +

+ + + + + + + + + +
Subclasses of TypeSafeMatcher in org.hamcrest.object
+ classIsCompatibleType<T> + +
+           
+  +

+ + + + + +
+Uses of TypeSafeMatcher in org.hamcrest.text
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of TypeSafeMatcher in org.hamcrest.text
+ classIsEqualIgnoringCase + +
+          Tests if a string is equal to another string, regardless of the case.
+ classIsEqualIgnoringWhiteSpace + +
+          Tests if a string is equal to another string, ignoring any changes in whitespace.
+ classStringContainsInOrder + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsArray.html b/docs/javadoc/1.3/org/hamcrest/collection/IsArray.html new file mode 100644 index 00000000..0f18d5dc --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsArray.html @@ -0,0 +1,444 @@ + + + + + + +IsArray (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsArray<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<T[]>
+          extended by org.hamcrest.collection.IsArray<T>
+
+
+
All Implemented Interfaces:
Matcher<T[]>, SelfDescribing
+
+
+
+
public class IsArray<T>
extends TypeSafeMatcher<T[]>
+ + +

+Matcher for array whose elements satisfy a sequence of matchers. + The array size must equal the number of element matchers. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsArray(Matcher<? super T>[] elementMatchers) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> IsArray<T>
+
array(Matcher<? super T>... elementMatchers) + +
+          Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+ voiddescribeMismatchSafely(T[] actual, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+protected  java.lang.StringdescriptionEnd() + +
+          Returns the string that ends the description.
+protected  java.lang.StringdescriptionSeparator() + +
+          Returns the string that separates the elements in the description.
+protected  java.lang.StringdescriptionStart() + +
+          Returns the string that starts the description.
+ booleanmatchesSafely(T[] array) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsArray

+
+public IsArray(Matcher<? super T>[] elementMatchers)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(T[] array)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<T[]>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(T[] actual,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<T[]>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+descriptionStart

+
+protected java.lang.String descriptionStart()
+
+
Returns the string that starts the description. + + Can be overridden in subclasses to customise how the matcher is + described. +

+

+
+
+
+
+ +

+descriptionSeparator

+
+protected java.lang.String descriptionSeparator()
+
+
Returns the string that separates the elements in the description. + + Can be overridden in subclasses to customise how the matcher is + described. +

+

+
+
+
+
+ +

+descriptionEnd

+
+protected java.lang.String descriptionEnd()
+
+
Returns the string that ends the description. + + Can be overridden in subclasses to customise how the matcher is + described. +

+

+
+
+
+
+ +

+array

+
+public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)
+
+
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: +

assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
+

+

+
Parameters:
elementMatchers - the matchers that the elements of examined arrays should satisfy
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContaining.html b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContaining.html new file mode 100644 index 00000000..a2daf53f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContaining.html @@ -0,0 +1,405 @@ + + + + + + +IsArrayContaining (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsArrayContaining<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<T[]>
+          extended by org.hamcrest.collection.IsArrayContaining<T>
+
+
+
All Implemented Interfaces:
Matcher<T[]>, SelfDescribing
+
+
+
+
public class IsArrayContaining<T>
extends TypeSafeMatcher<T[]>
+ + +

+Matches if an array contains an item satisfying a nested matcher. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsArrayContaining(Matcher<? super T> elementMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(T[] item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<T[]>
+
hasItemInArray(Matcher<? super T> elementMatcher) + +
+          Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+static + + + + +
+<T> Matcher<T[]>
+
hasItemInArray(T element) + +
+          A shortcut to the frequently used hasItemInArray(equalTo(x)).
+ booleanmatchesSafely(T[] array) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsArrayContaining

+
+public IsArrayContaining(Matcher<? super T> elementMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(T[] array)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<T[]>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(T[] item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<T[]>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+hasItemInArray

+
+public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
+
+
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: +

assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
+

+

+
Parameters:
elementMatcher - the matcher to apply to elements in examined arrays
+
+
+
+ +

+hasItemInArray

+
+public static <T> Matcher<T[]> hasItemInArray(T element)
+
+
A shortcut to the frequently used hasItemInArray(equalTo(x)). +

+ For example: +

assertThat(hasItemInArray(x))
+ instead of: +
assertThat(hasItemInArray(equalTo(x)))
+

+

+
Parameters:
element - the element that should be present in examined arrays
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContainingInAnyOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContainingInAnyOrder.html new file mode 100644 index 00000000..82290cbd --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContainingInAnyOrder.html @@ -0,0 +1,451 @@ + + + + + + +IsArrayContainingInAnyOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsArrayContainingInAnyOrder<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<E[]>
+          extended by org.hamcrest.collection.IsArrayContainingInAnyOrder<E>
+
+
+
All Implemented Interfaces:
Matcher<E[]>, SelfDescribing
+
+
+
+
public class IsArrayContainingInAnyOrder<E>
extends TypeSafeMatcher<E[]>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<E> Matcher<E[]>
+
arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContainingInAnyOrder(E... items) + +
+          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.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContainingInAnyOrder(Matcher<? super E>... 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.
+ voiddescribeMismatchSafely(E[] item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatchesSafely(E[] item) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsArrayContainingInAnyOrder

+
+public IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(E[] item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<E[]>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(E[] item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<E[]>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+arrayContainingInAnyOrder

+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... 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. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
+
+
+
+ +

+arrayContainingInAnyOrder

+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
+
+
+
+ +

+arrayContainingInAnyOrder

+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
+
+
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. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
+

+

+
Parameters:
items - the items that must equal the entries of an examined array, in any order
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContainingInOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContainingInOrder.html new file mode 100644 index 00000000..4b2db613 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayContainingInOrder.html @@ -0,0 +1,436 @@ + + + + + + +IsArrayContainingInOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsArrayContainingInOrder<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<E[]>
+          extended by org.hamcrest.collection.IsArrayContainingInOrder<E>
+
+
+
All Implemented Interfaces:
Matcher<E[]>, SelfDescribing
+
+
+
+
public class IsArrayContainingInOrder<E>
extends TypeSafeMatcher<E[]>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<E> Matcher<E[]>
+
arrayContaining(E... items) + +
+          Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContaining(java.util.List<Matcher<? super E>> 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.
+static + + + + +
+<E> Matcher<E[]>
+
arrayContaining(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+ voiddescribeMismatchSafely(E[] item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatchesSafely(E[] item) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsArrayContainingInOrder

+
+public IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(E[] item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<E[]>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(E[] item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<E[]>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+arrayContaining

+
+public static <E> Matcher<E[]> arrayContaining(E... items)
+
+
Creates a matcher for arrays that matcheswhen 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: +

assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
+

+

+
Parameters:
items - the items that must equal the items within an examined array
+
+
+
+ +

+arrayContaining

+
+public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
+
+
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: +

assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
+

+

+
Parameters:
itemMatchers - the matchers that must be satisfied by the items in the examined array
+
+
+
+ +

+arrayContaining

+
+public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> 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: +

assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsArrayWithSize.html b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayWithSize.html new file mode 100644 index 00000000..707ff4c6 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsArrayWithSize.html @@ -0,0 +1,395 @@ + + + + + + +IsArrayWithSize (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsArrayWithSize<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.FeatureMatcher<E[],java.lang.Integer>
+              extended by org.hamcrest.collection.IsArrayWithSize<E>
+
+
+
All Implemented Interfaces:
Matcher<E[]>, SelfDescribing
+
+
+
+
public class IsArrayWithSize<E>
extends FeatureMatcher<E[],java.lang.Integer>
+ + +

+Matches if array size satisfies a nested matcher. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<E> Matcher<E[]>
+
arrayWithSize(int size) + +
+          Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+static + + + + +
+<E> Matcher<E[]>
+
arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+static + + + + +
+<E> Matcher<E[]>
+
emptyArray() + +
+          Creates a matcher for arrays that matches when the length of the array + is zero.
+protected  java.lang.IntegerfeatureValueOf(E[] actual) + +
+          Implement this to extract the interesting feature.
+ + + + + + + +
Methods inherited from class org.hamcrest.FeatureMatcher
describeTo, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsArrayWithSize

+
+public IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+featureValueOf

+
+protected java.lang.Integer featureValueOf(E[] actual)
+
+
Description copied from class: FeatureMatcher
+
Implement this to extract the interesting feature. +

+

+
Specified by:
featureValueOf in class FeatureMatcher<E[],java.lang.Integer>
+
+
+
Parameters:
actual - the target object +
Returns:
the feature to be matched
+
+
+
+ +

+arrayWithSize

+
+public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
+

+

+
Parameters:
sizeMatcher - a matcher for the length of an examined array
+
+
+
+ +

+arrayWithSize

+
+public static <E> Matcher<E[]> arrayWithSize(int size)
+
+
Creates a matcher for arrays that matches when the length of the array + equals the specified size. +

+ For example: +

assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
+

+

+
Parameters:
size - the length that an examined array must have for a positive match
+
+
+
+ +

+emptyArray

+
+public static <E> Matcher<E[]> emptyArray()
+
+
Creates a matcher for arrays that matches when the length of the array + is zero. +

+ For example: +

assertThat(new String[0], emptyArray())
+

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsCollectionWithSize.html b/docs/javadoc/1.3/org/hamcrest/collection/IsCollectionWithSize.html new file mode 100644 index 00000000..1798819e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsCollectionWithSize.html @@ -0,0 +1,362 @@ + + + + + + +IsCollectionWithSize (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsCollectionWithSize<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
+              extended by org.hamcrest.collection.IsCollectionWithSize<E>
+
+
+
All Implemented Interfaces:
Matcher<java.util.Collection<? extends E>>, SelfDescribing
+
+
+
+
public class IsCollectionWithSize<E>
extends FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
+ + +

+Matches if collection size satisfies a nested matcher. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected  java.lang.IntegerfeatureValueOf(java.util.Collection<? extends E> actual) + +
+          Implement this to extract the interesting feature.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
hasSize(int size) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
hasSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+ + + + + + + +
Methods inherited from class org.hamcrest.FeatureMatcher
describeTo, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsCollectionWithSize

+
+public IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+featureValueOf

+
+protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)
+
+
Description copied from class: FeatureMatcher
+
Implement this to extract the interesting feature. +

+

+
Specified by:
featureValueOf in class FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
+
+
+
Parameters:
actual - the target object +
Returns:
the feature to be matched
+
+
+
+ +

+hasSize

+
+public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
+

+

+
Parameters:
sizeMatcher - a matcher for the size of an examined Collection
+
+
+
+ +

+hasSize

+
+public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
+
+
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasSize(2))
+

+

+
Parameters:
size - the expected size of an examined Collection
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsEmptyCollection.html b/docs/javadoc/1.3/org/hamcrest/collection/IsEmptyCollection.html new file mode 100644 index 00000000..4a36b40c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsEmptyCollection.html @@ -0,0 +1,404 @@ + + + + + + +IsEmptyCollection (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsEmptyCollection<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.util.Collection<? extends E>>
+          extended by org.hamcrest.collection.IsEmptyCollection<E>
+
+
+
All Implemented Interfaces:
Matcher<java.util.Collection<? extends E>>, SelfDescribing
+
+
+
+
public class IsEmptyCollection<E>
extends TypeSafeMatcher<java.util.Collection<? extends E>>
+ + +

+Tests if collection is empty. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsEmptyCollection() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.util.Collection<? extends E> item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<E> Matcher<java.util.Collection<? extends E>>
+
empty() + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+static + + + + +
+<E> Matcher<java.util.Collection<E>>
+
emptyCollectionOf(java.lang.Class<E> type) + +
+          Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+ booleanmatchesSafely(java.util.Collection<? extends E> item) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsEmptyCollection

+
+public IsEmptyCollection()
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.util.Collection<? extends E> item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.util.Collection<? extends E> item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+empty

+
+public static <E> Matcher<java.util.Collection<? extends E>> empty()
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +

+ For example: +

assertThat(new ArrayList<String>(), is(empty()))
+

+

+
+
+
+
+ +

+emptyCollectionOf

+
+public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> type)
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. +

+ For example: +

assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
+

+

+
Parameters:
type - the type of the collection's content
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsEmptyIterable.html b/docs/javadoc/1.3/org/hamcrest/collection/IsEmptyIterable.html new file mode 100644 index 00000000..d28c1e9d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsEmptyIterable.html @@ -0,0 +1,400 @@ + + + + + + +IsEmptyIterable (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsEmptyIterable<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.Iterable<? extends E>>
+          extended by org.hamcrest.collection.IsEmptyIterable<E>
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Iterable<? extends E>>, SelfDescribing
+
+
+
+
public class IsEmptyIterable<E>
extends TypeSafeMatcher<java.lang.Iterable<? extends E>>
+ + +

+Tests if collection is empty. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsEmptyIterable() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.lang.Iterable<? extends E> iter, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
emptyIterable() + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
emptyIterableOf(java.lang.Class<E> type) + +
+          Creates a matcher for Iterables matching examined iterables that yield no items.
+ booleanmatchesSafely(java.lang.Iterable<? extends E> iterable) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsEmptyIterable

+
+public IsEmptyIterable()
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.Iterable<? extends E> iterable)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.lang.Iterable<? extends E> iter,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+emptyIterable

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()
+
+
Creates a matcher for Iterables matching examined iterables that yield no items. +

+ For example: +

assertThat(new ArrayList<String>(), is(emptyIterable()))
+

+

+
+
+
+
+ +

+emptyIterableOf

+
+public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> type)
+
+
Creates a matcher for Iterables matching examined iterables that yield no items. +

+ For example: +

assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
+

+

+
Parameters:
type - the type of the iterable's content
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsIn.html b/docs/javadoc/1.3/org/hamcrest/collection/IsIn.html new file mode 100644 index 00000000..df1ba06b --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsIn.html @@ -0,0 +1,411 @@ + + + + + + +IsIn (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsIn<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.collection.IsIn<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class IsIn<T>
extends BaseMatcher<T>
+ + +

+


+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
IsIn(java.util.Collection<T> collection) + +
+           
IsIn(T[] elements) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description buffer) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<T>
+
isIn(java.util.Collection<T> collection) + +
+          Creates a matcher that matches when the examined object is found within the + specified collection.
+static + + + + +
+<T> Matcher<T>
+
isIn(T[] elements) + +
+          Creates a matcher that matches when the examined object is found within the + specified array.
+static + + + + +
+<T> Matcher<T>
+
isOneOf(T... elements) + +
+          Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+ booleanmatches(java.lang.Object o) + +
+          Evaluates the matcher for argument item.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsIn

+
+public IsIn(java.util.Collection<T> collection)
+
+
+
+ +

+IsIn

+
+public IsIn(T[] elements)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object o)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
o - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description buffer)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
buffer - The description to be built or appended to.
+
+
+
+ +

+isIn

+
+public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
+
+
Creates a matcher that matches when the examined object is found within the + specified collection. +

+ For example: +

assertThat("foo", isIn(Arrays.asList("bar", "foo")))
+

+

+
Parameters:
collection - the collection in which matching items must be found
+
+
+
+ +

+isIn

+
+public static <T> Matcher<T> isIn(T[] elements)
+
+
Creates a matcher that matches when the examined object is found within the + specified array. +

+ For example: +

assertThat("foo", isIn(new String[]{"bar", "foo"}))
+

+

+
Parameters:
elements - the array in which matching items must be found
+
+
+
+ +

+isOneOf

+
+public static <T> Matcher<T> isOneOf(T... elements)
+
+
Creates a matcher that matches when the examined object is equal to one of the + specified elements. +

+ For example: +

assertThat("foo", isIn("bar", "foo"))
+

+

+
Parameters:
elements - the elements amongst which matching items will be found
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsIterableContainingInAnyOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/IsIterableContainingInAnyOrder.html new file mode 100644 index 00000000..921e6543 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsIterableContainingInAnyOrder.html @@ -0,0 +1,465 @@ + + + + + + +IsIterableContainingInAnyOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsIterableContainingInAnyOrder<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>
+          extended by org.hamcrest.collection.IsIterableContainingInAnyOrder<T>
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Iterable<? extends T>>, SelfDescribing
+
+
+
+
public class IsIterableContainingInAnyOrder<T>
extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
containsInAnyOrder(Matcher<? super E> itemMatcher) + +
+          Deprecated. use contains(Matcher itemMatcher) instead
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
containsInAnyOrder(Matcher<? super T>... itemMatchers) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? extends T>>
+
containsInAnyOrder(T... items) + +
+          Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+protected  booleanmatchesSafely(java.lang.Iterable<? extends T> items, + Description mismatchDescription) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsIterableContainingInAnyOrder

+
+public IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+protected boolean matchesSafely(java.lang.Iterable<? extends T> items,
+                                Description mismatchDescription)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+containsInAnyOrder

+
+@Deprecated
+public static <E> Matcher<java.lang.Iterable<? extends E>> containsInAnyOrder(Matcher<? super E> itemMatcher)
+
+
Deprecated. use contains(Matcher itemMatcher) instead +

+

Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. +

+ For example: +

assertThat(Arrays.asList("foo"), containsInAnyOrder(equalTo("foo")))
+

+

+
Parameters:
itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
+
+
+
+ +

+containsInAnyOrder

+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. For a positive match, the examined iterable 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 + iterable. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
+
+
+
+ +

+containsInAnyOrder

+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
+
+
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. For a positive match, the examined iterable + 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 + iterable. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
+

+

+
Parameters:
items - the items that must equal the items provided by an examined Iterable in any order
+
+
+
+ +

+containsInAnyOrder

+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+
Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. For a positive match, the examined iterable + 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 iterable. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsIterableContainingInOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/IsIterableContainingInOrder.html new file mode 100644 index 00000000..923f8827 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsIterableContainingInOrder.html @@ -0,0 +1,452 @@ + + + + + + +IsIterableContainingInOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsIterableContainingInOrder<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
+          extended by org.hamcrest.collection.IsIterableContainingInOrder<E>
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Iterable<? extends E>>, SelfDescribing
+
+
+
+
public class IsIterableContainingInOrder<E>
extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(E... items) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(java.util.List<Matcher<? super E>> itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(Matcher<? super E>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+static + + + + +
+<E> Matcher<java.lang.Iterable<? extends E>>
+
contains(Matcher<? super E> itemMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+protected  booleanmatchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsIterableContainingInOrder

+
+public IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+protected boolean matchesSafely(java.lang.Iterable<? extends E> iterable,
+                                Description mismatchDescription)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. For a positive match, the examined iterable + must be of the same length as the number of specified items. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
+

+

+
Parameters:
items - the items that must equal the items provided by an examined Iterable
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. +

+ For example: +

assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
+

+

+
Parameters:
itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. For a positive match, the examined iterable + must be of the same length as the number of specified matchers. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
+

+

+
Parameters:
itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
+
+
+
+ +

+contains

+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. For a positive match, the examined iterable + must be of the same length as the specified list of matchers. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+

+

+
Parameters:
itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsIterableWithSize.html b/docs/javadoc/1.3/org/hamcrest/collection/IsIterableWithSize.html new file mode 100644 index 00000000..9f09b267 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsIterableWithSize.html @@ -0,0 +1,362 @@ + + + + + + +IsIterableWithSize (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsIterableWithSize<E>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
+              extended by org.hamcrest.collection.IsIterableWithSize<E>
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Iterable<E>>, SelfDescribing
+
+
+
+
public class IsIterableWithSize<E>
extends FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected  java.lang.IntegerfeatureValueOf(java.lang.Iterable<E> actual) + +
+          Implement this to extract the interesting feature.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
iterableWithSize(int size) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+static + + + + +
+<E> Matcher<java.lang.Iterable<E>>
+
iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) + +
+          Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+ + + + + + + +
Methods inherited from class org.hamcrest.FeatureMatcher
describeTo, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsIterableWithSize

+
+public IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+featureValueOf

+
+protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)
+
+
Description copied from class: FeatureMatcher
+
Implement this to extract the interesting feature. +

+

+
Specified by:
featureValueOf in class FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
+
+
+
Parameters:
actual - the target object +
Returns:
the feature to be matched
+
+
+
+ +

+iterableWithSize

+
+public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
+

+

+
Parameters:
sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
+
+
+
+ +

+iterableWithSize

+
+public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
+

+

+
Parameters:
size - the number of items that should be yielded by an examined Iterable
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/IsMapContaining.html b/docs/javadoc/1.3/org/hamcrest/collection/IsMapContaining.html new file mode 100644 index 00000000..1dd64d45 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/IsMapContaining.html @@ -0,0 +1,542 @@ + + + + + + +IsMapContaining (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.collection +
+Class IsMapContaining<K,V>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
+          extended by org.hamcrest.collection.IsMapContaining<K,V>
+
+
+
All Implemented Interfaces:
Matcher<java.util.Map<? extends K,? extends V>>, SelfDescribing
+
+
+
+
public class IsMapContaining<K,V>
extends TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsMapContaining(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.util.Map<? extends K,? extends V> map, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
hasEntry(K key, + V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+static + + + + +
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+
hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
hasKey(K key) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+static + + + + +
+<K> Matcher<java.util.Map<? extends K,?>>
+
hasKey(Matcher<? super K> keyMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
hasValue(Matcher<? super V> valueMatcher) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+static + + + + +
+<V> Matcher<java.util.Map<?,? extends V>>
+
hasValue(V value) + +
+          Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+ booleanmatchesSafely(java.util.Map<? extends K,? extends V> map) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsMapContaining

+
+public IsMapContaining(Matcher<? super K> keyMatcher,
+                       Matcher<? super V> valueMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.util.Map<? extends K,? extends V> map)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+hasEntry

+
+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
+                                                                             Matcher<? super V> valueMatcher)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. +

+ For example: +

assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
+

+

+
Parameters:
keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry
valueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry
+
+
+
+ +

+hasEntry

+
+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
+                                                                             V value)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. +

+ For example: +

assertThat(myMap, hasEntry("bar", "foo"))
+

+

+
Parameters:
key - the key that, in combination with the value, must be describe at least one entry
value - the value that, in combination with the key, must be describe at least one entry
+
+
+
+ +

+hasKey

+
+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. +

+ For example: +

assertThat(myMap, hasKey(equalTo("bar")))
+

+

+
Parameters:
keyMatcher - the matcher that must be satisfied by at least one key
+
+
+
+ +

+hasKey

+
+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. +

+ For example: +

assertThat(myMap, hasKey("bar"))
+

+

+
Parameters:
key - the key that satisfying maps must contain
+
+
+
+ +

+hasValue

+
+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. +

+ For example: +

assertThat(myMap, hasValue(equalTo("foo")))
+

+

+
Parameters:
valueMatcher - the matcher that must be satisfied by at least one value
+
+
+
+ +

+hasValue

+
+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. +

+ For example: +

assertThat(myMap, hasValue("foo"))
+

+

+
Parameters:
value - the value that satisfying maps must contain
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArray.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArray.html new file mode 100644 index 00000000..81f26e4b --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArray.html @@ -0,0 +1,223 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsArray (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsArray

+
+ + + + + + + + + + + + + +
+Packages that use IsArray
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.collectionMatchers of arrays and collections. 
+  +

+ + + + + +
+Uses of IsArray in org.hamcrest
+  +

+ + + + + + + + + +
Methods in org.hamcrest that return IsArray
+static + + + + +
+<T> IsArray<T>
+
Matchers.array(Matcher<? super T>... elementMatchers) + +
+          Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+  +

+ + + + + +
+Uses of IsArray in org.hamcrest.collection
+  +

+ + + + + + + + + +
Methods in org.hamcrest.collection that return IsArray
+static + + + + +
+<T> IsArray<T>
+
IsArray.array(Matcher<? super T>... elementMatchers) + +
+          Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContaining.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContaining.html new file mode 100644 index 00000000..89eaf5a5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContaining.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsArrayContaining (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsArrayContaining

+
+No usage of org.hamcrest.collection.IsArrayContaining +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContainingInAnyOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContainingInAnyOrder.html new file mode 100644 index 00000000..084ec01e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContainingInAnyOrder.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsArrayContainingInAnyOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsArrayContainingInAnyOrder

+
+No usage of org.hamcrest.collection.IsArrayContainingInAnyOrder +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContainingInOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContainingInOrder.html new file mode 100644 index 00000000..db92988c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayContainingInOrder.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsArrayContainingInOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsArrayContainingInOrder

+
+No usage of org.hamcrest.collection.IsArrayContainingInOrder +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayWithSize.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayWithSize.html new file mode 100644 index 00000000..06538db0 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsArrayWithSize.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsArrayWithSize (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsArrayWithSize

+
+No usage of org.hamcrest.collection.IsArrayWithSize +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsCollectionWithSize.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsCollectionWithSize.html new file mode 100644 index 00000000..3610bffc --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsCollectionWithSize.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsCollectionWithSize (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsCollectionWithSize

+
+No usage of org.hamcrest.collection.IsCollectionWithSize +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsEmptyCollection.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsEmptyCollection.html new file mode 100644 index 00000000..6ada8b46 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsEmptyCollection.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsEmptyCollection (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsEmptyCollection

+
+No usage of org.hamcrest.collection.IsEmptyCollection +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsEmptyIterable.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsEmptyIterable.html new file mode 100644 index 00000000..1b5f2ba6 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsEmptyIterable.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsEmptyIterable (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsEmptyIterable

+
+No usage of org.hamcrest.collection.IsEmptyIterable +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIn.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIn.html new file mode 100644 index 00000000..a6e7f0c5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIn.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsIn (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsIn

+
+No usage of org.hamcrest.collection.IsIn +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableContainingInAnyOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableContainingInAnyOrder.html new file mode 100644 index 00000000..7d4ac39c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableContainingInAnyOrder.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsIterableContainingInAnyOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsIterableContainingInAnyOrder

+
+No usage of org.hamcrest.collection.IsIterableContainingInAnyOrder +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableContainingInOrder.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableContainingInOrder.html new file mode 100644 index 00000000..c2682f14 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableContainingInOrder.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsIterableContainingInOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsIterableContainingInOrder

+
+No usage of org.hamcrest.collection.IsIterableContainingInOrder +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableWithSize.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableWithSize.html new file mode 100644 index 00000000..c13202d1 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsIterableWithSize.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsIterableWithSize (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsIterableWithSize

+
+No usage of org.hamcrest.collection.IsIterableWithSize +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsMapContaining.html b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsMapContaining.html new file mode 100644 index 00000000..f403a39d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/class-use/IsMapContaining.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.collection.IsMapContaining (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.collection.IsMapContaining

+
+No usage of org.hamcrest.collection.IsMapContaining +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/package-frame.html b/docs/javadoc/1.3/org/hamcrest/collection/package-frame.html new file mode 100644 index 00000000..d6d10396 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/package-frame.html @@ -0,0 +1,56 @@ + + + + + + +org.hamcrest.collection (Hamcrest) + + + + + + + + + + + +org.hamcrest.collection + + + + +
+Classes  + +
+IsArray +
+IsArrayContaining +
+IsArrayContainingInAnyOrder +
+IsArrayContainingInOrder +
+IsArrayWithSize +
+IsCollectionWithSize +
+IsEmptyCollection +
+IsEmptyIterable +
+IsIn +
+IsIterableContainingInAnyOrder +
+IsIterableContainingInOrder +
+IsIterableWithSize +
+IsMapContaining
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/package-summary.html b/docs/javadoc/1.3/org/hamcrest/collection/package-summary.html new file mode 100644 index 00000000..42b1d1ed --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/package-summary.html @@ -0,0 +1,220 @@ + + + + + + +org.hamcrest.collection (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.collection +

+Matchers of arrays and collections. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
IsArray<T>Matcher for array whose elements satisfy a sequence of matchers.
IsArrayContaining<T>Matches if an array contains an item satisfying a nested matcher.
IsArrayContainingInAnyOrder<E> 
IsArrayContainingInOrder<E> 
IsArrayWithSize<E>Matches if array size satisfies a nested matcher.
IsCollectionWithSize<E>Matches if collection size satisfies a nested matcher.
IsEmptyCollection<E>Tests if collection is empty.
IsEmptyIterable<E>Tests if collection is empty.
IsIn<T> 
IsIterableContainingInAnyOrder<T> 
IsIterableContainingInOrder<E> 
IsIterableWithSize<E> 
IsMapContaining<K,V> 
+  + +

+

+Package org.hamcrest.collection Description +

+ +

+

Matchers of arrays and collections.

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/package-tree.html b/docs/javadoc/1.3/org/hamcrest/collection/package-tree.html new file mode 100644 index 00000000..52dd0cd2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/package-tree.html @@ -0,0 +1,162 @@ + + + + + + +org.hamcrest.collection Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.collection +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/collection/package-use.html b/docs/javadoc/1.3/org/hamcrest/collection/package-use.html new file mode 100644 index 00000000..5a8c45e8 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/collection/package-use.html @@ -0,0 +1,189 @@ + + + + + + +Uses of Package org.hamcrest.collection (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.collection

+
+ + + + + + + + + + + + + +
+Packages that use org.hamcrest.collection
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.collectionMatchers of arrays and collections. 
+  +

+ + + + + + + + +
+Classes in org.hamcrest.collection used by org.hamcrest
IsArray + +
+          Matcher for array whose elements satisfy a sequence of matchers.
+  +

+ + + + + + + + +
+Classes in org.hamcrest.collection used by org.hamcrest.collection
IsArray + +
+          Matcher for array whose elements satisfy a sequence of matchers.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/AllOf.html b/docs/javadoc/1.3/org/hamcrest/core/AllOf.html new file mode 100644 index 00000000..16ae7fcb --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/AllOf.html @@ -0,0 +1,556 @@ + + + + + + +AllOf (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class AllOf<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.DiagnosingMatcher<T>
+          extended by org.hamcrest.core.AllOf<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class AllOf<T>
extends DiagnosingMatcher<T>
+ + +

+Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so + subsequent matchers are not called if an earlier matcher returns false. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
AllOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> Matcher<T>
+
allOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+static + + + + +
+<T> Matcher<T>
+
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) + +
+          Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatches(java.lang.Object o, + Description mismatch) + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.DiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+AllOf

+
+public AllOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object o,
+                       Description mismatch)
+
+
+
Specified by:
matches in class DiagnosingMatcher<T>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third,
+                                   Matcher<? super T> fourth)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+                                   Matcher<? super T> second,
+                                   Matcher<? super T> third,
+                                   Matcher<? super T> fourth,
+                                   Matcher<? super T> fifth)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+
+ +

+allOf

+
+public static <T> Matcher<T> 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)
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers. +

+ For example: +

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/AnyOf.html b/docs/javadoc/1.3/org/hamcrest/core/AnyOf.html new file mode 100644 index 00000000..b54cb30e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/AnyOf.html @@ -0,0 +1,598 @@ + + + + + + +AnyOf (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class AnyOf<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.AnyOf<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class AnyOf<T>
extends BaseMatcher<T>
+ + +

+Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so + subsequent matchers are not called if an earlier matcher returns true. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
AnyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> AnyOf<T>
+
anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ voiddescribeTo(Description description, + java.lang.String operator) + +
+           
+ booleanmatches(java.lang.Object o) + +
+          Evaluates the matcher for argument item.
+protected  booleanmatches(java.lang.Object o, + boolean shortcut) + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+AnyOf

+
+public AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object o)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Specified by:
matches in interface Matcher<T>
+
+
+
Parameters:
o - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Specified by:
describeTo in interface SelfDescribing
+
+
+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth,
+                                 Matcher<? super T> fifth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+anyOf

+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+                                 Matcher<? super T> second,
+                                 Matcher<? super T> third,
+                                 Matcher<? super T> fourth,
+                                 Matcher<? super T> fifth,
+                                 Matcher<? super T> sixth)
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers. +

+ For example: +

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+

+

+
+
+
+
+ +

+matches

+
+protected boolean matches(java.lang.Object o,
+                          boolean shortcut)
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description,
+                       java.lang.String operator)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html new file mode 100644 index 00000000..a4aa58cd --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html @@ -0,0 +1,255 @@ + + + + + + +CombinableMatcher.CombinableBothMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class CombinableMatcher.CombinableBothMatcher<X>

+
+java.lang.Object
+  extended by org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<X>
+
+
+
Enclosing class:
CombinableMatcher<T>
+
+
+
+
public static final class CombinableMatcher.CombinableBothMatcher<X>
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
CombinableMatcher.CombinableBothMatcher(Matcher<? super X> matcher) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ CombinableMatcher<X>and(Matcher<? super X> other) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CombinableMatcher.CombinableBothMatcher

+
+public CombinableMatcher.CombinableBothMatcher(Matcher<? super X> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+and

+
+public CombinableMatcher<X> and(Matcher<? super X> other)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html new file mode 100644 index 00000000..4981f839 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html @@ -0,0 +1,255 @@ + + + + + + +CombinableMatcher.CombinableEitherMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class CombinableMatcher.CombinableEitherMatcher<X>

+
+java.lang.Object
+  extended by org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher<X>
+
+
+
Enclosing class:
CombinableMatcher<T>
+
+
+
+
public static final class CombinableMatcher.CombinableEitherMatcher<X>
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
CombinableMatcher.CombinableEitherMatcher(Matcher<? super X> matcher) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ CombinableMatcher<X>or(Matcher<? super X> other) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CombinableMatcher.CombinableEitherMatcher

+
+public CombinableMatcher.CombinableEitherMatcher(Matcher<? super X> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+or

+
+public CombinableMatcher<X> or(Matcher<? super X> other)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.html new file mode 100644 index 00000000..88aa7dc2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/CombinableMatcher.html @@ -0,0 +1,433 @@ + + + + + + +CombinableMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class CombinableMatcher<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.core.CombinableMatcher<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class CombinableMatcher<T>
extends TypeSafeDiagnosingMatcher<T>
+ + +

+


+ +

+ + + + + + + + + + + + + + + +
+Nested Class Summary
+static classCombinableMatcher.CombinableBothMatcher<X> + +
+           
+static classCombinableMatcher.CombinableEitherMatcher<X> + +
+           
+  + + + + + + + + + + +
+Constructor Summary
CombinableMatcher(Matcher<? super T> matcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ CombinableMatcher<T>and(Matcher<? super T> other) + +
+           
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+protected  booleanmatchesSafely(T item, + Description mismatch) + +
+          Subclasses should implement this.
+ CombinableMatcher<T>or(Matcher<? super T> other) + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CombinableMatcher

+
+public CombinableMatcher(Matcher<? super T> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+protected boolean matchesSafely(T item,
+                                Description mismatch)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<T>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+and

+
+public CombinableMatcher<T> and(Matcher<? super T> other)
+
+
+
+
+
+
+ +

+or

+
+public CombinableMatcher<T> or(Matcher<? super T> other)
+
+
+
+
+
+
+ +

+both

+
+public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
+
+
Creates a matcher that matches when both of the specified matchers match the examined object. +

+ For example: +

assertThat("fab", both(containsString("a")).and(containsString("b")))
+

+

+
+
+
+
+ +

+either

+
+public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
+
+
Creates a matcher that matches when either of the specified matchers match the examined object. +

+ For example: +

assertThat("fan", either(containsString("a")).and(containsString("b")))
+

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/DescribedAs.html b/docs/javadoc/1.3/org/hamcrest/core/DescribedAs.html new file mode 100644 index 00000000..d120cc60 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/DescribedAs.html @@ -0,0 +1,373 @@ + + + + + + +DescribedAs (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class DescribedAs<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.DescribedAs<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class DescribedAs<T>
extends BaseMatcher<T>
+ + +

+Provides a custom description to another matcher. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
DescribedAs(java.lang.String descriptionTemplate, + Matcher<T> matcher, + java.lang.Object[] values) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> Matcher<T>
+
describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) + +
+          Wraps an existing matcher, overriding its description with that specified.
+ voiddescribeMismatch(java.lang.Object item, + Description description) + +
+          Generate a description of why the matcher has not accepted the item.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatches(java.lang.Object o) + +
+          Evaluates the matcher for argument item.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+DescribedAs

+
+public DescribedAs(java.lang.String descriptionTemplate,
+                   Matcher<T> matcher,
+                   java.lang.Object[] values)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object o)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
o - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+describeMismatch

+
+public void describeMismatch(java.lang.Object item,
+                             Description description)
+
+
Description copied from interface: Matcher
+
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 + will not check this. +

+

+
Specified by:
describeMismatch in interface Matcher<T>
Overrides:
describeMismatch in class BaseMatcher<T>
+
+
+
Parameters:
item - The item that the Matcher has rejected.
description - The description to be built or appended to.
+
+
+
+ +

+describedAs

+
+public static <T> Matcher<T> describedAs(java.lang.String description,
+                                         Matcher<T> matcher,
+                                         java.lang.Object... values)
+
+
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())
+

+

+
Parameters:
description - the new description for the wrapped matcher
matcher - the matcher to wrap
values - optional values to insert into the tokenised description
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/Every.html b/docs/javadoc/1.3/org/hamcrest/core/Every.html new file mode 100644 index 00000000..ddc96f99 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/Every.html @@ -0,0 +1,343 @@ + + + + + + +Every (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class Every<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<T>>
+          extended by org.hamcrest.core.Every<T>
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Iterable<T>>, SelfDescribing
+
+
+
+
public class Every<T>
extends TypeSafeDiagnosingMatcher<java.lang.Iterable<T>>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Every(Matcher<? super T> matcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<U> Matcher<java.lang.Iterable<U>>
+
everyItem(Matcher<U> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+ booleanmatchesSafely(java.lang.Iterable<T> collection, + Description mismatchDescription) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Every

+
+public Every(Matcher<? super T> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.Iterable<T> collection,
+                             Description mismatchDescription)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<T>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+everyItem

+
+public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. +

+ For example: +

assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
+

+

+
Parameters:
itemMatcher - the matcher to apply to every item provided by the examined Iterable
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/Is.html b/docs/javadoc/1.3/org/hamcrest/core/Is.html new file mode 100644 index 00000000..bcfff1c2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/Is.html @@ -0,0 +1,474 @@ + + + + + + +Is (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class Is<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.Is<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class Is<T>
extends BaseMatcher<T>
+ + +

+Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. + + For example: assertThat(cheese, equalTo(smelly)) + vs. assertThat(cheese, is(equalTo(smelly))) +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Is(Matcher<T> matcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatch(java.lang.Object item, + Description mismatchDescription) + +
+          Generate a description of why the matcher has not accepted the item.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<T>
+
is(java.lang.Class<T> type) + +
+          Deprecated. use isA(Class type) instead.
+static + + + + +
+<T> Matcher<T>
+
is(Matcher<T> matcher) + +
+          Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+static + + + + +
+<T> Matcher<T>
+
is(T value) + +
+          A shortcut to the frequently used is(equalTo(x)).
+static + + + + +
+<T> Matcher<T>
+
isA(java.lang.Class<T> type) + +
+          A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+ booleanmatches(java.lang.Object arg) + +
+          Evaluates the matcher for argument item.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Is

+
+public Is(Matcher<T> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object arg)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
arg - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+describeMismatch

+
+public void describeMismatch(java.lang.Object item,
+                             Description mismatchDescription)
+
+
Description copied from interface: Matcher
+
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 + will not check this. +

+

+
Specified by:
describeMismatch in interface Matcher<T>
Overrides:
describeMismatch in class BaseMatcher<T>
+
+
+
Parameters:
item - The item that the Matcher has rejected.
mismatchDescription - The description to be built or appended to.
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(Matcher<T> matcher)
+
+
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))
+

+

+
+
+
+
+ +

+is

+
+public static <T> Matcher<T> is(T value)
+
+
A shortcut to the frequently used is(equalTo(x)). +

+ For example: +

assertThat(cheese, is(smelly))
+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
+

+

+
+
+
+
+ +

+is

+
+@Deprecated
+public static <T> Matcher<T> is(java.lang.Class<T> type)
+
+
Deprecated. use isA(Class type) instead. +

+

A shortcut to the frequently used is(instanceOf(SomeClass.class)). +

+ For example: +

assertThat(cheese, is(Cheddar.class))
+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
+

+

+
+
+
+
+ +

+isA

+
+public static <T> Matcher<T> isA(java.lang.Class<T> type)
+
+
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)))
+

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/IsAnything.html b/docs/javadoc/1.3/org/hamcrest/core/IsAnything.html new file mode 100644 index 00000000..41e0bf71 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/IsAnything.html @@ -0,0 +1,360 @@ + + + + + + +IsAnything (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class IsAnything<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.IsAnything<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class IsAnything<T>
extends BaseMatcher<T>
+ + +

+A matcher that always returns true. +

+ +

+


+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
IsAnything() + +
+           
IsAnything(java.lang.String message) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static Matcher<java.lang.Object>anything() + +
+          Creates a matcher that always matches, regardless of the examined object.
+static Matcher<java.lang.Object>anything(java.lang.String description) + +
+          Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatches(java.lang.Object o) + +
+          Evaluates the matcher for argument item.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsAnything

+
+public IsAnything()
+
+
+
+ +

+IsAnything

+
+public IsAnything(java.lang.String message)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object o)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
o - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+anything

+
+public static Matcher<java.lang.Object> anything()
+
+
Creates a matcher that always matches, regardless of the examined object. +

+

+
+
+
+
+ +

+anything

+
+public static Matcher<java.lang.Object> anything(java.lang.String description)
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. +

+

+
Parameters:
description - a meaningful String used when describing itself
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/IsCollectionContaining.html b/docs/javadoc/1.3/org/hamcrest/core/IsCollectionContaining.html new file mode 100644 index 00000000..25ca4104 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/IsCollectionContaining.html @@ -0,0 +1,452 @@ + + + + + + +IsCollectionContaining (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class IsCollectionContaining<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>
+          extended by org.hamcrest.core.IsCollectionContaining<T>
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Iterable<? super T>>, SelfDescribing
+
+
+
+
public class IsCollectionContaining<T>
extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsCollectionContaining(Matcher<? super T> elementMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
hasItem(Matcher<? super T> itemMatcher) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+static + + + + +
+<T> Matcher<java.lang.Iterable<? super T>>
+
hasItem(T item) + +
+          Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
hasItems(Matcher<? super T>... itemMatchers) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+static + + + + +
+<T> Matcher<java.lang.Iterable<T>>
+
hasItems(T... items) + +
+          Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+protected  booleanmatchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsCollectionContaining

+
+public IsCollectionContaining(Matcher<? super T> elementMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+protected boolean matchesSafely(java.lang.Iterable<? super T> collection,
+                                Description mismatchDescription)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+hasItem

+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
+

+

+
Parameters:
itemMatcher - the matcher to apply to items provided by the examined Iterable
+
+
+
+ +

+hasItem

+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
+

+

+
Parameters:
item - the item to compare against the items provided by the examined Iterable
+
+
+
+ +

+hasItems

+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
+

+

+
Parameters:
itemMatchers - the matchers to apply to items provided by the examined Iterable
+
+
+
+ +

+hasItems

+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. +

+ For example: +

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
+

+

+
Parameters:
items - the items to compare against the items provided by the examined Iterable
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/IsEqual.html b/docs/javadoc/1.3/org/hamcrest/core/IsEqual.html new file mode 100644 index 00000000..857522d9 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/IsEqual.html @@ -0,0 +1,352 @@ + + + + + + +IsEqual (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class IsEqual<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.IsEqual<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class IsEqual<T>
extends BaseMatcher<T>
+ + +

+Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod? +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsEqual(T equalArg) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<T>
+
equalTo(T operand) + +
+          Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+ booleanmatches(java.lang.Object actualValue) + +
+          Evaluates the matcher for argument item.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsEqual

+
+public IsEqual(T equalArg)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object actualValue)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
actualValue - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+equalTo

+
+public static <T> Matcher<T> equalTo(T operand)
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

+

+ For example: +

+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ 
+

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/IsInstanceOf.html b/docs/javadoc/1.3/org/hamcrest/core/IsInstanceOf.html new file mode 100644 index 00000000..f2986c73 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/IsInstanceOf.html @@ -0,0 +1,390 @@ + + + + + + +IsInstanceOf (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class IsInstanceOf

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.DiagnosingMatcher<java.lang.Object>
+          extended by org.hamcrest.core.IsInstanceOf
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Object>, SelfDescribing
+
+
+
+
public class IsInstanceOf
extends DiagnosingMatcher<java.lang.Object>
+ + +

+Tests whether the value is an instance of a class. + Classes of basic types will be converted to the relevant "Object" classes +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsInstanceOf(java.lang.Class<?> expectedClass) + +
+          Creates a new instance of IsInstanceOf
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T> Matcher<T>
+
any(java.lang.Class<T> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T> Matcher<T>
+
instanceOf(java.lang.Class<?> type) + +
+          Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+protected  booleanmatches(java.lang.Object item, + Description mismatch) + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.DiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsInstanceOf

+
+public IsInstanceOf(java.lang.Class<?> expectedClass)
+
+
Creates a new instance of IsInstanceOf +

+

+
Parameters:
expectedClass - The predicate evaluates to true for instances of this class + or one of its subclasses.
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+protected boolean matches(java.lang.Object item,
+                          Description mismatch)
+
+
+
Specified by:
matches in class DiagnosingMatcher<java.lang.Object>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+instanceOf

+
+public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

+

+ For example: +

assertThat(new Canoe(), instanceOf(Paddlable.class));
+

+

+
+
+
+
+ +

+any

+
+public static <T> Matcher<T> any(java.lang.Class<T> type)
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
+

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/IsNot.html b/docs/javadoc/1.3/org/hamcrest/core/IsNot.html new file mode 100644 index 00000000..d9574e83 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/IsNot.html @@ -0,0 +1,368 @@ + + + + + + +IsNot (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class IsNot<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.IsNot<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class IsNot<T>
extends BaseMatcher<T>
+ + +

+Calculates the logical negation of a matcher. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsNot(Matcher<T> matcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatches(java.lang.Object arg) + +
+          Evaluates the matcher for argument item.
+static + + + + +
+<T> Matcher<T>
+
not(Matcher<T> matcher) + +
+          Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+static + + + + +
+<T> Matcher<T>
+
not(T value) + +
+          A shortcut to the frequently used not(equalTo(x)).
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsNot

+
+public IsNot(Matcher<T> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object arg)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
arg - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+not

+
+public static <T> Matcher<T> not(Matcher<T> matcher)
+
+
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))))
+

+

+
Parameters:
matcher - the matcher whose sense should be inverted
+
+
+
+ +

+not

+
+public static <T> Matcher<T> not(T value)
+
+
A shortcut to the frequently used not(equalTo(x)). +

+ For example: +

assertThat(cheese, is(not(smelly)))
+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
+

+

+
Parameters:
value - the value that any examined object should not equal
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/IsNull.html b/docs/javadoc/1.3/org/hamcrest/core/IsNull.html new file mode 100644 index 00000000..a1f30d65 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/IsNull.html @@ -0,0 +1,418 @@ + + + + + + +IsNull (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class IsNull<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.IsNull<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class IsNull<T>
extends BaseMatcher<T>
+ + +

+Is the value null? +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsNull() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatches(java.lang.Object o) + +
+          Evaluates the matcher for argument item.
+static Matcher<java.lang.Object>notNullValue() + +
+          A shortcut to the frequently used not(nullValue()).
+static + + + + +
+<T> Matcher<T>
+
notNullValue(java.lang.Class<T> type) + +
+          A shortcut to the frequently used not(nullValue(X.class)).
+static Matcher<java.lang.Object>nullValue() + +
+          Creates a matcher that matches if examined object is null.
+static + + + + +
+<T> Matcher<T>
+
nullValue(java.lang.Class<T> type) + +
+          Creates a matcher that matches if examined object is null.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsNull

+
+public IsNull()
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object o)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
o - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+nullValue

+
+public static Matcher<java.lang.Object> nullValue()
+
+
Creates a matcher that matches if examined object is null. +

+ For example: +

assertThat(cheese, is(nullValue())
+

+

+
+
+
+
+ +

+notNullValue

+
+public static Matcher<java.lang.Object> notNullValue()
+
+
A shortcut to the frequently used not(nullValue()). +

+ For example: +

assertThat(cheese, is(notNullValue()))
+ instead of: +
assertThat(cheese, is(not(nullValue())))
+

+

+
+
+
+
+ +

+nullValue

+
+public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
+
+
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))
+

+

+
Parameters:
type - dummy parameter used to infer the generic type of the returned matcher
+
+
+
+ +

+notNullValue

+
+public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
+
+
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))))
+

+

+
Parameters:
type - dummy parameter used to infer the generic type of the returned matcher
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/IsSame.html b/docs/javadoc/1.3/org/hamcrest/core/IsSame.html new file mode 100644 index 00000000..8a4f32b7 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/IsSame.html @@ -0,0 +1,362 @@ + + + + + + +IsSame (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class IsSame<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.core.IsSame<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class IsSame<T>
extends BaseMatcher<T>
+ + +

+Is the value the same object as another value? +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsSame(T object) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatches(java.lang.Object arg) + +
+          Evaluates the matcher for argument item.
+static + + + + +
+<T> Matcher<T>
+
sameInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+static + + + + +
+<T> Matcher<T>
+
theInstance(T target) + +
+          Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsSame

+
+public IsSame(T object)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object arg)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
arg - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+sameInstance

+
+public static <T> Matcher<T> sameInstance(T target)
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +

+

+
Parameters:
target - the target instance against which others should be assessed
+
+
+
+ +

+theInstance

+
+public static <T> Matcher<T> theInstance(T target)
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object. +

+

+
Parameters:
target - the target instance against which others should be assessed
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/StringContains.html b/docs/javadoc/1.3/org/hamcrest/core/StringContains.html new file mode 100644 index 00000000..1f044d14 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/StringContains.html @@ -0,0 +1,358 @@ + + + + + + +StringContains (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class StringContains

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
+          extended by org.hamcrest.core.SubstringMatcher
+              extended by org.hamcrest.core.StringContains
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
+
public class StringContains
extends SubstringMatcher
+ + +

+Tests if the argument is a string that contains a substring. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class org.hamcrest.core.SubstringMatcher
substring
+  + + + + + + + + + + +
+Constructor Summary
StringContains(java.lang.String substring) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static Matcher<java.lang.String>containsString(java.lang.String substring) + +
+          Creates a matcher that matches if the examined String contains the specified + String anywhere.
+protected  booleanevalSubstringOf(java.lang.String s) + +
+           
+protected  java.lang.Stringrelationship() + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.core.SubstringMatcher
describeMismatchSafely, describeTo, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StringContains

+
+public StringContains(java.lang.String substring)
+
+
+ + + + + + + + +
+Method Detail
+ +

+evalSubstringOf

+
+protected boolean evalSubstringOf(java.lang.String s)
+
+
+
Specified by:
evalSubstringOf in class SubstringMatcher
+
+
+
+
+
+
+ +

+relationship

+
+protected java.lang.String relationship()
+
+
+
Specified by:
relationship in class SubstringMatcher
+
+
+
+
+
+
+ +

+containsString

+
+public static Matcher<java.lang.String> containsString(java.lang.String substring)
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere. +

+ For example: +

assertThat("myStringOfNote", containsString("ring"))
+

+

+
Parameters:
substring - the substring that the returned matcher will expect to find within any examined string
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/StringEndsWith.html b/docs/javadoc/1.3/org/hamcrest/core/StringEndsWith.html new file mode 100644 index 00000000..b8c39c0c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/StringEndsWith.html @@ -0,0 +1,358 @@ + + + + + + +StringEndsWith (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class StringEndsWith

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
+          extended by org.hamcrest.core.SubstringMatcher
+              extended by org.hamcrest.core.StringEndsWith
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
+
public class StringEndsWith
extends SubstringMatcher
+ + +

+Tests if the argument is a string that contains a substring. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class org.hamcrest.core.SubstringMatcher
substring
+  + + + + + + + + + + +
+Constructor Summary
StringEndsWith(java.lang.String substring) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static Matcher<java.lang.String>endsWith(java.lang.String suffix) + +
+          Creates a matcher that matches if the examined String ends with the specified + String.
+protected  booleanevalSubstringOf(java.lang.String s) + +
+           
+protected  java.lang.Stringrelationship() + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.core.SubstringMatcher
describeMismatchSafely, describeTo, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StringEndsWith

+
+public StringEndsWith(java.lang.String substring)
+
+
+ + + + + + + + +
+Method Detail
+ +

+evalSubstringOf

+
+protected boolean evalSubstringOf(java.lang.String s)
+
+
+
Specified by:
evalSubstringOf in class SubstringMatcher
+
+
+
+
+
+
+ +

+relationship

+
+protected java.lang.String relationship()
+
+
+
Specified by:
relationship in class SubstringMatcher
+
+
+
+
+
+
+ +

+endsWith

+
+public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
+
+
Creates a matcher that matches if the examined String ends with the specified + String. +

+ For example: +

assertThat("myStringOfNote", endsWith("Note"))
+

+

+
Parameters:
suffix - the substring that the returned matcher will expect at the end of any examined string
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/StringStartsWith.html b/docs/javadoc/1.3/org/hamcrest/core/StringStartsWith.html new file mode 100644 index 00000000..e334cc83 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/StringStartsWith.html @@ -0,0 +1,358 @@ + + + + + + +StringStartsWith (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class StringStartsWith

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
+          extended by org.hamcrest.core.SubstringMatcher
+              extended by org.hamcrest.core.StringStartsWith
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
+
public class StringStartsWith
extends SubstringMatcher
+ + +

+Tests if the argument is a string that contains a substring. +

+ +

+


+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class org.hamcrest.core.SubstringMatcher
substring
+  + + + + + + + + + + +
+Constructor Summary
StringStartsWith(java.lang.String substring) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected  booleanevalSubstringOf(java.lang.String s) + +
+           
+protected  java.lang.Stringrelationship() + +
+           
+static Matcher<java.lang.String>startsWith(java.lang.String prefix) + +
+          Creates a matcher that matches if the examined String starts with the specified + String.
+ + + + + + + +
Methods inherited from class org.hamcrest.core.SubstringMatcher
describeMismatchSafely, describeTo, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StringStartsWith

+
+public StringStartsWith(java.lang.String substring)
+
+
+ + + + + + + + +
+Method Detail
+ +

+evalSubstringOf

+
+protected boolean evalSubstringOf(java.lang.String s)
+
+
+
Specified by:
evalSubstringOf in class SubstringMatcher
+
+
+
+
+
+
+ +

+relationship

+
+protected java.lang.String relationship()
+
+
+
Specified by:
relationship in class SubstringMatcher
+
+
+
+
+
+
+ +

+startsWith

+
+public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
+
+
Creates a matcher that matches if the examined String starts with the specified + String. +

+ For example: +

assertThat("myStringOfNote", startsWith("my"))
+

+

+
Parameters:
prefix - the substring that the returned matcher will expect at the start of any examined string
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/SubstringMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/SubstringMatcher.html new file mode 100644 index 00000000..4fd64d41 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/SubstringMatcher.html @@ -0,0 +1,413 @@ + + + + + + +SubstringMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.core +
+Class SubstringMatcher

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
+          extended by org.hamcrest.core.SubstringMatcher
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
Direct Known Subclasses:
StringContains, StringEndsWith, StringStartsWith
+
+
+
+
public abstract class SubstringMatcher
extends TypeSafeMatcher<java.lang.String>
+ + +

+


+ +

+ + + + + + + + + + + +
+Field Summary
+protected  java.lang.Stringsubstring + +
+           
+  + + + + + + + + + + + +
+Constructor Summary
+protected SubstringMatcher(java.lang.String substring) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+protected abstract  booleanevalSubstringOf(java.lang.String string) + +
+           
+ booleanmatchesSafely(java.lang.String item) + +
+          Subclasses should implement this.
+protected abstract  java.lang.Stringrelationship() + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+substring

+
+protected final java.lang.String substring
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+SubstringMatcher

+
+protected SubstringMatcher(java.lang.String substring)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.String item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.lang.String item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+evalSubstringOf

+
+protected abstract boolean evalSubstringOf(java.lang.String string)
+
+
+
+
+
+
+ +

+relationship

+
+protected abstract java.lang.String relationship()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/AllOf.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/AllOf.html new file mode 100644 index 00000000..6554c1df --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/AllOf.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.AllOf (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.AllOf

+
+No usage of org.hamcrest.core.AllOf +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/AnyOf.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/AnyOf.html new file mode 100644 index 00000000..b23820ed --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/AnyOf.html @@ -0,0 +1,553 @@ + + + + + + +Uses of Class org.hamcrest.core.AnyOf (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.AnyOf

+
+ + + + + + + + + + + + + +
+Packages that use AnyOf
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
+  +

+ + + + + +
+Uses of AnyOf in org.hamcrest
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest that return AnyOf
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
Matchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
CoreMatchers.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+  +

+ + + + + +
+Uses of AnyOf in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.core that return AnyOf
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(java.lang.Iterable<Matcher<? super T>> matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<? super T>... matchers) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+static + + + + +
+<T> AnyOf<T>
+
AnyOf.anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) + +
+          Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.CombinableBothMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.CombinableBothMatcher.html new file mode 100644 index 00000000..729bc2a8 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.CombinableBothMatcher.html @@ -0,0 +1,238 @@ + + + + + + +Uses of Class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.CombinableMatcher.CombinableBothMatcher

+
+ + + + + + + + + + + + + +
+Packages that use CombinableMatcher.CombinableBothMatcher
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
+  +

+ + + + + +
+Uses of CombinableMatcher.CombinableBothMatcher in org.hamcrest
+  +

+ + + + + + + + + + + + + +
Methods in org.hamcrest that return CombinableMatcher.CombinableBothMatcher
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
Matchers.both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
CoreMatchers.both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+  +

+ + + + + +
+Uses of CombinableMatcher.CombinableBothMatcher in org.hamcrest.core
+  +

+ + + + + + + + + +
Methods in org.hamcrest.core that return CombinableMatcher.CombinableBothMatcher
+static + + + + +
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+
CombinableMatcher.both(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when both of the specified matchers match the examined object.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.CombinableEitherMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.CombinableEitherMatcher.html new file mode 100644 index 00000000..932603a3 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.CombinableEitherMatcher.html @@ -0,0 +1,238 @@ + + + + + + +Uses of Class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher

+
+ + + + + + + + + + + + + +
+Packages that use CombinableMatcher.CombinableEitherMatcher
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
+  +

+ + + + + +
+Uses of CombinableMatcher.CombinableEitherMatcher in org.hamcrest
+  +

+ + + + + + + + + + + + + +
Methods in org.hamcrest that return CombinableMatcher.CombinableEitherMatcher
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
Matchers.either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
CoreMatchers.either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+  +

+ + + + + +
+Uses of CombinableMatcher.CombinableEitherMatcher in org.hamcrest.core
+  +

+ + + + + + + + + +
Methods in org.hamcrest.core that return CombinableMatcher.CombinableEitherMatcher
+static + + + + +
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+
CombinableMatcher.either(Matcher<? super LHS> matcher) + +
+          Creates a matcher that matches when either of the specified matchers match the examined object.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.html new file mode 100644 index 00000000..cc3197ab --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/CombinableMatcher.html @@ -0,0 +1,204 @@ + + + + + + +Uses of Class org.hamcrest.core.CombinableMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.CombinableMatcher

+
+ + + + + + + + + +
+Packages that use CombinableMatcher
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
+  +

+ + + + + +
+Uses of CombinableMatcher in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Methods in org.hamcrest.core that return CombinableMatcher
+ CombinableMatcher<T>CombinableMatcher.and(Matcher<? super T> other) + +
+           
+ CombinableMatcher<X>CombinableMatcher.CombinableBothMatcher.and(Matcher<? super X> other) + +
+           
+ CombinableMatcher<T>CombinableMatcher.or(Matcher<? super T> other) + +
+           
+ CombinableMatcher<X>CombinableMatcher.CombinableEitherMatcher.or(Matcher<? super X> other) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/DescribedAs.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/DescribedAs.html new file mode 100644 index 00000000..097ed668 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/DescribedAs.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.DescribedAs (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.DescribedAs

+
+No usage of org.hamcrest.core.DescribedAs +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/Every.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/Every.html new file mode 100644 index 00000000..ab3a804d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/Every.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.Every (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.Every

+
+No usage of org.hamcrest.core.Every +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/Is.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/Is.html new file mode 100644 index 00000000..9cc6c083 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/Is.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.Is (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.Is

+
+No usage of org.hamcrest.core.Is +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/IsAnything.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsAnything.html new file mode 100644 index 00000000..22c10c8c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsAnything.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.IsAnything (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.IsAnything

+
+No usage of org.hamcrest.core.IsAnything +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/IsCollectionContaining.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsCollectionContaining.html new file mode 100644 index 00000000..fb54db59 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsCollectionContaining.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.IsCollectionContaining (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.IsCollectionContaining

+
+No usage of org.hamcrest.core.IsCollectionContaining +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/IsEqual.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsEqual.html new file mode 100644 index 00000000..d809056f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsEqual.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.IsEqual (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.IsEqual

+
+No usage of org.hamcrest.core.IsEqual +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/IsInstanceOf.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsInstanceOf.html new file mode 100644 index 00000000..776bdae0 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsInstanceOf.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.IsInstanceOf (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.IsInstanceOf

+
+No usage of org.hamcrest.core.IsInstanceOf +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/IsNot.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsNot.html new file mode 100644 index 00000000..58e54ff2 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsNot.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.IsNot (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.IsNot

+
+No usage of org.hamcrest.core.IsNot +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/IsNull.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsNull.html new file mode 100644 index 00000000..467f7fec --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsNull.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.IsNull (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.IsNull

+
+No usage of org.hamcrest.core.IsNull +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/IsSame.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsSame.html new file mode 100644 index 00000000..7d6828f5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/IsSame.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.IsSame (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.IsSame

+
+No usage of org.hamcrest.core.IsSame +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/StringContains.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/StringContains.html new file mode 100644 index 00000000..b943fa21 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/StringContains.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.StringContains (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.StringContains

+
+No usage of org.hamcrest.core.StringContains +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/StringEndsWith.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/StringEndsWith.html new file mode 100644 index 00000000..aa528f8c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/StringEndsWith.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.StringEndsWith (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.StringEndsWith

+
+No usage of org.hamcrest.core.StringEndsWith +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/StringStartsWith.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/StringStartsWith.html new file mode 100644 index 00000000..4ad6fd67 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/StringStartsWith.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.core.StringStartsWith (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.StringStartsWith

+
+No usage of org.hamcrest.core.StringStartsWith +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/class-use/SubstringMatcher.html b/docs/javadoc/1.3/org/hamcrest/core/class-use/SubstringMatcher.html new file mode 100644 index 00000000..eb41e08d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/class-use/SubstringMatcher.html @@ -0,0 +1,196 @@ + + + + + + +Uses of Class org.hamcrest.core.SubstringMatcher (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.core.SubstringMatcher

+
+ + + + + + + + + +
+Packages that use SubstringMatcher
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
+  +

+ + + + + +
+Uses of SubstringMatcher in org.hamcrest.core
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of SubstringMatcher in org.hamcrest.core
+ classStringContains + +
+          Tests if the argument is a string that contains a substring.
+ classStringEndsWith + +
+          Tests if the argument is a string that contains a substring.
+ classStringStartsWith + +
+          Tests if the argument is a string that contains a substring.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/package-frame.html b/docs/javadoc/1.3/org/hamcrest/core/package-frame.html new file mode 100644 index 00000000..f88aa74b --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/package-frame.html @@ -0,0 +1,68 @@ + + + + + + +org.hamcrest.core (Hamcrest) + + + + + + + + + + + +org.hamcrest.core + + + + +
+Classes  + +
+AllOf +
+AnyOf +
+CombinableMatcher +
+CombinableMatcher.CombinableBothMatcher +
+CombinableMatcher.CombinableEitherMatcher +
+DescribedAs +
+Every +
+Is +
+IsAnything +
+IsCollectionContaining +
+IsEqual +
+IsInstanceOf +
+IsNot +
+IsNull +
+IsSame +
+StringContains +
+StringEndsWith +
+StringStartsWith +
+SubstringMatcher
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/package-summary.html b/docs/javadoc/1.3/org/hamcrest/core/package-summary.html new file mode 100644 index 00000000..9f7a6374 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/package-summary.html @@ -0,0 +1,246 @@ + + + + + + +org.hamcrest.core (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.core +

+Fundamental matchers of objects and values, and composite matchers. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
AllOf<T>Calculates the logical conjunction of multiple matchers.
AnyOf<T>Calculates the logical disjunction of multiple matchers.
CombinableMatcher<T> 
CombinableMatcher.CombinableBothMatcher<X> 
CombinableMatcher.CombinableEitherMatcher<X> 
DescribedAs<T>Provides a custom description to another matcher.
Every<T> 
Is<T>Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
IsAnything<T>A matcher that always returns true.
IsCollectionContaining<T> 
IsEqual<T>Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
IsInstanceOfTests whether the value is an instance of a class.
IsNot<T>Calculates the logical negation of a matcher.
IsNull<T>Is the value null?
IsSame<T>Is the value the same object as another value?
StringContainsTests if the argument is a string that contains a substring.
StringEndsWithTests if the argument is a string that contains a substring.
StringStartsWithTests if the argument is a string that contains a substring.
SubstringMatcher 
+  + +

+

+Package org.hamcrest.core Description +

+ +

+

Fundamental matchers of objects and values, and composite matchers.

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/package-tree.html b/docs/javadoc/1.3/org/hamcrest/core/package-tree.html new file mode 100644 index 00000000..c1086a5b --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/package-tree.html @@ -0,0 +1,164 @@ + + + + + + +org.hamcrest.core Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.core +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/core/package-use.html b/docs/javadoc/1.3/org/hamcrest/core/package-use.html new file mode 100644 index 00000000..65f2c813 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/core/package-use.html @@ -0,0 +1,225 @@ + + + + + + +Uses of Package org.hamcrest.core (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.core

+
+ + + + + + + + + + + + + +
+Packages that use org.hamcrest.core
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
+  +

+ + + + + + + + + + + + + + +
+Classes in org.hamcrest.core used by org.hamcrest
AnyOf + +
+          Calculates the logical disjunction of multiple matchers.
CombinableMatcher.CombinableBothMatcher + +
+           
CombinableMatcher.CombinableEitherMatcher + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest.core used by org.hamcrest.core
AnyOf + +
+          Calculates the logical disjunction of multiple matchers.
CombinableMatcher + +
+           
CombinableMatcher.CombinableBothMatcher + +
+           
CombinableMatcher.CombinableEitherMatcher + +
+           
SubstringMatcher + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/EasyMock2Adapter.html b/docs/javadoc/1.3/org/hamcrest/integration/EasyMock2Adapter.html new file mode 100644 index 00000000..ac9206ce --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/EasyMock2Adapter.html @@ -0,0 +1,319 @@ + + + + + + +EasyMock2Adapter (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.integration +
+Class EasyMock2Adapter

+
+java.lang.Object
+  extended by org.hamcrest.integration.EasyMock2Adapter
+
+
+
All Implemented Interfaces:
org.easymock.IArgumentMatcher
+
+
+
+
public class EasyMock2Adapter
extends java.lang.Object
implements org.easymock.IArgumentMatcher
+ + +

+An adapter allowing a Hamcrest Matcher + to act as an EasyMock IArgumentMatcher. +

+ +

+

+
Author:
+
Joe Walnes
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
EasyMock2Adapter(Matcher<?> matcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static org.easymock.IArgumentMatcheradapt(Matcher<?> matcher) + +
+          Convenience factory method that will adapt a + Hamcrest Matcher to act as an + EasyMock IArgumentMatcher and + report it to EasyMock so it can be kept track of.
+ voidappendTo(java.lang.StringBuffer buffer) + +
+           
+ booleanmatches(java.lang.Object argument) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+EasyMock2Adapter

+
+public EasyMock2Adapter(Matcher<?> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+adapt

+
+public static org.easymock.IArgumentMatcher adapt(Matcher<?> matcher)
+
+
Convenience factory method that will adapt a + Hamcrest Matcher to act as an + EasyMock IArgumentMatcher and + report it to EasyMock so it can be kept track of. +

+

+
+
+
+
+
+
+
+ +

+matches

+
+public boolean matches(java.lang.Object argument)
+
+
+
Specified by:
matches in interface org.easymock.IArgumentMatcher
+
+
+
+
+
+
+ +

+appendTo

+
+public void appendTo(java.lang.StringBuffer buffer)
+
+
+
Specified by:
appendTo in interface org.easymock.IArgumentMatcher
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/JMock1Adapter.html b/docs/javadoc/1.3/org/hamcrest/integration/JMock1Adapter.html new file mode 100644 index 00000000..5ecf2eaa --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/JMock1Adapter.html @@ -0,0 +1,319 @@ + + + + + + +JMock1Adapter (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.integration +
+Class JMock1Adapter

+
+java.lang.Object
+  extended by org.hamcrest.integration.JMock1Adapter
+
+
+
All Implemented Interfaces:
org.jmock.core.Constraint, org.jmock.core.SelfDescribing
+
+
+
+
public class JMock1Adapter
extends java.lang.Object
implements org.jmock.core.Constraint
+ + +

+An adapter allowing a Hamcrest Matcher + to act as an jMock1 Constraint. + Note, this is not necessary for jMock2 as it supports Hamcrest + out of the box. +

+ +

+

+
Author:
+
Joe Walnes
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JMock1Adapter(Matcher<?> matcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static org.jmock.core.Constraintadapt(Matcher<?> matcher) + +
+          Convenience factory method that will adapt a + Hamcrest Matcher to act as an + jMock Constraint.
+ java.lang.StringBufferdescribeTo(java.lang.StringBuffer buffer) + +
+           
+ booleaneval(java.lang.Object o) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JMock1Adapter

+
+public JMock1Adapter(Matcher<?> matcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+adapt

+
+public static org.jmock.core.Constraint adapt(Matcher<?> matcher)
+
+
Convenience factory method that will adapt a + Hamcrest Matcher to act as an + jMock Constraint. +

+

+
+
+
+
+
+
+
+ +

+eval

+
+public boolean eval(java.lang.Object o)
+
+
+
Specified by:
eval in interface org.jmock.core.Constraint
+
+
+
+
+
+
+ +

+describeTo

+
+public java.lang.StringBuffer describeTo(java.lang.StringBuffer buffer)
+
+
+
Specified by:
describeTo in interface org.jmock.core.SelfDescribing
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/class-use/EasyMock2Adapter.html b/docs/javadoc/1.3/org/hamcrest/integration/class-use/EasyMock2Adapter.html new file mode 100644 index 00000000..213ea095 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/class-use/EasyMock2Adapter.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.integration.EasyMock2Adapter (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.integration.EasyMock2Adapter

+
+No usage of org.hamcrest.integration.EasyMock2Adapter +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/class-use/JMock1Adapter.html b/docs/javadoc/1.3/org/hamcrest/integration/class-use/JMock1Adapter.html new file mode 100644 index 00000000..bbf52063 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/class-use/JMock1Adapter.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.integration.JMock1Adapter (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.integration.JMock1Adapter

+
+No usage of org.hamcrest.integration.JMock1Adapter +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/package-frame.html b/docs/javadoc/1.3/org/hamcrest/integration/package-frame.html new file mode 100644 index 00000000..f4df61ce --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/package-frame.html @@ -0,0 +1,34 @@ + + + + + + +org.hamcrest.integration (Hamcrest) + + + + + + + + + + + +org.hamcrest.integration + + + + +
+Classes  + +
+EasyMock2Adapter +
+JMock1Adapter
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/package-summary.html b/docs/javadoc/1.3/org/hamcrest/integration/package-summary.html new file mode 100644 index 00000000..60220711 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/package-summary.html @@ -0,0 +1,163 @@ + + + + + + +org.hamcrest.integration (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.integration +

+ + + + + + + + + + + + + +
+Class Summary
EasyMock2AdapterAn adapter allowing a Hamcrest Matcher + to act as an EasyMock IArgumentMatcher.
JMock1AdapterAn adapter allowing a Hamcrest Matcher + to act as an jMock1 Constraint.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/package-tree.html b/docs/javadoc/1.3/org/hamcrest/integration/package-tree.html new file mode 100644 index 00000000..c51cd315 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/package-tree.html @@ -0,0 +1,155 @@ + + + + + + +org.hamcrest.integration Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.integration +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • org.hamcrest.integration.EasyMock2Adapter (implements org.easymock.IArgumentMatcher) +
    • org.hamcrest.integration.JMock1Adapter (implements org.jmock.core.Constraint) +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/integration/package-use.html b/docs/javadoc/1.3/org/hamcrest/integration/package-use.html new file mode 100644 index 00000000..5acbf1cd --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/integration/package-use.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Package org.hamcrest.integration (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.integration

+
+No usage of org.hamcrest.integration +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/ArrayIterator.html b/docs/javadoc/1.3/org/hamcrest/internal/ArrayIterator.html new file mode 100644 index 00000000..ca7fb70f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/ArrayIterator.html @@ -0,0 +1,302 @@ + + + + + + +ArrayIterator (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.internal +
+Class ArrayIterator

+
+java.lang.Object
+  extended by org.hamcrest.internal.ArrayIterator
+
+
+
All Implemented Interfaces:
java.util.Iterator<java.lang.Object>
+
+
+
+
public class ArrayIterator
extends java.lang.Object
implements java.util.Iterator<java.lang.Object>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
ArrayIterator(java.lang.Object array) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanhasNext() + +
+           
+ java.lang.Objectnext() + +
+           
+ voidremove() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ArrayIterator

+
+public ArrayIterator(java.lang.Object array)
+
+
+ + + + + + + + +
+Method Detail
+ +

+hasNext

+
+public boolean hasNext()
+
+
+
Specified by:
hasNext in interface java.util.Iterator<java.lang.Object>
+
+
+
+
+
+
+ +

+next

+
+public java.lang.Object next()
+
+
+
Specified by:
next in interface java.util.Iterator<java.lang.Object>
+
+
+
+
+
+
+ +

+remove

+
+public void remove()
+
+
+
Specified by:
remove in interface java.util.Iterator<java.lang.Object>
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/ReflectiveTypeFinder.html b/docs/javadoc/1.3/org/hamcrest/internal/ReflectiveTypeFinder.html new file mode 100644 index 00000000..75c3746e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/ReflectiveTypeFinder.html @@ -0,0 +1,296 @@ + + + + + + +ReflectiveTypeFinder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.internal +
+Class ReflectiveTypeFinder

+
+java.lang.Object
+  extended by org.hamcrest.internal.ReflectiveTypeFinder
+
+
+
+
public class ReflectiveTypeFinder
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
ReflectiveTypeFinder(java.lang.String methodName, + int expectedNumberOfParameters, + int typedParameter) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected  booleancanObtainExpectedTypeFrom(java.lang.reflect.Method method) + +
+           
+protected  java.lang.Class<?>expectedTypeFrom(java.lang.reflect.Method method) + +
+           
+ java.lang.Class<?>findExpectedType(java.lang.Class<?> fromClass) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ReflectiveTypeFinder

+
+public ReflectiveTypeFinder(java.lang.String methodName,
+                            int expectedNumberOfParameters,
+                            int typedParameter)
+
+
+ + + + + + + + +
+Method Detail
+ +

+findExpectedType

+
+public java.lang.Class<?> findExpectedType(java.lang.Class<?> fromClass)
+
+
+
+
+
+
+ +

+canObtainExpectedTypeFrom

+
+protected boolean canObtainExpectedTypeFrom(java.lang.reflect.Method method)
+
+
+
Parameters:
method - The method to examine. +
Returns:
true if this method references the relevant type
+
+
+
+ +

+expectedTypeFrom

+
+protected java.lang.Class<?> expectedTypeFrom(java.lang.reflect.Method method)
+
+
+
Parameters:
method - The method from which to extract +
Returns:
The type we're looking for
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/SelfDescribingValue.html b/docs/javadoc/1.3/org/hamcrest/internal/SelfDescribingValue.html new file mode 100644 index 00000000..f3b2f044 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/SelfDescribingValue.html @@ -0,0 +1,263 @@ + + + + + + +SelfDescribingValue (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.internal +
+Class SelfDescribingValue<T>

+
+java.lang.Object
+  extended by org.hamcrest.internal.SelfDescribingValue<T>
+
+
+
All Implemented Interfaces:
SelfDescribing
+
+
+
+
public class SelfDescribingValue<T>
extends java.lang.Object
implements SelfDescribing
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
SelfDescribingValue(T value) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SelfDescribingValue

+
+public SelfDescribingValue(T value)
+
+
+ + + + + + + + +
+Method Detail
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Specified by:
describeTo in interface SelfDescribing
+
+
+
Parameters:
description - The description to be built or appended to.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/SelfDescribingValueIterator.html b/docs/javadoc/1.3/org/hamcrest/internal/SelfDescribingValueIterator.html new file mode 100644 index 00000000..a5274b34 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/SelfDescribingValueIterator.html @@ -0,0 +1,302 @@ + + + + + + +SelfDescribingValueIterator (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.internal +
+Class SelfDescribingValueIterator<T>

+
+java.lang.Object
+  extended by org.hamcrest.internal.SelfDescribingValueIterator<T>
+
+
+
All Implemented Interfaces:
java.util.Iterator<SelfDescribing>
+
+
+
+
public class SelfDescribingValueIterator<T>
extends java.lang.Object
implements java.util.Iterator<SelfDescribing>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
SelfDescribingValueIterator(java.util.Iterator<T> values) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanhasNext() + +
+           
+ SelfDescribingnext() + +
+           
+ voidremove() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+SelfDescribingValueIterator

+
+public SelfDescribingValueIterator(java.util.Iterator<T> values)
+
+
+ + + + + + + + +
+Method Detail
+ +

+hasNext

+
+public boolean hasNext()
+
+
+
Specified by:
hasNext in interface java.util.Iterator<SelfDescribing>
+
+
+
+
+
+
+ +

+next

+
+public SelfDescribing next()
+
+
+
Specified by:
next in interface java.util.Iterator<SelfDescribing>
+
+
+
+
+
+
+ +

+remove

+
+public void remove()
+
+
+
Specified by:
remove in interface java.util.Iterator<SelfDescribing>
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/class-use/ArrayIterator.html b/docs/javadoc/1.3/org/hamcrest/internal/class-use/ArrayIterator.html new file mode 100644 index 00000000..580dc79f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/class-use/ArrayIterator.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.internal.ArrayIterator (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.internal.ArrayIterator

+
+No usage of org.hamcrest.internal.ArrayIterator +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/class-use/ReflectiveTypeFinder.html b/docs/javadoc/1.3/org/hamcrest/internal/class-use/ReflectiveTypeFinder.html new file mode 100644 index 00000000..cb3d2f58 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/class-use/ReflectiveTypeFinder.html @@ -0,0 +1,186 @@ + + + + + + +Uses of Class org.hamcrest.internal.ReflectiveTypeFinder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.internal.ReflectiveTypeFinder

+
+ + + + + + + + + +
+Packages that use ReflectiveTypeFinder
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
+  +

+ + + + + +
+Uses of ReflectiveTypeFinder in org.hamcrest
+  +

+ + + + + + + + + + + +
Constructors in org.hamcrest with parameters of type ReflectiveTypeFinder
TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder) + +
+          Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
TypeSafeMatcher(ReflectiveTypeFinder typeFinder) + +
+          Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/class-use/SelfDescribingValue.html b/docs/javadoc/1.3/org/hamcrest/internal/class-use/SelfDescribingValue.html new file mode 100644 index 00000000..0e048cce --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/class-use/SelfDescribingValue.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.internal.SelfDescribingValue (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.internal.SelfDescribingValue

+
+No usage of org.hamcrest.internal.SelfDescribingValue +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/class-use/SelfDescribingValueIterator.html b/docs/javadoc/1.3/org/hamcrest/internal/class-use/SelfDescribingValueIterator.html new file mode 100644 index 00000000..851d2f41 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/class-use/SelfDescribingValueIterator.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.internal.SelfDescribingValueIterator (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.internal.SelfDescribingValueIterator

+
+No usage of org.hamcrest.internal.SelfDescribingValueIterator +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/package-frame.html b/docs/javadoc/1.3/org/hamcrest/internal/package-frame.html new file mode 100644 index 00000000..b5d9e134 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/package-frame.html @@ -0,0 +1,38 @@ + + + + + + +org.hamcrest.internal (Hamcrest) + + + + + + + + + + + +org.hamcrest.internal + + + + +
+Classes  + +
+ArrayIterator +
+ReflectiveTypeFinder +
+SelfDescribingValue +
+SelfDescribingValueIterator
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/package-summary.html b/docs/javadoc/1.3/org/hamcrest/internal/package-summary.html new file mode 100644 index 00000000..af143cac --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/package-summary.html @@ -0,0 +1,169 @@ + + + + + + +org.hamcrest.internal (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.internal +

+ + + + + + + + + + + + + + + + + + + + + +
+Class Summary
ArrayIterator 
ReflectiveTypeFinder 
SelfDescribingValue<T> 
SelfDescribingValueIterator<T> 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/package-tree.html b/docs/javadoc/1.3/org/hamcrest/internal/package-tree.html new file mode 100644 index 00000000..56218cce --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/package-tree.html @@ -0,0 +1,156 @@ + + + + + + +org.hamcrest.internal Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.internal +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/internal/package-use.html b/docs/javadoc/1.3/org/hamcrest/internal/package-use.html new file mode 100644 index 00000000..8d374ed7 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/internal/package-use.html @@ -0,0 +1,170 @@ + + + + + + +Uses of Package org.hamcrest.internal (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.internal

+
+ + + + + + + + + +
+Packages that use org.hamcrest.internal
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
+  +

+ + + + + + + + +
+Classes in org.hamcrest.internal used by org.hamcrest
ReflectiveTypeFinder + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/BigDecimalCloseTo.html b/docs/javadoc/1.3/org/hamcrest/number/BigDecimalCloseTo.html new file mode 100644 index 00000000..01a46329 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/BigDecimalCloseTo.html @@ -0,0 +1,365 @@ + + + + + + +BigDecimalCloseTo (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.number +
+Class BigDecimalCloseTo

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.math.BigDecimal>
+          extended by org.hamcrest.number.BigDecimalCloseTo
+
+
+
All Implemented Interfaces:
Matcher<java.math.BigDecimal>, SelfDescribing
+
+
+
+
public class BigDecimalCloseTo
extends TypeSafeMatcher<java.math.BigDecimal>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
BigDecimalCloseTo(java.math.BigDecimal value, + java.math.BigDecimal error) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static Matcher<java.math.BigDecimal>closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error) + +
+          Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+ voiddescribeMismatchSafely(java.math.BigDecimal item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatchesSafely(java.math.BigDecimal item) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+BigDecimalCloseTo

+
+public BigDecimalCloseTo(java.math.BigDecimal value,
+                         java.math.BigDecimal error)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.math.BigDecimal item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.math.BigDecimal>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.math.BigDecimal item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.math.BigDecimal>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+closeTo

+
+public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand,
+                                                    java.math.BigDecimal error)
+
+
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. The comparison for equality + is done by BigDecimals BigDecimal.compareTo(java.math.BigDecimal) method. +

+ For example: +

assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
+

+

+
Parameters:
operand - the expected value of matching BigDecimals
error - the delta (+/-) within which matches will be allowed
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/IsCloseTo.html b/docs/javadoc/1.3/org/hamcrest/number/IsCloseTo.html new file mode 100644 index 00000000..2205eac5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/IsCloseTo.html @@ -0,0 +1,369 @@ + + + + + + +IsCloseTo (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.number +
+Class IsCloseTo

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.Double>
+          extended by org.hamcrest.number.IsCloseTo
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Double>, SelfDescribing
+
+
+
+
public class IsCloseTo
extends TypeSafeMatcher<java.lang.Double>
+ + +

+Is the value a number equal to a value within some range of + acceptable error? +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsCloseTo(double value, + double error) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static Matcher<java.lang.Double>closeTo(double operand, + double error) + +
+          Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+ voiddescribeMismatchSafely(java.lang.Double item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatchesSafely(java.lang.Double item) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsCloseTo

+
+public IsCloseTo(double value,
+                 double error)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.Double item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.lang.Double>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.lang.Double item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.lang.Double>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+closeTo

+
+public static Matcher<java.lang.Double> closeTo(double operand,
+                                                double error)
+
+
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. +

+ For example: +

assertThat(1.03, is(closeTo(1.0, 0.03)))
+

+

+
Parameters:
operand - the expected value of matching doubles
error - the delta (+/-) within which matches will be allowed
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/OrderingComparison.html b/docs/javadoc/1.3/org/hamcrest/number/OrderingComparison.html new file mode 100644 index 00000000..ec239d0d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/OrderingComparison.html @@ -0,0 +1,490 @@ + + + + + + +OrderingComparison (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.number +
+Class OrderingComparison<T extends java.lang.Comparable<T>>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<T>
+          extended by org.hamcrest.number.OrderingComparison<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class OrderingComparison<T extends java.lang.Comparable<T>>
extends TypeSafeMatcher<T>
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
comparesEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+ voiddescribeMismatchSafely(T actual, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
greaterThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
greaterThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
lessThan(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+static + + + + +
+<T extends java.lang.Comparable<T>> +
+Matcher<T>
+
lessThanOrEqualTo(T value) + +
+          Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+ booleanmatchesSafely(T actual) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(T actual)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<T extends java.lang.Comparable<T>>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(T actual,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<T extends java.lang.Comparable<T>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+comparesEqualTo

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. +

+ For example: +

assertThat(1, comparesEqualTo(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return zero
+
+
+
+ +

+greaterThan

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. +

+ For example: +

assertThat(2, greaterThan(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
+
+
+
+ +

+greaterThanOrEqualTo

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. +

+ For example: +

assertThat(1, greaterThanOrEqualTo(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
+
+
+
+ +

+lessThan

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. +

+ For example: +

assertThat(1, lessThan(2))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
+
+
+
+ +

+lessThanOrEqualTo

+
+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. +

+ For example: +

assertThat(1, lessThanOrEqualTo(1))
+

+

+
Parameters:
value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/class-use/BigDecimalCloseTo.html b/docs/javadoc/1.3/org/hamcrest/number/class-use/BigDecimalCloseTo.html new file mode 100644 index 00000000..3b1cab5f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/class-use/BigDecimalCloseTo.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.number.BigDecimalCloseTo (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.number.BigDecimalCloseTo

+
+No usage of org.hamcrest.number.BigDecimalCloseTo +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/class-use/IsCloseTo.html b/docs/javadoc/1.3/org/hamcrest/number/class-use/IsCloseTo.html new file mode 100644 index 00000000..24e4fb98 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/class-use/IsCloseTo.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.number.IsCloseTo (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.number.IsCloseTo

+
+No usage of org.hamcrest.number.IsCloseTo +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/class-use/OrderingComparison.html b/docs/javadoc/1.3/org/hamcrest/number/class-use/OrderingComparison.html new file mode 100644 index 00000000..e9e569e9 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/class-use/OrderingComparison.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.number.OrderingComparison (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.number.OrderingComparison

+
+No usage of org.hamcrest.number.OrderingComparison +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/package-frame.html b/docs/javadoc/1.3/org/hamcrest/number/package-frame.html new file mode 100644 index 00000000..b92ecd4b --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/package-frame.html @@ -0,0 +1,36 @@ + + + + + + +org.hamcrest.number (Hamcrest) + + + + + + + + + + + +org.hamcrest.number + + + + +
+Classes  + +
+BigDecimalCloseTo +
+IsCloseTo +
+OrderingComparison
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/package-summary.html b/docs/javadoc/1.3/org/hamcrest/number/package-summary.html new file mode 100644 index 00000000..2abe5f4d --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/package-summary.html @@ -0,0 +1,181 @@ + + + + + + +org.hamcrest.number (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.number +

+Matchers that perform numeric comparisons. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + +
+Class Summary
BigDecimalCloseTo 
IsCloseToIs the value a number equal to a value within some range of + acceptable error?
OrderingComparison<T extends Comparable<T>> 
+  + +

+

+Package org.hamcrest.number Description +

+ +

+

Matchers that perform numeric comparisons.

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/package-tree.html b/docs/javadoc/1.3/org/hamcrest/number/package-tree.html new file mode 100644 index 00000000..2ce536fe --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/package-tree.html @@ -0,0 +1,158 @@ + + + + + + +org.hamcrest.number Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.number +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/number/package-use.html b/docs/javadoc/1.3/org/hamcrest/number/package-use.html new file mode 100644 index 00000000..d14fd8e3 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/number/package-use.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Package org.hamcrest.number (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.number

+
+No usage of org.hamcrest.number +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/HasToString.html b/docs/javadoc/1.3/org/hamcrest/object/HasToString.html new file mode 100644 index 00000000..ea040a70 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/HasToString.html @@ -0,0 +1,358 @@ + + + + + + +HasToString (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.object +
+Class HasToString<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
+          extended by org.hamcrest.FeatureMatcher<T,java.lang.String>
+              extended by org.hamcrest.object.HasToString<T>
+
+
+
All Implemented Interfaces:
Matcher<T>, SelfDescribing
+
+
+
+
public class HasToString<T>
extends FeatureMatcher<T,java.lang.String>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
HasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+protected  java.lang.StringfeatureValueOf(T actual) + +
+          Implement this to extract the interesting feature.
+static + + + + +
+<T> Matcher<T>
+
hasToString(Matcher<? super java.lang.String> toStringMatcher) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+static + + + + +
+<T> Matcher<T>
+
hasToString(java.lang.String expectedToString) + +
+          Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+ + + + + + + +
Methods inherited from class org.hamcrest.FeatureMatcher
describeTo, matchesSafely
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+HasToString

+
+public HasToString(Matcher<? super java.lang.String> toStringMatcher)
+
+
+ + + + + + + + +
+Method Detail
+ +

+featureValueOf

+
+protected java.lang.String featureValueOf(T actual)
+
+
Description copied from class: FeatureMatcher
+
Implement this to extract the interesting feature. +

+

+
Specified by:
featureValueOf in class FeatureMatcher<T,java.lang.String>
+
+
+
Parameters:
actual - the target object +
Returns:
the feature to be matched
+
+
+
+ +

+hasToString

+
+public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
+
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. +

+ For example: +

assertThat(true, hasToString(equalTo("TRUE")))
+

+

+
Parameters:
toStringMatcher - the matcher used to verify the toString result
+
+
+
+ +

+hasToString

+
+public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
+
+
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. +

+ For example: +

assertThat(true, hasToString("TRUE"))
+

+

+
Parameters:
expectedToString - the expected toString result
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/IsCompatibleType.html b/docs/javadoc/1.3/org/hamcrest/object/IsCompatibleType.html new file mode 100644 index 00000000..551240bc --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/IsCompatibleType.html @@ -0,0 +1,367 @@ + + + + + + +IsCompatibleType (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.object +
+Class IsCompatibleType<T>

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.Class<?>>
+          extended by org.hamcrest.object.IsCompatibleType<T>
+
+
+
All Implemented Interfaces:
Matcher<java.lang.Class<?>>, SelfDescribing
+
+
+
+
public class IsCompatibleType<T>
extends TypeSafeMatcher<java.lang.Class<?>>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsCompatibleType(java.lang.Class<T> type) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.lang.Class<?> cls, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatchesSafely(java.lang.Class<?> cls) + +
+          Subclasses should implement this.
+static + + + + +
+<T> Matcher<java.lang.Class<?>>
+
typeCompatibleWith(java.lang.Class<T> baseType) + +
+          Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsCompatibleType

+
+public IsCompatibleType(java.lang.Class<T> type)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.Class<?> cls)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.lang.Class<?>>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.lang.Class<?> cls,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.lang.Class<?>>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+typeCompatibleWith

+
+public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
+
+
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. +

+ For example: +

assertThat(Integer.class, typeCompatibleWith(Number.class))
+

+

+
Parameters:
baseType - the base class to examine classes against
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/IsEventFrom.html b/docs/javadoc/1.3/org/hamcrest/object/IsEventFrom.html new file mode 100644 index 00000000..b5a9e8c3 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/IsEventFrom.html @@ -0,0 +1,368 @@ + + + + + + +IsEventFrom (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.object +
+Class IsEventFrom

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<java.util.EventObject>
+          extended by org.hamcrest.object.IsEventFrom
+
+
+
All Implemented Interfaces:
Matcher<java.util.EventObject>, SelfDescribing
+
+
+
+
public class IsEventFrom
extends TypeSafeDiagnosingMatcher<java.util.EventObject>
+ + +

+Tests if the value is an event announced by a specific object. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsEventFrom(java.lang.Class<?> eventClass, + java.lang.Object source) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static Matcher<java.util.EventObject>eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+static Matcher<java.util.EventObject>eventFrom(java.lang.Object source) + +
+          Creates a matcher of EventObject that matches any EventObject + announced by source.
+ booleanmatchesSafely(java.util.EventObject item, + Description mismatchDescription) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsEventFrom

+
+public IsEventFrom(java.lang.Class<?> eventClass,
+                   java.lang.Object source)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.util.EventObject item,
+                             Description mismatchDescription)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<java.util.EventObject>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+eventFrom

+
+public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+                                                       java.lang.Object source)
+
+
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. +

+ For example: +
assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
+

+

+
Parameters:
eventClass - the class of the event to match on
source - the source of the event
+
+
+
+ +

+eventFrom

+
+public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
+
+
Creates a matcher of EventObject that matches any EventObject + announced by source. +

+ For example: +
assertThat(myEvent, is(eventFrom(myBean)))
+

+

+
Parameters:
source - the source of the event
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/class-use/HasToString.html b/docs/javadoc/1.3/org/hamcrest/object/class-use/HasToString.html new file mode 100644 index 00000000..8a22d2ed --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/class-use/HasToString.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.object.HasToString (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.object.HasToString

+
+No usage of org.hamcrest.object.HasToString +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/class-use/IsCompatibleType.html b/docs/javadoc/1.3/org/hamcrest/object/class-use/IsCompatibleType.html new file mode 100644 index 00000000..6b665fa0 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/class-use/IsCompatibleType.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.object.IsCompatibleType (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.object.IsCompatibleType

+
+No usage of org.hamcrest.object.IsCompatibleType +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/class-use/IsEventFrom.html b/docs/javadoc/1.3/org/hamcrest/object/class-use/IsEventFrom.html new file mode 100644 index 00000000..8d105e59 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/class-use/IsEventFrom.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.object.IsEventFrom (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.object.IsEventFrom

+
+No usage of org.hamcrest.object.IsEventFrom +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/package-frame.html b/docs/javadoc/1.3/org/hamcrest/object/package-frame.html new file mode 100644 index 00000000..3126333e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/package-frame.html @@ -0,0 +1,36 @@ + + + + + + +org.hamcrest.object (Hamcrest) + + + + + + + + + + + +org.hamcrest.object + + + + +
+Classes  + +
+HasToString +
+IsCompatibleType +
+IsEventFrom
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/package-summary.html b/docs/javadoc/1.3/org/hamcrest/object/package-summary.html new file mode 100644 index 00000000..bdc3b7c5 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/package-summary.html @@ -0,0 +1,180 @@ + + + + + + +org.hamcrest.object (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.object +

+Matchers that inspect objects and classes. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + +
+Class Summary
HasToString<T> 
IsCompatibleType<T> 
IsEventFromTests if the value is an event announced by a specific object.
+  + +

+

+Package org.hamcrest.object Description +

+ +

+

Matchers that inspect objects and classes.

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/package-tree.html b/docs/javadoc/1.3/org/hamcrest/object/package-tree.html new file mode 100644 index 00000000..c26d34a1 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/package-tree.html @@ -0,0 +1,162 @@ + + + + + + +org.hamcrest.object Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.object +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/object/package-use.html b/docs/javadoc/1.3/org/hamcrest/object/package-use.html new file mode 100644 index 00000000..d732786e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/object/package-use.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Package org.hamcrest.object (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.object

+
+No usage of org.hamcrest.object +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/package-frame.html b/docs/javadoc/1.3/org/hamcrest/package-frame.html new file mode 100644 index 00000000..ff625e45 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/package-frame.html @@ -0,0 +1,92 @@ + + + + + + +org.hamcrest (Hamcrest) + + + + + + + + + + + +org.hamcrest + + + + +
+Interfaces  + +
+Condition.Step +
+Description +
+Matcher +
+SelfDescribing
+ + + + + + +
+Classes  + +
+BaseDescription +
+BaseMatcher +
+Condition +
+CoreMatchers +
+CustomMatcher +
+CustomTypeSafeMatcher +
+Description.NullDescription +
+DiagnosingMatcher +
+EasyMock2Matchers +
+FeatureMatcher +
+JavaLangMatcherAssert +
+JMock1Matchers +
+MatcherAssert +
+Matchers +
+StringDescription +
+TypeSafeDiagnosingMatcher +
+TypeSafeMatcher
+ + + + + + +
+Annotation Types  + +
+Factory
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/package-summary.html b/docs/javadoc/1.3/org/hamcrest/package-summary.html new file mode 100644 index 00000000..93aa5d7e --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/package-summary.html @@ -0,0 +1,279 @@ + + + + + + +org.hamcrest (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest +

+The stable API defining Matcher and its associated interfaces and classes. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + + + + + +
+Interface Summary
Condition.Step<I,O> 
DescriptionA description of a Matcher.
Matcher<T>A matcher over acceptable values.
SelfDescribingThe ability of an object to describe itself.
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
BaseDescriptionA Description that is stored as a string.
BaseMatcher<T>BaseClass for all Matcher implementations.
Condition<T>A Condition implements part of a multi-step match.
CoreMatchers 
CustomMatcher<T>Utility class for writing one off matchers.
CustomTypeSafeMatcher<T>Utility class for writing one off matchers.
Description.NullDescription 
DiagnosingMatcher<T>TODO(ngd): Document.
EasyMock2Matchers 
FeatureMatcher<T,U>Supporting class for matching a feature of an object.
JavaLangMatcherAssertIntegration method for use with Java's assert keyword.
JMock1Matchers 
MatcherAssert 
Matchers 
StringDescriptionA Description that is stored as a string.
TypeSafeDiagnosingMatcher<T>Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
TypeSafeMatcher<T>Convenient base class for Matchers that require a non-null value of a specific type.
+  + +

+ + + + + + + + + +
+Annotation Types Summary
FactoryMarks a Hamcrest static factory method so tools recognise them.
+  + +

+

+Package org.hamcrest Description +

+ +

+

The stable API defining Matcher and its associated interfaces and classes. + Hamcrest sub-projects define their convenience classes in the org.hamcrest package. +

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/package-tree.html b/docs/javadoc/1.3/org/hamcrest/package-tree.html new file mode 100644 index 00000000..83aaa1ae --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/package-tree.html @@ -0,0 +1,177 @@ + + + + + + +org.hamcrest Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +

+Annotation Type Hierarchy +

+
    +
  • org.hamcrest.Factory (implements java.lang.annotation.Annotation) +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/package-use.html b/docs/javadoc/1.3/org/hamcrest/package-use.html new file mode 100644 index 00000000..d014b5bc --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/package-use.html @@ -0,0 +1,659 @@ + + + + + + +Uses of Package org.hamcrest (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Packages that use org.hamcrest
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes. 
org.hamcrest.beansMatchers of Java Bean properties and their values. 
org.hamcrest.collectionMatchers of arrays and collections. 
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers. 
org.hamcrest.integration  
org.hamcrest.internal  
org.hamcrest.numberMatchers that perform numeric comparisons. 
org.hamcrest.objectMatchers that inspect objects and classes. 
org.hamcrest.textMatchers that perform text comparisons. 
org.hamcrest.xmlMatchers of XML documents. 
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest
BaseDescription + +
+          A Description that is stored as a string.
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Condition + +
+          A Condition implements part of a multi-step match.
Condition.Step + +
+           
Description + +
+          A description of a Matcher.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeDiagnosingMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
TypeSafeMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.beans
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Description + +
+          A description of a Matcher.
DiagnosingMatcher + +
+          TODO(ngd): Document.
Factory + +
+          Marks a Hamcrest static factory method so tools recognise them.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeDiagnosingMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
TypeSafeMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.collection
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Description + +
+          A description of a Matcher.
Factory + +
+          Marks a Hamcrest static factory method so tools recognise them.
FeatureMatcher + +
+          Supporting class for matching a feature of an object.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeDiagnosingMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
TypeSafeMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.core
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Description + +
+          A description of a Matcher.
DiagnosingMatcher + +
+          TODO(ngd): Document.
Factory + +
+          Marks a Hamcrest static factory method so tools recognise them.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeDiagnosingMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
TypeSafeMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.integration
Matcher + +
+          A matcher over acceptable values.
+  +

+ + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.internal
Description + +
+          A description of a Matcher.
SelfDescribing + +
+          The ability of an object to describe itself.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.number
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Description + +
+          A description of a Matcher.
Factory + +
+          Marks a Hamcrest static factory method so tools recognise them.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.object
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Description + +
+          A description of a Matcher.
Factory + +
+          Marks a Hamcrest static factory method so tools recognise them.
FeatureMatcher + +
+          Supporting class for matching a feature of an object.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeDiagnosingMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
TypeSafeMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.text
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Description + +
+          A description of a Matcher.
Factory + +
+          Marks a Hamcrest static factory method so tools recognise them.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.hamcrest used by org.hamcrest.xml
BaseMatcher + +
+          BaseClass for all Matcher implementations.
Description + +
+          A description of a Matcher.
Factory + +
+          Marks a Hamcrest static factory method so tools recognise them.
Matcher + +
+          A matcher over acceptable values.
SelfDescribing + +
+          The ability of an object to describe itself.
TypeSafeDiagnosingMatcher + +
+          Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/IsEmptyString.html b/docs/javadoc/1.3/org/hamcrest/text/IsEmptyString.html new file mode 100644 index 00000000..d11d4467 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/IsEmptyString.html @@ -0,0 +1,352 @@ + + + + + + +IsEmptyString (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.text +
+Class IsEmptyString

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<java.lang.String>
+      extended by org.hamcrest.text.IsEmptyString
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
+
public final class IsEmptyString
extends BaseMatcher<java.lang.String>
+ + +

+Matches empty Strings (and null). +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsEmptyString() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static Matcher<java.lang.String>isEmptyOrNullString() + +
+          Creates a matcher of String that matches when the examined string is null, or + has zero length.
+static Matcher<java.lang.String>isEmptyString() + +
+          Creates a matcher of String that matches when the examined string has zero length.
+ booleanmatches(java.lang.Object item) + +
+          Evaluates the matcher for argument item.
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsEmptyString

+
+public IsEmptyString()
+
+
+ + + + + + + + +
+Method Detail
+ +

+matches

+
+public boolean matches(java.lang.Object item)
+
+
Description copied from interface: Matcher
+
Evaluates the matcher for argument item. +

+ This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type. +

+

+
Parameters:
item - the object against which the matcher is evaluated. +
Returns:
true if item matches, otherwise false.
See Also:
BaseMatcher
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+isEmptyString

+
+public static Matcher<java.lang.String> isEmptyString()
+
+
Creates a matcher of String that matches when the examined string has zero length. +

+ For example: +

assertThat("", isEmptyString())
+

+

+
+
+
+
+ +

+isEmptyOrNullString

+
+public static Matcher<java.lang.String> isEmptyOrNullString()
+
+
Creates a matcher of String that matches when the examined string is null, or + has zero length. +

+ For example: +

assertThat(((String)null), isEmptyString())
+

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/IsEqualIgnoringCase.html b/docs/javadoc/1.3/org/hamcrest/text/IsEqualIgnoringCase.html new file mode 100644 index 00000000..6eb7aa6b --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/IsEqualIgnoringCase.html @@ -0,0 +1,364 @@ + + + + + + +IsEqualIgnoringCase (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.text +
+Class IsEqualIgnoringCase

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
+          extended by org.hamcrest.text.IsEqualIgnoringCase
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
+
public class IsEqualIgnoringCase
extends TypeSafeMatcher<java.lang.String>
+ + +

+Tests if a string is equal to another string, regardless of the case. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsEqualIgnoringCase(java.lang.String string) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static Matcher<java.lang.String>equalToIgnoringCase(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+ booleanmatchesSafely(java.lang.String item) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsEqualIgnoringCase

+
+public IsEqualIgnoringCase(java.lang.String string)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.String item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.lang.String item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+equalToIgnoringCase

+
+public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. +

+ For example: +

assertThat("Foo", equalToIgnoringCase("FOO"))
+

+

+
Parameters:
expectedString - the expected value of matched strings
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/IsEqualIgnoringWhiteSpace.html b/docs/javadoc/1.3/org/hamcrest/text/IsEqualIgnoringWhiteSpace.html new file mode 100644 index 00000000..b03ce3ba --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/IsEqualIgnoringWhiteSpace.html @@ -0,0 +1,388 @@ + + + + + + +IsEqualIgnoringWhiteSpace (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.text +
+Class IsEqualIgnoringWhiteSpace

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
+          extended by org.hamcrest.text.IsEqualIgnoringWhiteSpace
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
+
public class IsEqualIgnoringWhiteSpace
extends TypeSafeMatcher<java.lang.String>
+ + +

+Tests if a string is equal to another string, ignoring any changes in whitespace. +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
IsEqualIgnoringWhiteSpace(java.lang.String string) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static Matcher<java.lang.String>equalToIgnoringWhiteSpace(java.lang.String expectedString) + +
+          Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+ booleanmatchesSafely(java.lang.String item) + +
+          Subclasses should implement this.
+ java.lang.StringstripSpace(java.lang.String toBeStripped) + +
+           
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+IsEqualIgnoringWhiteSpace

+
+public IsEqualIgnoringWhiteSpace(java.lang.String string)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.String item)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.lang.String item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+stripSpace

+
+public java.lang.String stripSpace(java.lang.String toBeStripped)
+
+
+
+
+
+
+ +

+equalToIgnoringWhiteSpace

+
+public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. To be + exact, the following whitespace rules are applied: +
    +
  • all leading and trailing whitespace of both the expectedString and the examined string are ignored
  • +
  • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
  • +
+

+ For example: +

assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
+

+

+
Parameters:
expectedString - the expected value of matched strings
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/StringContainsInOrder.html b/docs/javadoc/1.3/org/hamcrest/text/StringContainsInOrder.html new file mode 100644 index 00000000..0c9ccf4f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/StringContainsInOrder.html @@ -0,0 +1,360 @@ + + + + + + +StringContainsInOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.text +
+Class StringContainsInOrder

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
+          extended by org.hamcrest.text.StringContainsInOrder
+
+
+
All Implemented Interfaces:
Matcher<java.lang.String>, SelfDescribing
+
+
+
+
public class StringContainsInOrder
extends TypeSafeMatcher<java.lang.String>
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeMismatchSafely(java.lang.String item, + Description mismatchDescription) + +
+          Subclasses should override this.
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+ booleanmatchesSafely(java.lang.String s) + +
+          Subclasses should implement this.
+static Matcher<java.lang.String>stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) + +
+          Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StringContainsInOrder

+
+public StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(java.lang.String s)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should implement this. The item will already have been checked for + the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeMismatchSafely

+
+public void describeMismatchSafely(java.lang.String item,
+                                   Description mismatchDescription)
+
+
Description copied from class: TypeSafeMatcher
+
Subclasses should override this. The item will already have been checked for + the specific type and will never be null. +

+

+
Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+stringContainsInOrder

+
+public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, regardless of the order of their appearance. +

+ For example: +

assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
+

+

+
Parameters:
substrings - the substrings that must be contained within matching strings
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEmptyString.html b/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEmptyString.html new file mode 100644 index 00000000..d8000a8c --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEmptyString.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.text.IsEmptyString (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.text.IsEmptyString

+
+No usage of org.hamcrest.text.IsEmptyString +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEqualIgnoringCase.html b/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEqualIgnoringCase.html new file mode 100644 index 00000000..4aaf3fbb --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEqualIgnoringCase.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.text.IsEqualIgnoringCase (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.text.IsEqualIgnoringCase

+
+No usage of org.hamcrest.text.IsEqualIgnoringCase +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEqualIgnoringWhiteSpace.html b/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEqualIgnoringWhiteSpace.html new file mode 100644 index 00000000..b88a4009 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/class-use/IsEqualIgnoringWhiteSpace.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.text.IsEqualIgnoringWhiteSpace (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.text.IsEqualIgnoringWhiteSpace

+
+No usage of org.hamcrest.text.IsEqualIgnoringWhiteSpace +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/class-use/StringContainsInOrder.html b/docs/javadoc/1.3/org/hamcrest/text/class-use/StringContainsInOrder.html new file mode 100644 index 00000000..abbd3d0f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/class-use/StringContainsInOrder.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.text.StringContainsInOrder (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.text.StringContainsInOrder

+
+No usage of org.hamcrest.text.StringContainsInOrder +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/package-frame.html b/docs/javadoc/1.3/org/hamcrest/text/package-frame.html new file mode 100644 index 00000000..dbbc6928 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/package-frame.html @@ -0,0 +1,38 @@ + + + + + + +org.hamcrest.text (Hamcrest) + + + + + + + + + + + +org.hamcrest.text + + + + +
+Classes  + +
+IsEmptyString +
+IsEqualIgnoringCase +
+IsEqualIgnoringWhiteSpace +
+StringContainsInOrder
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/package-summary.html b/docs/javadoc/1.3/org/hamcrest/text/package-summary.html new file mode 100644 index 00000000..8faae219 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/package-summary.html @@ -0,0 +1,184 @@ + + + + + + +org.hamcrest.text (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.text +

+Matchers that perform text comparisons. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + + + + + +
+Class Summary
IsEmptyStringMatches empty Strings (and null).
IsEqualIgnoringCaseTests if a string is equal to another string, regardless of the case.
IsEqualIgnoringWhiteSpaceTests if a string is equal to another string, ignoring any changes in whitespace.
StringContainsInOrder 
+  + +

+

+Package org.hamcrest.text Description +

+ +

+

Matchers that perform text comparisons.

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/package-tree.html b/docs/javadoc/1.3/org/hamcrest/text/package-tree.html new file mode 100644 index 00000000..d951bb17 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/package-tree.html @@ -0,0 +1,158 @@ + + + + + + +org.hamcrest.text Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.text +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/text/package-use.html b/docs/javadoc/1.3/org/hamcrest/text/package-use.html new file mode 100644 index 00000000..4751269a --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/text/package-use.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Package org.hamcrest.text (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.text

+
+No usage of org.hamcrest.text +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/xml/HasXPath.html b/docs/javadoc/1.3/org/hamcrest/xml/HasXPath.html new file mode 100644 index 00000000..68ccff21 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/xml/HasXPath.html @@ -0,0 +1,492 @@ + + + + + + +HasXPath (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.hamcrest.xml +
+Class HasXPath

+
+java.lang.Object
+  extended by org.hamcrest.BaseMatcher<T>
+      extended by org.hamcrest.TypeSafeDiagnosingMatcher<org.w3c.dom.Node>
+          extended by org.hamcrest.xml.HasXPath
+
+
+
All Implemented Interfaces:
Matcher<org.w3c.dom.Node>, SelfDescribing
+
+
+
+
public class HasXPath
extends TypeSafeDiagnosingMatcher<org.w3c.dom.Node>
+ + +

+Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression. +

+ +

+

+
Author:
+
Joe Walnes, Steve Freeman
+
+
+ +

+ + + + + + + + + + + +
+Field Summary
+static javax.xml.namespace.NamespaceContextNO_NAMESPACE_CONTEXT + +
+           
+  + + + + + + + + + + + + + +
+Constructor Summary
HasXPath(java.lang.String xPathExpression, + Matcher<java.lang.String> valueMatcher) + +
+           
HasXPath(java.lang.String xPathExpression, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddescribeTo(Description description) + +
+          Generates a description of the object.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) + +
+          Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) + +
+          Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+ booleanmatchesSafely(org.w3c.dom.Node item, + Description mismatch) + +
+          Subclasses should implement this.
+ + + + + + + +
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
+ + + + + + + +
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+NO_NAMESPACE_CONTEXT

+
+public static final javax.xml.namespace.NamespaceContext NO_NAMESPACE_CONTEXT
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+HasXPath

+
+public HasXPath(java.lang.String xPathExpression,
+                Matcher<java.lang.String> valueMatcher)
+
+
+
Parameters:
xPathExpression - XPath expression.
valueMatcher - Matcher to use at given XPath. + May be null to specify that the XPath must exist but the value is irrelevant.
+
+
+ +

+HasXPath

+
+public HasXPath(java.lang.String xPathExpression,
+                javax.xml.namespace.NamespaceContext namespaceContext,
+                Matcher<java.lang.String> valueMatcher)
+
+
+
Parameters:
xPathExpression - XPath expression.
namespaceContext - Resolves XML namespace prefixes in the XPath expression
valueMatcher - Matcher to use at given XPath. + May be null to specify that the XPath must exist but the value is irrelevant.
+
+ + + + + + + + +
+Method Detail
+ +

+matchesSafely

+
+public boolean matchesSafely(org.w3c.dom.Node item,
+                             Description mismatch)
+
+
Description copied from class: TypeSafeDiagnosingMatcher
+
Subclasses should implement this. The item will already have been checked + for the specific type and will never be null. +

+

+
Specified by:
matchesSafely in class TypeSafeDiagnosingMatcher<org.w3c.dom.Node>
+
+
+
+
+
+
+ +

+describeTo

+
+public void describeTo(Description description)
+
+
Description copied from interface: SelfDescribing
+
Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately. +

+

+
Parameters:
description - The description to be built or appended to.
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
+                                                 Matcher<java.lang.String> valueMatcher)
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
+

+

+
Parameters:
xPath - the target xpath
valueMatcher - matcher for the value at the specified xpath
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
+                                                 javax.xml.namespace.NamespaceContext namespaceContext,
+                                                 Matcher<java.lang.String> valueMatcher)
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
+

+

+
Parameters:
xPath - the target xpath
namespaceContext - the namespace for matching nodes
valueMatcher - matcher for the value at the specified xpath
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese"))
+

+

+
Parameters:
xPath - the target xpath
+
+
+
+ +

+hasXPath

+
+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
+                                                 javax.xml.namespace.NamespaceContext namespaceContext)
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. +

+ For example: +

assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
+

+

+
Parameters:
xPath - the target xpath
namespaceContext - the namespace for matching nodes
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/xml/class-use/HasXPath.html b/docs/javadoc/1.3/org/hamcrest/xml/class-use/HasXPath.html new file mode 100644 index 00000000..71dd6cf3 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/xml/class-use/HasXPath.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Class org.hamcrest.xml.HasXPath (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.hamcrest.xml.HasXPath

+
+No usage of org.hamcrest.xml.HasXPath +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/xml/package-frame.html b/docs/javadoc/1.3/org/hamcrest/xml/package-frame.html new file mode 100644 index 00000000..19867bea --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/xml/package-frame.html @@ -0,0 +1,32 @@ + + + + + + +org.hamcrest.xml (Hamcrest) + + + + + + + + + + + +org.hamcrest.xml + + + + +
+Classes  + +
+HasXPath
+ + + + diff --git a/docs/javadoc/1.3/org/hamcrest/xml/package-summary.html b/docs/javadoc/1.3/org/hamcrest/xml/package-summary.html new file mode 100644 index 00000000..43f5cc4f --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/xml/package-summary.html @@ -0,0 +1,172 @@ + + + + + + +org.hamcrest.xml (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.hamcrest.xml +

+Matchers of XML documents. +

+See: +
+          Description +

+ + + + + + + + + +
+Class Summary
HasXPathApplies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+  + +

+

+Package org.hamcrest.xml Description +

+ +

+

Matchers of XML documents.

+

+ +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/xml/package-tree.html b/docs/javadoc/1.3/org/hamcrest/xml/package-tree.html new file mode 100644 index 00000000..075c6289 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/xml/package-tree.html @@ -0,0 +1,158 @@ + + + + + + +org.hamcrest.xml Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.hamcrest.xml +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/org/hamcrest/xml/package-use.html b/docs/javadoc/1.3/org/hamcrest/xml/package-use.html new file mode 100644 index 00000000..7f149497 --- /dev/null +++ b/docs/javadoc/1.3/org/hamcrest/xml/package-use.html @@ -0,0 +1,144 @@ + + + + + + +Uses of Package org.hamcrest.xml (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.hamcrest.xml

+
+No usage of org.hamcrest.xml +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/overview-frame.html b/docs/javadoc/1.3/overview-frame.html new file mode 100644 index 00000000..611ddcd7 --- /dev/null +++ b/docs/javadoc/1.3/overview-frame.html @@ -0,0 +1,60 @@ + + + + + + +Overview List (Hamcrest) + + + + + + + + + + + + + + + +
+
+ + + + + +
All Classes +

+ +Packages +
+org.hamcrest +
+org.hamcrest.beans +
+org.hamcrest.collection +
+org.hamcrest.core +
+org.hamcrest.integration +
+org.hamcrest.internal +
+org.hamcrest.number +
+org.hamcrest.object +
+org.hamcrest.text +
+org.hamcrest.xml +
+

+ +

+  + + diff --git a/docs/javadoc/1.3/overview-summary.html b/docs/javadoc/1.3/overview-summary.html new file mode 100644 index 00000000..74687e8d --- /dev/null +++ b/docs/javadoc/1.3/overview-summary.html @@ -0,0 +1,221 @@ + + + + + + +Overview (Hamcrest) + + + + + + + + + + + + +


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Hamcrest is a library of matchers, which can be combined in +to create flexible expressions of intent in tests. +

+See: +
+          Description +

+ + + + + + + + + +
+Hamcrest API and Utility Classes
org.hamcrestThe stable API defining Matcher and its associated interfaces and classes.
+ +

+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Matcher Library
org.hamcrest.beansMatchers of Java Bean properties and their values.
org.hamcrest.collectionMatchers of arrays and collections.
org.hamcrest.coreFundamental matchers of objects and values, and composite matchers.
org.hamcrest.internal 
org.hamcrest.numberMatchers that perform numeric comparisons.
org.hamcrest.objectMatchers that inspect objects and classes.
org.hamcrest.textMatchers that perform text comparisons.
org.hamcrest.xmlMatchers of XML documents.
+ +

+  + + + + + + + + +
+Integration
org.hamcrest.integration 
+ +

+

+

Hamcrest is a library of matchers, which can be combined in +to create flexible expressions of intent in tests.

+ +

Documentation can be found at: http://hamcrest.org/.

+

+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/overview-tree.html b/docs/javadoc/1.3/overview-tree.html new file mode 100644 index 00000000..765148ce --- /dev/null +++ b/docs/javadoc/1.3/overview-tree.html @@ -0,0 +1,187 @@ + + + + + + +Class Hierarchy (Hamcrest) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For All Packages

+
+
+
Package Hierarchies:
org.hamcrest, org.hamcrest.beans, org.hamcrest.collection, org.hamcrest.core, org.hamcrest.integration, org.hamcrest.internal, org.hamcrest.number, org.hamcrest.object, org.hamcrest.text, org.hamcrest.xml
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +

+Annotation Type Hierarchy +

+
    +
  • org.hamcrest.Factory (implements java.lang.annotation.Annotation) +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/javadoc/1.3/package-list b/docs/javadoc/1.3/package-list new file mode 100644 index 00000000..3f5e945f --- /dev/null +++ b/docs/javadoc/1.3/package-list @@ -0,0 +1,10 @@ +org.hamcrest +org.hamcrest.beans +org.hamcrest.collection +org.hamcrest.core +org.hamcrest.integration +org.hamcrest.internal +org.hamcrest.number +org.hamcrest.object +org.hamcrest.text +org.hamcrest.xml diff --git a/docs/javadoc/1.3/resources/inherit.gif b/docs/javadoc/1.3/resources/inherit.gif new file mode 100644 index 00000000..c814867a Binary files /dev/null and b/docs/javadoc/1.3/resources/inherit.gif differ diff --git a/docs/javadoc/1.3/stylesheet.css b/docs/javadoc/1.3/stylesheet.css new file mode 100644 index 00000000..6ea9e516 --- /dev/null +++ b/docs/javadoc/1.3/stylesheet.css @@ -0,0 +1,29 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF; color:#000000 } + +/* Headings */ +h1 { font-size: 145% } + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ +.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} + diff --git a/docs/javadoc/2.0.0.0/allclasses-frame.html b/docs/javadoc/2.0.0.0/allclasses-frame.html new file mode 100644 index 00000000..875b3109 --- /dev/null +++ b/docs/javadoc/2.0.0.0/allclasses-frame.html @@ -0,0 +1,97 @@ + + + + + +All Classes (JavaHamcrest 2.0.0.0 API) + + + + + +

All Classes

+ + + diff --git a/docs/javadoc/2.0.0.0/allclasses-noframe.html b/docs/javadoc/2.0.0.0/allclasses-noframe.html new file mode 100644 index 00000000..d4ade420 --- /dev/null +++ b/docs/javadoc/2.0.0.0/allclasses-noframe.html @@ -0,0 +1,97 @@ + + + + + +All Classes (JavaHamcrest 2.0.0.0 API) + + + + + +

All Classes

+ + + diff --git a/docs/javadoc/2.0.0.0/constant-values.html b/docs/javadoc/2.0.0.0/constant-values.html new file mode 100644 index 00000000..807f0c73 --- /dev/null +++ b/docs/javadoc/2.0.0.0/constant-values.html @@ -0,0 +1,122 @@ + + + + + +Constant Field Values (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Constant Field Values

+

Contents

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/deprecated-list.html b/docs/javadoc/2.0.0.0/deprecated-list.html new file mode 100644 index 00000000..39e0bc69 --- /dev/null +++ b/docs/javadoc/2.0.0.0/deprecated-list.html @@ -0,0 +1,199 @@ + + + + + +Deprecated List (JavaHamcrest 2.0.0.0 API) + + + + + + + + +
+ + + + + + + +
+ + +
+

Deprecated API

+

Contents

+ +
+
+ + + +
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.0.0.0/help-doc.html b/docs/javadoc/2.0.0.0/help-doc.html new file mode 100644 index 00000000..ffc5e6ea --- /dev/null +++ b/docs/javadoc/2.0.0.0/help-doc.html @@ -0,0 +1,223 @@ + + + + + +API Help (JavaHamcrest 2.0.0.0 API) + + + + + + + + +
+ + + + + + + +
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.0.0.0/index-all.html b/docs/javadoc/2.0.0.0/index-all.html new file mode 100644 index 00000000..39562734 --- /dev/null +++ b/docs/javadoc/2.0.0.0/index-all.html @@ -0,0 +1,2580 @@ + + + + + +Index (JavaHamcrest 2.0.0.0 API) + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I L M N O P R S T U _  + + +

A

+
+
aFileNamed(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithAbsolutePath(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithCanonicalPath(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithSize(long) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithSize(Matcher<Long>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
AllOf<T> - Class in org.hamcrest.core
+
+
Calculates the logical conjunction of multiple matchers.
+
+
AllOf(Iterable<Matcher<? super T>>) - Constructor for class org.hamcrest.core.AllOf
+
 
+
allOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.core.AllOf
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>...) - Static method in class org.hamcrest.core.AllOf
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
aMapWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsMapWithSize
+
+
Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
aMapWithSize(int) - Static method in class org.hamcrest.collection.IsMapWithSize
+
+
Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size.
+
+
aMapWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
aMapWithSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size.
+
+
and(Condition.Step<? super T, U>) - Method in class org.hamcrest.Condition
+
 
+
and(Matcher<? super T>) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
and(Matcher<? super X>) - Method in class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher
+
 
+
anEmptyMap() - Static method in class org.hamcrest.collection.IsMapWithSize
+
+
Creates a matcher for Maps that matches when the size() method returns + zero.
+
+
anEmptyMap() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps that matches when the size() method returns + zero.
+
+
anExistingDirectory() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
anExistingFile() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
anExistingFileOrDirectory() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
any(Class<T>) - Static method in class org.hamcrest.core.IsInstanceOf
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
any(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
any(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
AnyOf<T> - Class in org.hamcrest.core
+
+
Calculates the logical disjunction of multiple matchers.
+
+
AnyOf(Iterable<Matcher<? super T>>) - Constructor for class org.hamcrest.core.AnyOf
+
 
+
anyOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.core.AnyOf
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<? super T>...) - Static method in class org.hamcrest.core.AnyOf
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<? super T>...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anything() - Static method in class org.hamcrest.core.IsAnything
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
anything(String) - Static method in class org.hamcrest.core.IsAnything
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+
+
anything() - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
anything(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+
+
anything() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
anything(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+
+
append(String) - Method in class org.hamcrest.BaseDescription
+
+
Append the String str to the description.
+
+
append(char) - Method in class org.hamcrest.BaseDescription
+
+
Append the char c to the description.
+
+
append(String) - Method in class org.hamcrest.StringDescription
+
 
+
append(char) - Method in class org.hamcrest.StringDescription
+
 
+
appendDescriptionOf(SelfDescribing) - Method in class org.hamcrest.BaseDescription
+
 
+
appendDescriptionOf(SelfDescribing) - Method in interface org.hamcrest.Description
+
+
Appends the description of a SelfDescribing value to this description.
+
+
appendDescriptionOf(SelfDescribing) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendList(String, String, String, Iterable<? extends SelfDescribing>) - Method in class org.hamcrest.BaseDescription
+
 
+
appendList(String, String, String, Iterable<? extends SelfDescribing>) - Method in interface org.hamcrest.Description
+
+
Appends a list of SelfDescribing objects + to the description.
+
+
appendList(String, String, String, Iterable<? extends SelfDescribing>) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendText(String) - Method in class org.hamcrest.BaseDescription
+
 
+
appendText(String) - Method in interface org.hamcrest.Description
+
+
Appends some plain text to the description.
+
+
appendText(String) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendValue(Object) - Method in class org.hamcrest.BaseDescription
+
 
+
appendValue(Object) - Method in interface org.hamcrest.Description
+
+
Appends an arbitrary value to the description.
+
+
appendValue(Object) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendValueList(String, String, String, T...) - Method in class org.hamcrest.BaseDescription
+
 
+
appendValueList(String, String, String, Iterable<T>) - Method in class org.hamcrest.BaseDescription
+
 
+
appendValueList(String, String, String, T...) - Method in interface org.hamcrest.Description
+
+
Appends a list of values to the description.
+
+
appendValueList(String, String, String, Iterable<T>) - Method in interface org.hamcrest.Description
+
+
Appends a list of values to the description.
+
+
appendValueList(String, String, String, T...) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendValueList(String, String, String, Iterable<T>) - Method in class org.hamcrest.Description.NullDescription
+
 
+
apply(I, Description) - Method in interface org.hamcrest.Condition.Step
+
 
+
aReadableFile() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
array(Matcher<? super T>...) - Static method in class org.hamcrest.collection.IsArray
+
+
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+
+
array(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+
+
arrayContaining(E...) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
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.
+
+
arrayContaining(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+
+
arrayContaining(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers.
+
+
arrayContaining(E...) - Static method in class org.hamcrest.Matchers
+
+
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.
+
+
arrayContaining(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+
+
arrayContaining(List<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers.
+
+
arrayContainingInAnyOrder(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers.
+
+
arrayContainingInAnyOrder(Collection<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
+ 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.
+
+
arrayContainingInAnyOrder(E...) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
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.
+
+
arrayContainingInAnyOrder(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers.
+
+
arrayContainingInAnyOrder(Collection<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
+ 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.
+
+
arrayContainingInAnyOrder(E...) - Static method in class org.hamcrest.Matchers
+
+
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.
+
+
ArrayIterator - Class in org.hamcrest.internal
+
 
+
ArrayIterator(Object) - Constructor for class org.hamcrest.internal.ArrayIterator
+
 
+
arrayWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsArrayWithSize
+
+
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+
+
arrayWithSize(int) - Static method in class org.hamcrest.collection.IsArrayWithSize
+
+
Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+
+
arrayWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+
+
arrayWithSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+
+
assertThat(T, Matcher<? super T>) - Static method in class org.hamcrest.MatcherAssert
+
 
+
assertThat(String, T, Matcher<? super T>) - Static method in class org.hamcrest.MatcherAssert
+
 
+
assertThat(String, boolean) - Static method in class org.hamcrest.MatcherAssert
+
 
+
asString(SelfDescribing) - Static method in class org.hamcrest.StringDescription
+
+ +
+
aWritableFile() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
+ + + +

B

+
+
BaseDescription - Class in org.hamcrest
+
+
A Description that is stored as a string.
+
+
BaseDescription() - Constructor for class org.hamcrest.BaseDescription
+
 
+
BaseMatcher<T> - Class in org.hamcrest
+
+
BaseClass for all Matcher implementations.
+
+
BaseMatcher() - Constructor for class org.hamcrest.BaseMatcher
+
 
+
BigDecimalCloseTo - Class in org.hamcrest.number
+
 
+
BigDecimalCloseTo(BigDecimal, BigDecimal) - Constructor for class org.hamcrest.number.BigDecimalCloseTo
+
 
+
blankOrNullString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else.
+
+
blankOrNullString() - Static method in class org.hamcrest.text.IsBlankString
+
+
Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else.
+
+
blankString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else.
+
+
blankString() - Static method in class org.hamcrest.text.IsBlankString
+
+
Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else.
+
+
both(Matcher<? super LHS>) - Static method in class org.hamcrest.core.CombinableMatcher
+
+
Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
both(Matcher<? super LHS>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
both(Matcher<? super LHS>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
+ + + +

C

+
+
CAN_READ - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
CAN_WRITE - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
canObtainExpectedTypeFrom(Method) - Method in class org.hamcrest.internal.ReflectiveTypeFinder
+
 
+
check(File) - Method in interface org.hamcrest.io.FileMatchers.FileStatus
+
 
+
closeTo(double, double) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+
+
closeTo(BigDecimal, BigDecimal) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+
+
closeTo(BigDecimal, BigDecimal) - Static method in class org.hamcrest.number.BigDecimalCloseTo
+
+
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+
+
closeTo(double, double) - Static method in class org.hamcrest.number.IsCloseTo
+
+
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+
+
CombinableBothMatcher(Matcher<? super X>) - Constructor for class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher
+
 
+
CombinableEitherMatcher(Matcher<? super X>) - Constructor for class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher
+
 
+
CombinableMatcher<T> - Class in org.hamcrest.core
+
 
+
CombinableMatcher(Matcher<? super T>) - Constructor for class org.hamcrest.core.CombinableMatcher
+
 
+
CombinableMatcher.CombinableBothMatcher<X> - Class in org.hamcrest.core
+
 
+
CombinableMatcher.CombinableEitherMatcher<X> - Class in org.hamcrest.core
+
 
+
ComparatorMatcherBuilder<T> - Class in org.hamcrest.comparator
+
 
+
comparedBy(Comparator<T>) - Static method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher factory for matchers of Comparatorss of T.
+
+
comparesEqualTo(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + equal to the specified value, as reported by the Comparator used to + create this builder.
+
+
comparesEqualTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+
+
comparesEqualTo(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+
+
Condition<T> - Class in org.hamcrest
+
+
A Condition implements part of a multi-step match.
+
+
Condition.Step<I,O> - Interface in org.hamcrest
+
 
+
contains(E...) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+
+
contains(Matcher<? super E>) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+
+
contains(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+
+
contains(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+
+
contains(E...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+
+
contains(Matcher<? super E>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+
+
contains(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+
+
contains(List<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+
+
containsInAnyOrder(Matcher<? super T>...) - Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+
+
containsInAnyOrder(T...) - Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+
+
containsInAnyOrder(Collection<Matcher<? super T>>) - Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+
+
containsInAnyOrder(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+
+
containsInAnyOrder(T...) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+
+
containsInAnyOrder(Collection<Matcher<? super T>>) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+
+
containsInRelativeOrder(E...) - Static method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
+
+
containsInRelativeOrder(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
+
+
containsInRelativeOrder(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
+
+
containsInRelativeOrder(E...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
+
+
containsInRelativeOrder(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
+
+
containsInRelativeOrder(List<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
+
+
containsString(String) - Static method in class org.hamcrest.core.StringContains
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere.
+
+
containsString(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere.
+
+
containsString(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere.
+
+
containsStringIgnoringCase(String) - Static method in class org.hamcrest.core.StringContains
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
+
+
containsStringIgnoringCase(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
+
+
containsStringIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
+
+
converted(String) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
CoreMatchers - Class in org.hamcrest
+
 
+
CoreMatchers() - Constructor for class org.hamcrest.CoreMatchers
+
 
+
CustomMatcher<T> - Class in org.hamcrest
+
+
Utility class for writing one off matchers.
+
+
CustomMatcher(String) - Constructor for class org.hamcrest.CustomMatcher
+
 
+
CustomTypeSafeMatcher<T> - Class in org.hamcrest
+
+
Utility class for writing one off matchers.
+
+
CustomTypeSafeMatcher(String) - Constructor for class org.hamcrest.CustomTypeSafeMatcher
+
 
+
+ + + +

D

+
+
DescribedAs<T> - Class in org.hamcrest.core
+
+
Provides a custom description to another matcher.
+
+
DescribedAs(String, Matcher<T>, Object[]) - Constructor for class org.hamcrest.core.DescribedAs
+
 
+
describedAs(String, Matcher<T>, Object...) - Static method in class org.hamcrest.core.DescribedAs
+
+
Wraps an existing matcher, overriding its description with that specified.
+
+
describedAs(String, Matcher<T>, Object...) - Static method in class org.hamcrest.CoreMatchers
+
+
Wraps an existing matcher, overriding its description with that specified.
+
+
describedAs(String, Matcher<T>, Object...) - Static method in class org.hamcrest.Matchers
+
+
Wraps an existing matcher, overriding its description with that specified.
+
+
describeMismatch(Object, Description) - Method in class org.hamcrest.BaseMatcher
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.core.DescribedAs
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.core.Is
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.DiagnosingMatcher
+
 
+
describeMismatch(Object, Description) - Method in interface org.hamcrest.Matcher
+
+
Generate a description of why the matcher has not accepted the item.
+
+
describeMismatch(Object, Description) - Method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.TypeSafeMatcher
+
 
+
describeMismatchSafely(T, Description) - Method in class org.hamcrest.beans.HasProperty
+
 
+
describeMismatchSafely(T[], Description) - Method in class org.hamcrest.collection.IsArray
+
 
+
describeMismatchSafely(T[], Description) - Method in class org.hamcrest.collection.IsArrayContaining
+
 
+
describeMismatchSafely(E[], Description) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
 
+
describeMismatchSafely(E[], Description) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
 
+
describeMismatchSafely(Collection<? extends E>, Description) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
describeMismatchSafely(Iterable<? extends E>, Description) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
describeMismatchSafely(Map<? extends K, ? extends V>, Description) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
describeMismatchSafely(BigDecimal, Description) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
describeMismatchSafely(Double, Description) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
describeMismatchSafely(Double, Description) - Method in class org.hamcrest.number.IsNaN
+
 
+
describeMismatchSafely(Class<?>, Description) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.text.StringContainsInOrder
+
 
+
describeMismatchSafely(T, Description) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Subclasses should override this.
+
+
describeTo(Description) - Method in class org.hamcrest.beans.HasProperty
+
 
+
describeTo(Description) - Method in class org.hamcrest.beans.HasPropertyWithValue
+
 
+
describeTo(Description) - Method in class org.hamcrest.beans.SamePropertyValuesAs
+
 
+
describeTo(Description) - Method in class org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsArray
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsArrayContaining
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIn
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIterableContainingInOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.AllOf
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.AnyOf
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.DescribedAs
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.Every
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.Is
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsAnything
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsCollectionContaining
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsEqual
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsInstanceOf
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsNot
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsNull
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsSame
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.CustomMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.CustomTypeSafeMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.FeatureMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.internal.SelfDescribingValue
+
 
+
describeTo(Description) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
describeTo(Description) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
describeTo(Description) - Method in class org.hamcrest.number.IsNaN
+
 
+
describeTo(Description) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
describeTo(Description) - Method in class org.hamcrest.object.IsEventFrom
+
 
+
describeTo(Description) - Method in interface org.hamcrest.SelfDescribing
+
+
Generates a description of the object.
+
+
describeTo(Description) - Method in class org.hamcrest.text.IsBlankString
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.IsEmptyString
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.MatchesPattern
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.StringContainsInOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.xml.HasXPath
+
 
+
Description - Interface in org.hamcrest
+
+
A description of a Matcher.
+
+
Description.NullDescription - Class in org.hamcrest
+
 
+
descriptionEnd() - Method in class org.hamcrest.collection.IsArray
+
+
Returns the string that ends the description.
+
+
descriptionSeparator() - Method in class org.hamcrest.collection.IsArray
+
+
Returns the string that separates the elements in the description.
+
+
descriptionStart() - Method in class org.hamcrest.collection.IsArray
+
+
Returns the string that starts the description.
+
+
DiagnosingMatcher<T> - Class in org.hamcrest
+
+
TODO(ngd): Document.
+
+
DiagnosingMatcher() - Constructor for class org.hamcrest.DiagnosingMatcher
+
 
+
+ + + +

E

+
+
either(Matcher<? super LHS>) - Static method in class org.hamcrest.core.CombinableMatcher
+
+
Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
either(Matcher<? super LHS>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
either(Matcher<? super LHS>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
empty() - Static method in class org.hamcrest.collection.IsEmptyCollection
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
empty() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
emptyArray() - Static method in class org.hamcrest.collection.IsArrayWithSize
+
+
Creates a matcher for arrays that matches when the length of the array + is zero.
+
+
emptyArray() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the length of the array + is zero.
+
+
emptyCollectionOf(Class<E>) - Static method in class org.hamcrest.collection.IsEmptyCollection
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
emptyCollectionOf(Class<E>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
emptyIterable() - Static method in class org.hamcrest.collection.IsEmptyIterable
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyIterable() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyIterableOf(Class<E>) - Static method in class org.hamcrest.collection.IsEmptyIterable
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyIterableOf(Class<E>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyOrNullString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is null, or + has zero length.
+
+
emptyOrNullString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Creates a matcher of String that matches when the examined string is null, or + has zero length.
+
+
emptyString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string has zero length.
+
+
emptyString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Creates a matcher of String that matches when the examined string has zero length.
+
+
endsWith(String) - Static method in class org.hamcrest.core.StringEndsWith
+
+
Creates a matcher that matches if the examined String ends with the specified + String.
+
+
endsWith(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String.
+
+
endsWith(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String.
+
+
endsWithIgnoringCase(String) - Static method in class org.hamcrest.core.StringEndsWith
+
+
Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
+
+
endsWithIgnoringCase(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
+
+
endsWithIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
+
+
equalTo(T) - Static method in class org.hamcrest.core.IsEqual
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+
+
equalTo(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+
+
equalTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+
+
equalToIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+
+
equalToIgnoringCase(String) - Static method in class org.hamcrest.text.IsEqualIgnoringCase
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+
+
equalToIgnoringWhiteSpace(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+
+
equalToIgnoringWhiteSpace(String) - Static method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+
+
equalToObject(Object) - Static method in class org.hamcrest.core.IsEqual
+
+
Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
+
+
equalToObject(Object) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
+
+
equalToObject(Object) - Static method in class org.hamcrest.Matchers
+
+
Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
+
+
evalSubstringOf(String) - Method in class org.hamcrest.core.StringContains
+
 
+
evalSubstringOf(String) - Method in class org.hamcrest.core.StringEndsWith
+
 
+
evalSubstringOf(String) - Method in class org.hamcrest.core.StringStartsWith
+
 
+
evalSubstringOf(String) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
eventFrom(Class<? extends EventObject>, Object) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+
+
eventFrom(Object) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of EventObject that matches any EventObject + announced by source.
+
+
eventFrom(Class<? extends EventObject>, Object) - Static method in class org.hamcrest.object.IsEventFrom
+
+
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+
+
eventFrom(Object) - Static method in class org.hamcrest.object.IsEventFrom
+
+
Creates a matcher of EventObject that matches any EventObject + announced by source.
+
+
Every<T> - Class in org.hamcrest.core
+
 
+
Every(Matcher<? super T>) - Constructor for class org.hamcrest.core.Every
+
 
+
everyItem(Matcher<U>) - Static method in class org.hamcrest.core.Every
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+
+
everyItem(Matcher<U>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+
+
everyItem(Matcher<U>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+
+
EXISTS - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
expectedTypeFrom(Method) - Method in class org.hamcrest.internal.ReflectiveTypeFinder
+
 
+
+ + + +

F

+
+
FeatureMatcher<T,U> - Class in org.hamcrest
+
+
Supporting class for matching a feature of an object.
+
+
FeatureMatcher(Matcher<? super U>, String, String) - Constructor for class org.hamcrest.FeatureMatcher
+
+
Constructor
+
+
featureValueOf(E[]) - Method in class org.hamcrest.collection.IsArrayWithSize
+
 
+
featureValueOf(Collection<? extends E>) - Method in class org.hamcrest.collection.IsCollectionWithSize
+
 
+
featureValueOf(Iterable<E>) - Method in class org.hamcrest.collection.IsIterableWithSize
+
 
+
featureValueOf(Map<? extends K, ? extends V>) - Method in class org.hamcrest.collection.IsMapWithSize
+
 
+
featureValueOf(T) - Method in class org.hamcrest.FeatureMatcher
+
+
Implement this to extract the interesting feature.
+
+
featureValueOf(T) - Method in class org.hamcrest.object.HasToString
+
 
+
FileMatchers - Class in org.hamcrest.io
+
 
+
FileMatchers() - Constructor for class org.hamcrest.io.FileMatchers
+
 
+
FileMatchers.FileStatus - Interface in org.hamcrest.io
+
 
+
findExpectedType(Class<?>) - Method in class org.hamcrest.internal.ReflectiveTypeFinder
+
 
+
+ + + +

G

+
+
getPropertyDescriptor(String, Object) - Static method in class org.hamcrest.beans.PropertyUtil
+
+
Returns the description of the property with the provided + name on the provided object's interface.
+
+
greaterThan(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + greater than the specified value, as reported by the Comparator used to + create this builder.
+
+
greaterThan(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+
+
greaterThan(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+
+
greaterThanOrEqualTo(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + greater than or equal to the specified value, as reported by the Comparator used to + create this builder.
+
+
greaterThanOrEqualTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
greaterThanOrEqualTo(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
+ + + +

H

+
+
hasEntry(Matcher<? super K>, Matcher<? super V>) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+
+
hasEntry(K, V) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+
+
hasEntry(Matcher<? super K>, Matcher<? super V>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+
+
hasEntry(K, V) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+
+
hasItem(T) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+
+
hasItem(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+
+
hasItem(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+
+
hasItemInArray(Matcher<? super T>) - Static method in class org.hamcrest.collection.IsArrayContaining
+
+
Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+
+
hasItemInArray(T) - Static method in class org.hamcrest.collection.IsArrayContaining
+
+
A shortcut to the frequently used hasItemInArray(equalTo(x)).
+
+
hasItemInArray(Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+
+
hasItemInArray(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used hasItemInArray(equalTo(x)).
+
+
hasItems(Matcher<? super T>...) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+
+
hasItems(T...) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+
+
hasItems(Matcher<? super T>...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+
+
hasItems(T...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+
+
hasItems(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+
+
hasItems(T...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+
+
hasKey(Matcher<? super K>) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+
+
hasKey(K) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+
+
hasKey(Matcher<? super K>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+
+
hasKey(K) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+
+
hasNext() - Method in class org.hamcrest.internal.ArrayIterator
+
 
+
hasNext() - Method in class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
HasProperty<T> - Class in org.hamcrest.beans
+
+
A Matcher that checks that an object has a JavaBean property + with the specified name.
+
+
HasProperty(String) - Constructor for class org.hamcrest.beans.HasProperty
+
 
+
hasProperty(String) - Static method in class org.hamcrest.beans.HasProperty
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+
+
hasProperty(String, Matcher<?>) - Static method in class org.hamcrest.beans.HasPropertyWithValue
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+
+
hasProperty(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+
+
hasProperty(String, Matcher<?>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+
+
HasPropertyWithValue<T> - Class in org.hamcrest.beans
+
+
Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
+
+
HasPropertyWithValue(String, Matcher<?>) - Constructor for class org.hamcrest.beans.HasPropertyWithValue
+
 
+
hasSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsCollectionWithSize
+
+
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
hasSize(int) - Static method in class org.hamcrest.collection.IsCollectionWithSize
+
+
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+
+
hasSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
hasSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+
+
hasToString(Matcher<? super String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+
+
hasToString(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+
+
HasToString<T> - Class in org.hamcrest.object
+
 
+
HasToString(Matcher<? super String>) - Constructor for class org.hamcrest.object.HasToString
+
 
+
hasToString(Matcher<? super String>) - Static method in class org.hamcrest.object.HasToString
+
+
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+
+
hasToString(String) - Static method in class org.hamcrest.object.HasToString
+
+
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+
+
hasValue(Matcher<? super V>) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+
+
hasValue(V) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+
+
hasValue(Matcher<? super V>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+
+
hasValue(V) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+
+
hasXPath(String, Matcher<String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+
+
hasXPath(String, NamespaceContext, Matcher<String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+
+
hasXPath(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+
+
hasXPath(String, NamespaceContext) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+
+
HasXPath - Class in org.hamcrest.xml
+
+
Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+
+
HasXPath(String, Matcher<String>) - Constructor for class org.hamcrest.xml.HasXPath
+
 
+
HasXPath(String, NamespaceContext, Matcher<String>) - Constructor for class org.hamcrest.xml.HasXPath
+
 
+
hasXPath(String, Matcher<String>) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+
+
hasXPath(String, NamespaceContext, Matcher<String>) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+
+
hasXPath(String) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+
+
hasXPath(String, NamespaceContext) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+
+
+ + + +

I

+
+
in(Collection<T>) - Static method in class org.hamcrest.collection.IsIn
+
+
Creates a matcher that matches when the examined object is found within the + specified collection.
+
+
in(T[]) - Static method in class org.hamcrest.collection.IsIn
+
+
Creates a matcher that matches when the examined object is found within the + specified array.
+
+
in(Collection<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is found within the + specified collection.
+
+
in(T[]) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is found within the + specified array.
+
+
instanceOf(Class<?>) - Static method in class org.hamcrest.core.IsInstanceOf
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
instanceOf(Class<?>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
instanceOf(Class<?>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
Is<T> - Class in org.hamcrest.core
+
+
Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
+
+
Is(Matcher<T>) - Constructor for class org.hamcrest.core.Is
+
 
+
is(Matcher<T>) - Static method in class org.hamcrest.core.Is
+
+
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+
+
is(T) - Static method in class org.hamcrest.core.Is
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
is(Matcher<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+
+
is(T) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
is(Matcher<T>) - Static method in class org.hamcrest.Matchers
+
+
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+
+
is(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
IS_DIRECTORY - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
IS_FILE - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
isA(Class<T>) - Static method in class org.hamcrest.core.Is
+
+
A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
isA(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
isA(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
IsAnything<T> - Class in org.hamcrest.core
+
+
A matcher that always returns true.
+
+
IsAnything() - Constructor for class org.hamcrest.core.IsAnything
+
 
+
IsAnything(String) - Constructor for class org.hamcrest.core.IsAnything
+
 
+
IsArray<T> - Class in org.hamcrest.collection
+
+
Matcher for array whose elements satisfy a sequence of matchers.
+
+
IsArray(Matcher<? super T>[]) - Constructor for class org.hamcrest.collection.IsArray
+
 
+
IsArrayContaining<T> - Class in org.hamcrest.collection
+
+
Matches if an array contains an item satisfying a nested matcher.
+
+
IsArrayContaining(Matcher<? super T>) - Constructor for class org.hamcrest.collection.IsArrayContaining
+
 
+
IsArrayContainingInAnyOrder<E> - Class in org.hamcrest.collection
+
 
+
IsArrayContainingInAnyOrder(Collection<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
 
+
IsArrayContainingInOrder<E> - Class in org.hamcrest.collection
+
 
+
IsArrayContainingInOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsArrayContainingInOrder
+
 
+
IsArrayWithSize<E> - Class in org.hamcrest.collection
+
+
Matches if array size satisfies a nested matcher.
+
+
IsArrayWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsArrayWithSize
+
 
+
IsBlankString - Class in org.hamcrest.text
+
+
Matches blank Strings (and null).
+
+
IsCloseTo - Class in org.hamcrest.number
+
+
Is the value a number equal to a value within some range of + acceptable error?
+
+
IsCloseTo(double, double) - Constructor for class org.hamcrest.number.IsCloseTo
+
 
+
IsCollectionContaining<T> - Class in org.hamcrest.core
+
 
+
IsCollectionContaining(Matcher<? super T>) - Constructor for class org.hamcrest.core.IsCollectionContaining
+
 
+
IsCollectionWithSize<E> - Class in org.hamcrest.collection
+
+
Matches if collection size satisfies a nested matcher.
+
+
IsCollectionWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsCollectionWithSize
+
 
+
IsCompatibleType<T> - Class in org.hamcrest.object
+
 
+
IsCompatibleType(Class<T>) - Constructor for class org.hamcrest.object.IsCompatibleType
+
 
+
IsEmptyCollection<E> - Class in org.hamcrest.collection
+
+
Tests if collection is empty.
+
+
IsEmptyCollection() - Constructor for class org.hamcrest.collection.IsEmptyCollection
+
 
+
IsEmptyIterable<E> - Class in org.hamcrest.collection
+
+
Tests if collection is empty.
+
+
IsEmptyIterable() - Constructor for class org.hamcrest.collection.IsEmptyIterable
+
 
+
isEmptyOrNullString() - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(emptyOrNullString()) instead
+
+
+
isEmptyOrNullString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Deprecated. +
use is(emptyOrNullString()) instead
+
+
+
isEmptyString() - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(emptyString()) instead
+
+
+
IsEmptyString - Class in org.hamcrest.text
+
+
Matches empty Strings (and null).
+
+
isEmptyString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Deprecated. +
use is(emptyString()) instead
+
+
+
IsEqual<T> - Class in org.hamcrest.core
+
+
Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
+
+
IsEqual(T) - Constructor for class org.hamcrest.core.IsEqual
+
 
+
IsEqualIgnoringCase - Class in org.hamcrest.text
+
+
Tests if a string is equal to another string, regardless of the case.
+
+
IsEqualIgnoringCase(String) - Constructor for class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
IsEqualIgnoringWhiteSpace - Class in org.hamcrest.text
+
+
Tests if a string is equal to another string, ignoring any changes in whitespace.
+
+
IsEqualIgnoringWhiteSpace(String) - Constructor for class org.hamcrest.text.IsEqualIgnoringWhiteSpace
+
 
+
IsEventFrom - Class in org.hamcrest.object
+
+
Tests if the value is an event announced by a specific object.
+
+
IsEventFrom(Class<?>, Object) - Constructor for class org.hamcrest.object.IsEventFrom
+
 
+
IsIn<T> - Class in org.hamcrest.collection
+
 
+
IsIn(Collection<T>) - Constructor for class org.hamcrest.collection.IsIn
+
 
+
IsIn(T[]) - Constructor for class org.hamcrest.collection.IsIn
+
 
+
isIn(Collection<T>) - Static method in class org.hamcrest.collection.IsIn
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
isIn(T[]) - Static method in class org.hamcrest.collection.IsIn
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
isIn(Collection<T>) - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
isIn(T[]) - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
IsInstanceOf - Class in org.hamcrest.core
+
+
Tests whether the value is an instance of a class.
+
+
IsInstanceOf(Class<?>) - Constructor for class org.hamcrest.core.IsInstanceOf
+
+
Creates a new instance of IsInstanceOf
+
+
IsIterableContainingInAnyOrder<T> - Class in org.hamcrest.collection
+
 
+
IsIterableContainingInAnyOrder(Collection<Matcher<? super T>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
 
+
IsIterableContainingInOrder<E> - Class in org.hamcrest.collection
+
 
+
IsIterableContainingInOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInOrder
+
 
+
IsIterableContainingInRelativeOrder<E> - Class in org.hamcrest.collection
+
 
+
IsIterableContainingInRelativeOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
 
+
IsIterableWithSize<E> - Class in org.hamcrest.collection
+
 
+
IsIterableWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsIterableWithSize
+
 
+
IsMapContaining<K,V> - Class in org.hamcrest.collection
+
 
+
IsMapContaining(Matcher<? super K>, Matcher<? super V>) - Constructor for class org.hamcrest.collection.IsMapContaining
+
 
+
IsMapWithSize<K,V> - Class in org.hamcrest.collection
+
+
Matches if map size satisfies a nested matcher.
+
+
IsMapWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsMapWithSize
+
 
+
IsNaN - Class in org.hamcrest.number
+
+
Is the value a number actually not a number (NaN)?
+
+
IsNot<T> - Class in org.hamcrest.core
+
+
Calculates the logical negation of a matcher.
+
+
IsNot(Matcher<T>) - Constructor for class org.hamcrest.core.IsNot
+
 
+
IsNull<T> - Class in org.hamcrest.core
+
+
Is the value null?
+
+
IsNull() - Constructor for class org.hamcrest.core.IsNull
+
 
+
isOneOf(T...) - Static method in class org.hamcrest.collection.IsIn
+
+
Deprecated. +
use is(oneOf(...)) instead
+
+
+
isOneOf(T...) - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(oneOf(...)) instead
+
+
+
IsSame<T> - Class in org.hamcrest.core
+
+
Is the value the same object as another value?
+
+
IsSame(T) - Constructor for class org.hamcrest.core.IsSame
+
 
+
iterableWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsIterableWithSize
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+
+
iterableWithSize(int) - Static method in class org.hamcrest.collection.IsIterableWithSize
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+
+
iterableWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+
+
iterableWithSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+
+
+ + + +

L

+
+
lessThan(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + less than the specified value, as reported by the Comparator used to + create this builder.
+
+
lessThan(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+
+
lessThan(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+
+
lessThanOrEqualTo(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + less than or equal to the specified value, as reported by the Comparator used to + create this builder.
+
+
lessThanOrEqualTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
lessThanOrEqualTo(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
+ + + +

M

+
+
matched(T, Description) - Static method in class org.hamcrest.Condition
+
 
+
Matcher<T> - Interface in org.hamcrest
+
+
+ A matcher over acceptable values.
+
+
MatcherAssert - Class in org.hamcrest
+
 
+
MatcherAssert() - Constructor for class org.hamcrest.MatcherAssert
+
 
+
Matchers - Class in org.hamcrest
+
 
+
Matchers() - Constructor for class org.hamcrest.Matchers
+
 
+
matches(Object, Description) - Method in class org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher
+
 
+
matches(Object) - Method in class org.hamcrest.collection.IsIn
+
 
+
matches(Object, Description) - Method in class org.hamcrest.core.AllOf
+
 
+
matches(Object) - Method in class org.hamcrest.core.AnyOf
+
 
+
matches(Object) - Method in class org.hamcrest.core.DescribedAs
+
 
+
matches(Object) - Method in class org.hamcrest.core.Is
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsAnything
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsEqual
+
 
+
matches(Object, Description) - Method in class org.hamcrest.core.IsInstanceOf
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsNot
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsNull
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsSame
+
 
+
matches(Object) - Method in class org.hamcrest.DiagnosingMatcher
+
 
+
matches(Object, Description) - Method in class org.hamcrest.DiagnosingMatcher
+
 
+
matches(Object) - Method in interface org.hamcrest.Matcher
+
+
Evaluates the matcher for argument item.
+
+
matches(Object) - Method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
 
+
matches(Object) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Methods made final to prevent accidental override.
+
+
matchesPattern(Pattern) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
+
+
matchesPattern(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
+
+
MatchesPattern - Class in org.hamcrest.text
+
 
+
MatchesPattern(Pattern) - Constructor for class org.hamcrest.text.MatchesPattern
+
 
+
matchesPattern(Pattern) - Static method in class org.hamcrest.text.MatchesPattern
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
+
+
matchesPattern(String) - Static method in class org.hamcrest.text.MatchesPattern
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
+
+
matchesSafely(T) - Method in class org.hamcrest.beans.HasProperty
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.beans.HasPropertyWithValue
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.beans.SamePropertyValuesAs
+
 
+
matchesSafely(T[]) - Method in class org.hamcrest.collection.IsArray
+
 
+
matchesSafely(T[]) - Method in class org.hamcrest.collection.IsArrayContaining
+
 
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
 
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
 
+
matchesSafely(Collection<? extends E>) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
matchesSafely(Iterable<? extends E>) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
matchesSafely(Iterable<? extends T>, Description) - Method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
 
+
matchesSafely(Iterable<? extends E>, Description) - Method in class org.hamcrest.collection.IsIterableContainingInOrder
+
 
+
matchesSafely(Iterable<? extends E>, Description) - Method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
 
+
matchesSafely(Map<? extends K, ? extends V>) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
matchesSafely(Iterable<? extends T>, Description) - Method in class org.hamcrest.core.Every
+
 
+
matchesSafely(Iterable<? super T>, Description) - Method in class org.hamcrest.core.IsCollectionContaining
+
 
+
matchesSafely(String) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.FeatureMatcher
+
 
+
matchesSafely(BigDecimal) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
matchesSafely(Double) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
matchesSafely(Double) - Method in class org.hamcrest.number.IsNaN
+
 
+
matchesSafely(Class<?>) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
matchesSafely(EventObject, Description) - Method in class org.hamcrest.object.IsEventFrom
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsBlankString
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsEmptyString
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.MatchesPattern
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.StringContainsInOrder
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Subclasses should implement this.
+
+
matchesSafely(T) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Subclasses should implement this.
+
+
matchesSafely(Node, Description) - Method in class org.hamcrest.xml.HasXPath
+
 
+
matching(Matcher<T>, String) - Method in class org.hamcrest.Condition
+
 
+
matching(Matcher<T>) - Method in class org.hamcrest.Condition
+
 
+
+ + + +

N

+
+
next() - Method in class org.hamcrest.internal.ArrayIterator
+
 
+
next() - Method in class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
NO_ARGUMENTS - Static variable in class org.hamcrest.beans.PropertyUtil
+
 
+
NO_NAMESPACE_CONTEXT - Static variable in class org.hamcrest.xml.HasXPath
+
 
+
NONE - Static variable in interface org.hamcrest.Description
+
+
A description that consumes input but does nothing.
+
+
not(Matcher<T>) - Static method in class org.hamcrest.core.IsNot
+
+
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+
+
not(T) - Static method in class org.hamcrest.core.IsNot
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
not(Matcher<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+
+
not(T) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
not(Matcher<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+
+
not(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
NOT_MATCHED - Static variable in class org.hamcrest.Condition
+
 
+
notANumber() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Doubles that matches when an examined double is not a number.
+
+
notANumber() - Static method in class org.hamcrest.number.IsNaN
+
+
Creates a matcher of Doubles that matches when an examined double is not a number.
+
+
notMatched() - Static method in class org.hamcrest.Condition
+
 
+
notNullValue() - Static method in class org.hamcrest.core.IsNull
+
+
A shortcut to the frequently used not(nullValue()).
+
+
notNullValue(Class<T>) - Static method in class org.hamcrest.core.IsNull
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
notNullValue() - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(nullValue()).
+
+
notNullValue(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
notNullValue() - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used not(nullValue()).
+
+
notNullValue(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
NullDescription() - Constructor for class org.hamcrest.Description.NullDescription
+
 
+
nullSafe(Matcher<? super E>[]) - Static method in class org.hamcrest.internal.NullSafety
+
 
+
NullSafety - Class in org.hamcrest.internal
+
 
+
NullSafety() - Constructor for class org.hamcrest.internal.NullSafety
+
 
+
nullValue() - Static method in class org.hamcrest.core.IsNull
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue(Class<T>) - Static method in class org.hamcrest.core.IsNull
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue() - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if examined object is null.
+
+
+ + + +

O

+
+
oneOf(T...) - Static method in class org.hamcrest.collection.IsIn
+
+
Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+
+
oneOf(T...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+
+
or(Matcher<? super X>) - Method in class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher
+
 
+
or(Matcher<? super T>) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
OrderingComparison - Class in org.hamcrest.number
+
 
+
org.hamcrest - package org.hamcrest
+
 
+
org.hamcrest.beans - package org.hamcrest.beans
+
+
Matchers of Java Bean properties and their values.
+
+
org.hamcrest.collection - package org.hamcrest.collection
+
+
Matchers of arrays and collections.
+
+
org.hamcrest.comparator - package org.hamcrest.comparator
+
 
+
org.hamcrest.core - package org.hamcrest.core
+
+
Fundamental matchers of objects and values, and composite matchers.
+
+
org.hamcrest.internal - package org.hamcrest.internal
+
 
+
org.hamcrest.io - package org.hamcrest.io
+
 
+
org.hamcrest.number - package org.hamcrest.number
+
+
Matchers that perform numeric comparisons.
+
+
org.hamcrest.object - package org.hamcrest.object
+
+
Matchers that inspect objects and classes.
+
+
org.hamcrest.text - package org.hamcrest.text
+
+
Matchers that perform text comparisons.
+
+
org.hamcrest.xml - package org.hamcrest.xml
+
+
Matchers of XML documents.
+
+
+ + + +

P

+
+
propertyDescriptorsFor(Object, Class<Object>) - Static method in class org.hamcrest.beans.PropertyUtil
+
+
Returns all the property descriptors for the class associated with the given object
+
+
PropertyMatcher(PropertyDescriptor, Object) - Constructor for class org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher
+
 
+
PropertyUtil - Class in org.hamcrest.beans
+
+
Utility class for accessing properties on JavaBean objects.
+
+
PropertyUtil() - Constructor for class org.hamcrest.beans.PropertyUtil
+
 
+
+ + + +

R

+
+
ReflectiveTypeFinder - Class in org.hamcrest.internal
+
 
+
ReflectiveTypeFinder(String, int, int) - Constructor for class org.hamcrest.internal.ReflectiveTypeFinder
+
 
+
remove() - Method in class org.hamcrest.internal.ArrayIterator
+
 
+
remove() - Method in class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
+ + + +

S

+
+
sameInstance(T) - Static method in class org.hamcrest.core.IsSame
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
sameInstance(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
sameInstance(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
SamePropertyValuesAs<T> - Class in org.hamcrest.beans
+
 
+
SamePropertyValuesAs(T) - Constructor for class org.hamcrest.beans.SamePropertyValuesAs
+
 
+
samePropertyValuesAs(T) - Static method in class org.hamcrest.beans.SamePropertyValuesAs
+
+
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+
+
samePropertyValuesAs(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+
+
SamePropertyValuesAs.PropertyMatcher - Class in org.hamcrest.beans
+
 
+
SelfDescribing - Interface in org.hamcrest
+
+
The ability of an object to describe itself.
+
+
SelfDescribingValue<T> - Class in org.hamcrest.internal
+
 
+
SelfDescribingValue(T) - Constructor for class org.hamcrest.internal.SelfDescribingValue
+
 
+
SelfDescribingValueIterator<T> - Class in org.hamcrest.internal
+
 
+
SelfDescribingValueIterator(Iterator<T>) - Constructor for class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
startsWith(String) - Static method in class org.hamcrest.core.StringStartsWith
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String.
+
+
startsWith(String) - Static method in class org.hamcrest.CoreMatchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String.
+
+
startsWith(String) - Static method in class org.hamcrest.Matchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String.
+
+
startsWithIgnoringCase(String) - Static method in class org.hamcrest.core.StringStartsWith
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
+
+
startsWithIgnoringCase(String) - Static method in class org.hamcrest.CoreMatchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
+
+
startsWithIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
+
+
StringContains - Class in org.hamcrest.core
+
+
Tests if the argument is a string that contains a substring.
+
+
StringContains(boolean, String) - Constructor for class org.hamcrest.core.StringContains
+
 
+
stringContainsInOrder(Iterable<String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
stringContainsInOrder(String...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
StringContainsInOrder - Class in org.hamcrest.text
+
 
+
StringContainsInOrder(Iterable<String>) - Constructor for class org.hamcrest.text.StringContainsInOrder
+
 
+
stringContainsInOrder(Iterable<String>) - Static method in class org.hamcrest.text.StringContainsInOrder
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
stringContainsInOrder(String...) - Static method in class org.hamcrest.text.StringContainsInOrder
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
StringDescription - Class in org.hamcrest
+
+
A Description that is stored as a string.
+
+
StringDescription() - Constructor for class org.hamcrest.StringDescription
+
 
+
StringDescription(Appendable) - Constructor for class org.hamcrest.StringDescription
+
 
+
StringEndsWith - Class in org.hamcrest.core
+
+
Tests if the argument is a string that contains a substring.
+
+
StringEndsWith(boolean, String) - Constructor for class org.hamcrest.core.StringEndsWith
+
 
+
StringStartsWith - Class in org.hamcrest.core
+
+
Tests if the argument is a string that contains a substring.
+
+
StringStartsWith(boolean, String) - Constructor for class org.hamcrest.core.StringStartsWith
+
 
+
stripSpace(String) - Method in class org.hamcrest.text.IsEqualIgnoringWhiteSpace
+
 
+
substring - Variable in class org.hamcrest.core.SubstringMatcher
+
 
+
SubstringMatcher - Class in org.hamcrest.core
+
 
+
SubstringMatcher(String, boolean, String) - Constructor for class org.hamcrest.core.SubstringMatcher
+
 
+
+ + + +

T

+
+
theInstance(T) - Static method in class org.hamcrest.core.IsSame
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
theInstance(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
theInstance(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
then(Condition.Step<? super T, U>) - Method in class org.hamcrest.Condition
+
 
+
toString() - Method in class org.hamcrest.BaseMatcher
+
 
+
toString() - Method in class org.hamcrest.Description.NullDescription
+
 
+
toString(SelfDescribing) - Static method in class org.hamcrest.StringDescription
+
+
Return the description of a SelfDescribing object as a String.
+
+
toString() - Method in class org.hamcrest.StringDescription
+
+
Returns the description as a string.
+
+
typeCompatibleWith(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+
+
typeCompatibleWith(Class<T>) - Static method in class org.hamcrest.object.IsCompatibleType
+
+
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+
+
TypeSafeDiagnosingMatcher<T> - Class in org.hamcrest
+
+
Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
+
+
TypeSafeDiagnosingMatcher(Class<?>) - Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
TypeSafeDiagnosingMatcher(ReflectiveTypeFinder) - Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
TypeSafeDiagnosingMatcher() - Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
The default constructor for simple sub types
+
+
TypeSafeMatcher<T> - Class in org.hamcrest
+
+
Convenient base class for Matchers that require a non-null value of a specific type.
+
+
TypeSafeMatcher() - Constructor for class org.hamcrest.TypeSafeMatcher
+
+
The default constructor for simple sub types
+
+
TypeSafeMatcher(Class<?>) - Constructor for class org.hamcrest.TypeSafeMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
TypeSafeMatcher(ReflectiveTypeFinder) - Constructor for class org.hamcrest.TypeSafeMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
+ + + +

U

+
+
usingNaturalOrdering() - Static method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher factory for matchers of Comparables.
+
+
+ + + +

_

+
+
_dont_implement_Matcher___instead_extend_BaseMatcher_() - Method in class org.hamcrest.BaseMatcher
+
+
Deprecated.
+
+
_dont_implement_Matcher___instead_extend_BaseMatcher_() - Method in interface org.hamcrest.Matcher
+
+
Deprecated. +
to make
+
+
+
+A B C D E F G H I L M N O P R S T U _ 
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.0.0.0/index.html b/docs/javadoc/2.0.0.0/index.html new file mode 100644 index 00000000..5f1c3bd3 --- /dev/null +++ b/docs/javadoc/2.0.0.0/index.html @@ -0,0 +1,74 @@ + + + + + +JavaHamcrest 2.0.0.0 API + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/BaseDescription.html b/docs/javadoc/2.0.0.0/org/hamcrest/BaseDescription.html new file mode 100644 index 00000000..2876d516 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/BaseDescription.html @@ -0,0 +1,478 @@ + + + + + +BaseDescription (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class BaseDescription

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.BaseDescription
    • +
    +
  • +
+
+ +
+
+
    +
  • + + + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      BaseDescription() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      protected abstract voidappend(char c) +
      Append the char c to the description.
      +
      protected voidappend(java.lang.String str) +
      Append the String str to the description.
      +
      DescriptionappendDescriptionOf(SelfDescribing value) +
      Appends the description of a SelfDescribing value to this description.
      +
      DescriptionappendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) +
      Appends a list of SelfDescribing objects + to the description.
      +
      DescriptionappendText(java.lang.String text) +
      Appends some plain text to the description.
      +
      DescriptionappendValue(java.lang.Object value) +
      Appends an arbitrary value to the description.
      +
      <T> DescriptionappendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) +
      Appends a list of values to the description.
      +
      <T> DescriptionappendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) +
      Appends a list of values to the description.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BaseDescription

        +
        public BaseDescription()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        appendText

        +
        public Description appendText(java.lang.String text)
        +
        Description copied from interface: Description
        +
        Appends some plain text to the description.
        +
        +
        Specified by:
        +
        appendText in interface Description
        +
        +
      • +
      + + + + + + + +
        +
      • +

        appendValue

        +
        public Description appendValue(java.lang.Object value)
        +
        Description copied from interface: Description
        +
        Appends an arbitrary value to the description.
        +
        +
        Specified by:
        +
        appendValue in interface Description
        +
        +
      • +
      + + + + + +
        +
      • +

        appendValueList

        +
        public <T> Description appendValueList(java.lang.String start,
        +                                       java.lang.String separator,
        +                                       java.lang.String end,
        +                                       T... values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendValueList

        +
        public <T> Description appendValueList(java.lang.String start,
        +                                       java.lang.String separator,
        +                                       java.lang.String end,
        +                                       java.lang.Iterable<T> values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendList

        +
        public Description appendList(java.lang.String start,
        +                              java.lang.String separator,
        +                              java.lang.String end,
        +                              java.lang.Iterable<? extends SelfDescribing> values)
        +
        Description copied from interface: Description
        +
        Appends a list of SelfDescribing objects + to the description.
        +
        +
        Specified by:
        +
        appendList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        append

        +
        protected void append(java.lang.String str)
        +
        Append the String str to the description. + The default implementation passes every character to append(char). + Override in subclasses to provide an efficient implementation.
        +
      • +
      + + + +
        +
      • +

        append

        +
        protected abstract void append(char c)
        +
        Append the char c to the description.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/BaseMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/BaseMatcher.html new file mode 100644 index 00000000..f114ed36 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/BaseMatcher.html @@ -0,0 +1,358 @@ + + + + + +BaseMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class BaseMatcher<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.BaseMatcher<T>
    • +
    +
  • +
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BaseMatcher

        +
        public BaseMatcher()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeMismatch

        +
        public void describeMismatch(java.lang.Object item,
        +                             Description description)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/Condition.Step.html b/docs/javadoc/2.0.0.0/org/hamcrest/Condition.Step.html new file mode 100644 index 00000000..7a37e95b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/Condition.Step.html @@ -0,0 +1,227 @@ + + + + + +Condition.Step (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface Condition.Step<I,O>

+
+
+
+
    +
  • +
    +
    Enclosing class:
    +
    Condition<T>
    +
    +
    +
    +
    public static interface Condition.Step<I,O>
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/Condition.html b/docs/javadoc/2.0.0.0/org/hamcrest/Condition.html new file mode 100644 index 00000000..a1d7ca20 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/Condition.html @@ -0,0 +1,367 @@ + + + + + +Condition (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class Condition<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.Condition<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class Condition<T>
    +extends java.lang.Object
    +
    A Condition implements part of a multi-step match. We sometimes need to write matchers + that have a sequence of steps, where each step depends on the result of the previous + step and we can stop processing as soon as a step fails. These classes provide + infrastructure for writing such a sequence. + + Based on https://github.com/npryce/maybe-java
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NOT_MATCHED

        +
        public static final org.hamcrest.Condition.NotMatched<java.lang.Object> NOT_MATCHED
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/CoreMatchers.html b/docs/javadoc/2.0.0.0/org/hamcrest/CoreMatchers.html new file mode 100644 index 00000000..041713af --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/CoreMatchers.html @@ -0,0 +1,1077 @@ + + + + + +CoreMatchers (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class CoreMatchers

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.CoreMatchers
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class CoreMatchers
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      CoreMatchers() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T> Matcher<T>allOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>any(java.lang.Class<T> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> AnyOf<T>anyOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static Matcher<java.lang.Object>anything() +
      Creates a matcher that always matches, regardless of the examined object.
      +
      static Matcher<java.lang.Object>anything(java.lang.String description) +
      Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
      +
      static <LHS> CombinableMatcher.CombinableBothMatcher<LHS>both(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when both of the specified matchers match the examined object.
      +
      static Matcher<java.lang.String>containsString(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere.
      +
      static Matcher<java.lang.String>containsStringIgnoringCase(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
      +
      static <T> Matcher<T>describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) +
      Wraps an existing matcher, overriding its description with that specified.
      +
      static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS>either(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when either of the specified matchers match the examined object.
      +
      static Matcher<java.lang.String>endsWith(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String.
      +
      static Matcher<java.lang.String>endsWithIgnoringCase(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
      +
      static <T> Matcher<T>equalTo(T operand) +
      Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
      +
      static Matcher<java.lang.Object>equalToObject(java.lang.Object operand) +
      Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
      +
      static <U> Matcher<java.lang.Iterable<? extends U>>everyItem(Matcher<U> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(Matcher<? super T> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(T item) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(Matcher<? super T>... itemMatchers) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(T... items) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
      +
      static <T> Matcher<T>instanceOf(java.lang.Class<?> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> Matcher<T>is(Matcher<T> matcher) +
      Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
      +
      static <T> Matcher<T>is(T value) +
      A shortcut to the frequently used is(equalTo(x)).
      +
      static <T> Matcher<T>isA(java.lang.Class<T> type) +
      A shortcut to the frequently used is(instanceOf(SomeClass.class)).
      +
      static <T> Matcher<T>not(Matcher<T> matcher) +
      Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
      +
      static <T> Matcher<T>not(T value) +
      A shortcut to the frequently used not(equalTo(x)).
      +
      static Matcher<java.lang.Object>notNullValue() +
      A shortcut to the frequently used not(nullValue()).
      +
      static <T> Matcher<T>notNullValue(java.lang.Class<T> type) +
      A shortcut to the frequently used not(nullValue(X.class)).
      +
      static Matcher<java.lang.Object>nullValue() +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>nullValue(java.lang.Class<T> type) +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>sameInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      static Matcher<java.lang.String>startsWith(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String.
      +
      static Matcher<java.lang.String>startsWithIgnoringCase(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
      +
      static <T> Matcher<T>theInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CoreMatchers

        +
        public CoreMatchers()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        @SafeVarargs
        +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        both

        +
        public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when both of the specified matchers match the examined object. + For example: +
        assertThat("fab", both(containsString("a")).and(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        either

        +
        public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when either of the specified matchers match the examined object. + For example: +
        assertThat("fan", either(containsString("a")).or(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        describedAs

        +
        public static <T> Matcher<T> describedAs(java.lang.String description,
        +                                         Matcher<T> matcher,
        +                                         java.lang.Object... values)
        +
        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())
        +
        +
        Parameters:
        +
        description - the new description for the wrapped matcher
        +
        matcher - the matcher to wrap
        +
        values - optional values to insert into the tokenised description
        +
        +
      • +
      + + + +
        +
      • +

        everyItem

        +
        public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. + For example: +
        assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to every item provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(Matcher<T> matcher)
        +
        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))
        +
      • +
      + + + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(T value)
        +
        A shortcut to the frequently used is(equalTo(x)). + For example: +
        assertThat(cheese, is(smelly))
        + instead of: +
        assertThat(cheese, is(equalTo(smelly)))
        +
      • +
      + + + +
        +
      • +

        isA

        +
        public static <T> Matcher<T> isA(java.lang.Class<T> type)
        +
        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)))
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything()
        +
        Creates a matcher that always matches, regardless of the examined object.
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything(java.lang.String description)
        +
        Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
        +
        +
        Parameters:
        +
        description - a meaningful String used when describing itself
        +
        +
      • +
      + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        +
        +
        Parameters:
        +
        item - the item to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        +
        +
        Parameters:
        +
        items - the items to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        equalTo

        +
        public static <T> Matcher<T> equalTo(T operand)
        +
        Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

        + For example: +
        + assertThat("foo", equalTo("foo"));
        + assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
        + 
        +
      • +
      + + + +
        +
      • +

        equalToObject

        +
        public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)
        +
        Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
        +
      • +
      + + + +
        +
      • +

        any

        +
        public static <T> Matcher<T> any(java.lang.Class<T> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
        +
      • +
      + + + +
        +
      • +

        instanceOf

        +
        public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

        + For example: +
        assertThat(new Canoe(), instanceOf(Paddlable.class));
        +
      • +
      + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(Matcher<T> matcher)
        +
        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))))
        +
        +
        Parameters:
        +
        matcher - the matcher whose sense should be inverted
        +
        +
      • +
      + + + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(T value)
        +
        A shortcut to the frequently used not(equalTo(x)). + For example: +
        assertThat(cheese, is(not(smelly)))
        + instead of: +
        assertThat(cheese, is(not(equalTo(smelly))))
        +
        +
        Parameters:
        +
        value - the value that any examined object should not equal
        +
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static Matcher<java.lang.Object> notNullValue()
        +
        A shortcut to the frequently used not(nullValue()). + For example: +
        assertThat(cheese, is(notNullValue()))
        + instead of: +
        assertThat(cheese, is(not(nullValue())))
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
        +
        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))))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static Matcher<java.lang.Object> nullValue()
        +
        Creates a matcher that matches if examined object is null. + For example: +
        assertThat(cheese, is(nullValue())
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
        +
        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))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + + + +
        +
      • +

        sameInstance

        +
        public static <T> Matcher<T> sameInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + + + +
        +
      • +

        theInstance

        +
        public static <T> Matcher<T> theInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + +
        +
      • +

        containsString

        +
        public static Matcher<java.lang.String> containsString(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        containsStringIgnoringCase

        +
        public static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWith

        +
        public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String. +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWithIgnoringCase

        +
        public static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWith

        +
        public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWithIgnoringCase

        +
        public static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String, ignoring case. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/CustomMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/CustomMatcher.html new file mode 100644 index 00000000..02725b49 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/CustomMatcher.html @@ -0,0 +1,324 @@ + + + + + +CustomMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class CustomMatcher<T>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    T - The type of object being matched.
    +
    +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public abstract class CustomMatcher<T>
    +extends BaseMatcher<T>
    +
    Utility class for writing one off matchers. + For example: +
    + Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
    +   public boolean matches(Object object) {
    +     return ((object instanceof String) && !((String) object).isEmpty();
    +   }
    + };
    + 
    +

    + This class is designed for scenarios where an anonymous inner class + matcher makes sense. It should not be used by API designers implementing + matchers.

    +
    +
    See Also:
    +
    for a type safe variant of this class that you probably + want to use.
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CustomMatcher

        +
        public CustomMatcher(java.lang.String description)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        public final void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/CustomTypeSafeMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/CustomTypeSafeMatcher.html new file mode 100644 index 00000000..e617f4d4 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/CustomTypeSafeMatcher.html @@ -0,0 +1,327 @@ + + + + + +CustomTypeSafeMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class CustomTypeSafeMatcher<T>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    T - The type of object being matched
    +
    +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public abstract class CustomTypeSafeMatcher<T>
    +extends TypeSafeMatcher<T>
    +
    Utility class for writing one off matchers. + For example: +
    + Matcher<String> aNonEmptyString = new CustomTypeSafeMatcher<String>("a non empty string") {
    +   public boolean matchesSafely(String string) {
    +     return !string.isEmpty();
    +   }
    +   public void describeMismatchSafely(String string, Description mismatchDescription) {
    +     mismatchDescription.appendText("was empty");
    +   }
    + };
    + 
    + This is a variant of CustomMatcher that first type checks + the argument being matched. By the time TypeSafeMatcher.matchesSafely(T) is + is called the argument is guaranteed to be non-null and of the correct + type.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CustomTypeSafeMatcher

        +
        public CustomTypeSafeMatcher(java.lang.String description)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        public final void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/Description.NullDescription.html b/docs/javadoc/2.0.0.0/org/hamcrest/Description.NullDescription.html new file mode 100644 index 00000000..119ab4b8 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/Description.NullDescription.html @@ -0,0 +1,460 @@ + + + + + +Description.NullDescription (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class Description.NullDescription

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.Description.NullDescription
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Description
    +
    +
    +
    Enclosing interface:
    +
    Description
    +
    +
    +
    +
    public static final class Description.NullDescription
    +extends java.lang.Object
    +implements Description
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        NullDescription

        +
        public NullDescription()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        appendList

        +
        public Description appendList(java.lang.String start,
        +                              java.lang.String separator,
        +                              java.lang.String end,
        +                              java.lang.Iterable<? extends SelfDescribing> values)
        +
        Description copied from interface: Description
        +
        Appends a list of SelfDescribing objects + to the description.
        +
        +
        Specified by:
        +
        appendList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendText

        +
        public Description appendText(java.lang.String text)
        +
        Description copied from interface: Description
        +
        Appends some plain text to the description.
        +
        +
        Specified by:
        +
        appendText in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendValue

        +
        public Description appendValue(java.lang.Object value)
        +
        Description copied from interface: Description
        +
        Appends an arbitrary value to the description.
        +
        +
        Specified by:
        +
        appendValue in interface Description
        +
        +
      • +
      + + + + + +
        +
      • +

        appendValueList

        +
        public <T> Description appendValueList(java.lang.String start,
        +                                       java.lang.String separator,
        +                                       java.lang.String end,
        +                                       T... values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendValueList

        +
        public <T> Description appendValueList(java.lang.String start,
        +                                       java.lang.String separator,
        +                                       java.lang.String end,
        +                                       java.lang.Iterable<T> values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/Description.html b/docs/javadoc/2.0.0.0/org/hamcrest/Description.html new file mode 100644 index 00000000..e174cf5e --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/Description.html @@ -0,0 +1,392 @@ + + + + + +Description (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface Description

+
+
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NONE

        +
        static final Description NONE
        +
        A description that consumes input but does nothing.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        appendText

        +
        Description appendText(java.lang.String text)
        +
        Appends some plain text to the description.
        +
      • +
      + + + + + + + +
        +
      • +

        appendValue

        +
        Description appendValue(java.lang.Object value)
        +
        Appends an arbitrary value to the description.
        +
      • +
      + + + + + +
        +
      • +

        appendValueList

        +
        <T> Description appendValueList(java.lang.String start,
        +                                java.lang.String separator,
        +                                java.lang.String end,
        +                                T... values)
        +
        Appends a list of values to the description.
        +
      • +
      + + + +
        +
      • +

        appendValueList

        +
        <T> Description appendValueList(java.lang.String start,
        +                                java.lang.String separator,
        +                                java.lang.String end,
        +                                java.lang.Iterable<T> values)
        +
        Appends a list of values to the description.
        +
      • +
      + + + +
        +
      • +

        appendList

        +
        Description appendList(java.lang.String start,
        +                       java.lang.String separator,
        +                       java.lang.String end,
        +                       java.lang.Iterable<? extends SelfDescribing> values)
        +
        Appends a list of SelfDescribing objects + to the description.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/DiagnosingMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/DiagnosingMatcher.html new file mode 100644 index 00000000..119013ba --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/DiagnosingMatcher.html @@ -0,0 +1,365 @@ + + + + + +DiagnosingMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class DiagnosingMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        DiagnosingMatcher

        +
        public DiagnosingMatcher()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public final boolean matches(java.lang.Object item)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        item - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public final void describeMismatch(java.lang.Object item,
        +                                   Description mismatchDescription)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        matches

        +
        protected abstract boolean matches(java.lang.Object item,
        +                                   Description mismatchDescription)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/FeatureMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/FeatureMatcher.html new file mode 100644 index 00000000..65469d6a --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/FeatureMatcher.html @@ -0,0 +1,381 @@ + + + + + +FeatureMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class FeatureMatcher<T,U>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FeatureMatcher

        +
        public FeatureMatcher(Matcher<? super U> subMatcher,
        +                      java.lang.String featureDescription,
        +                      java.lang.String featureName)
        +
        Constructor
        +
        +
        Parameters:
        +
        subMatcher - The matcher to apply to the feature
        +
        featureDescription - Descriptive text to use in describeTo
        +
        featureName - Identifying text for mismatch message
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        featureValueOf

        +
        protected abstract U featureValueOf(T actual)
        +
        Implement this to extract the interesting feature.
        +
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public final void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/Matcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/Matcher.html new file mode 100644 index 00000000..f8bb9ab8 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/Matcher.html @@ -0,0 +1,322 @@ + + + + + +Matcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface Matcher<T>

+
+
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        boolean matches(java.lang.Object item)
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        item - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        void describeMismatch(java.lang.Object item,
        +                      Description mismatchDescription)
        +
        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 + will not check this.
        +
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        _dont_implement_Matcher___instead_extend_BaseMatcher_

        +
        @Deprecated
        +void _dont_implement_Matcher___instead_extend_BaseMatcher_()
        +
        Deprecated. to make
        +
        This method simply acts a friendly reminder not to implement Matcher directly and + instead extend BaseMatcher. It's easy to ignore JavaDoc, but a bit harder to ignore + compile errors .
        +
        +
        See Also:
        +
        for reasons why., +BaseMatcher
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/MatcherAssert.html b/docs/javadoc/2.0.0.0/org/hamcrest/MatcherAssert.html new file mode 100644 index 00000000..54eb46b7 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/MatcherAssert.html @@ -0,0 +1,307 @@ + + + + + +MatcherAssert (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class MatcherAssert

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.MatcherAssert
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MatcherAssert
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      MatcherAssert() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidassertThat(java.lang.String reason, + boolean assertion) 
      static <T> voidassertThat(java.lang.String reason, + T actual, + Matcher<? super T> matcher) 
      static <T> voidassertThat(T actual, + Matcher<? super T> matcher) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MatcherAssert

        +
        public MatcherAssert()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        assertThat

        +
        public static <T> void assertThat(T actual,
        +                                  Matcher<? super T> matcher)
        +
      • +
      + + + + + +
        +
      • +

        assertThat

        +
        public static <T> void assertThat(java.lang.String reason,
        +                                  T actual,
        +                                  Matcher<? super T> matcher)
        +
      • +
      + + + +
        +
      • +

        assertThat

        +
        public static void assertThat(java.lang.String reason,
        +                              boolean assertion)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/Matchers.html b/docs/javadoc/2.0.0.0/org/hamcrest/Matchers.html new file mode 100644 index 00000000..70a4e974 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/Matchers.html @@ -0,0 +1,3302 @@ + + + + + +Matchers (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class Matchers

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.Matchers
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Matchers
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Matchers() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      static <T> Matcher<T>allOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>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) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>aMapWithSize(int size) +
      Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>anEmptyMap() +
      Creates a matcher for Maps that matches when the size() method returns + zero.
      +
      static <T> Matcher<T>any(java.lang.Class<T> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> AnyOf<T>anyOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static Matcher<java.lang.Object>anything() +
      Creates a matcher that always matches, regardless of the examined object.
      +
      static Matcher<java.lang.Object>anything(java.lang.String description) +
      Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
      +
      static <T> IsArray<T>array(Matcher<? super T>... elementMatchers) +
      Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
      +
      static <E> Matcher<E[]>arrayContaining(E... items) +
      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.
      +
      static <E> Matcher<E[]>arrayContaining(java.util.List<Matcher<? super E>> 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.
      +
      static <E> Matcher<E[]>arrayContaining(Matcher<? super E>... itemMatchers) +
      Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(E... items) +
      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.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(Matcher<? super E>... 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.
      +
      static <E> Matcher<E[]>arrayWithSize(int size) +
      Creates a matcher for arrays that matches when the length of the array + equals the specified size.
      +
      static <E> Matcher<E[]>arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
      +
      static Matcher<java.lang.String>blankOrNullString() +
      Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else.
      +
      static Matcher<java.lang.String>blankString() +
      Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else.
      +
      static <LHS> CombinableMatcher.CombinableBothMatcher<LHS>both(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when both of the specified matchers match the examined object.
      +
      static Matcher<java.math.BigDecimal>closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error) +
      Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
      +
      static Matcher<java.lang.Double>closeTo(double operand, + double error) +
      Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      comparesEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E> itemMatcher) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(Matcher<? super T>... itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(T... items) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
      +
      static Matcher<java.lang.String>containsString(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere.
      +
      static Matcher<java.lang.String>containsStringIgnoringCase(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
      +
      static <T> Matcher<T>describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) +
      Wraps an existing matcher, overriding its description with that specified.
      +
      static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS>either(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when either of the specified matchers match the examined object.
      +
      static <E> Matcher<java.util.Collection<? extends E>>empty() +
      Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
      +
      static <E> Matcher<E[]>emptyArray() +
      Creates a matcher for arrays that matches when the length of the array + is zero.
      +
      static <E> Matcher<java.util.Collection<E>>emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType) +
      Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>emptyIterable() +
      Creates a matcher for Iterables matching examined iterables that yield no items.
      +
      static <E> Matcher<java.lang.Iterable<E>>emptyIterableOf(java.lang.Class<E> unusedToForceReturnType) +
      Creates a matcher for Iterables matching examined iterables that yield no items.
      +
      static Matcher<java.lang.String>emptyOrNullString() +
      Creates a matcher of String that matches when the examined string is null, or + has zero length.
      +
      static Matcher<java.lang.String>emptyString() +
      Creates a matcher of String that matches when the examined string has zero length.
      +
      static Matcher<java.lang.String>endsWith(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String.
      +
      static Matcher<java.lang.String>endsWithIgnoringCase(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
      +
      static <T> Matcher<T>equalTo(T operand) +
      Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
      +
      static Matcher<java.lang.String>equalToIgnoringCase(java.lang.String expectedString) +
      Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
      +
      static Matcher<java.lang.String>equalToIgnoringWhiteSpace(java.lang.String expectedString) +
      Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
      +
      static Matcher<java.lang.Object>equalToObject(java.lang.Object operand) +
      Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
      +
      static Matcher<java.util.EventObject>eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source) +
      Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
      +
      static Matcher<java.util.EventObject>eventFrom(java.lang.Object source) +
      Creates a matcher of EventObject that matches any EventObject + announced by source.
      +
      static <U> Matcher<java.lang.Iterable<? extends U>>everyItem(Matcher<U> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(K key, + V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(Matcher<? super T> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(T item) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
      +
      static <T> Matcher<T[]>hasItemInArray(Matcher<? super T> elementMatcher) +
      Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
      +
      static <T> Matcher<T[]>hasItemInArray(T element) +
      A shortcut to the frequently used hasItemInArray(equalTo(x)).
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(Matcher<? super T>... itemMatchers) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(T... items) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(K key) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(Matcher<? super K> keyMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
      +
      static <T> Matcher<T>hasProperty(java.lang.String propertyName) +
      Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
      +
      static <T> Matcher<T>hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) +
      Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
      +
      static <E> Matcher<java.util.Collection<? extends E>>hasSize(int size) +
      Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
      +
      static <E> Matcher<java.util.Collection<? extends E>>hasSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
      +
      static <T> Matcher<T>hasToString(Matcher<? super java.lang.String> toStringMatcher) +
      Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
      +
      static <T> Matcher<T>hasToString(java.lang.String expectedToString) +
      Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
      +
      static <T> Matcher<T>in(java.util.Collection<T> collection) +
      Creates a matcher that matches when the examined object is found within the + specified collection.
      +
      static <T> Matcher<T>in(T[] elements) +
      Creates a matcher that matches when the examined object is found within the + specified array.
      +
      static <T> Matcher<T>instanceOf(java.lang.Class<?> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> Matcher<T>is(Matcher<T> matcher) +
      Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
      +
      static <T> Matcher<T>is(T value) +
      A shortcut to the frequently used is(equalTo(x)).
      +
      static <T> Matcher<T>isA(java.lang.Class<T> type) +
      A shortcut to the frequently used is(instanceOf(SomeClass.class)).
      +
      static Matcher<java.lang.String>isEmptyOrNullString() +
      Deprecated.  +
      use is(emptyOrNullString()) instead
      +
      +
      static Matcher<java.lang.String>isEmptyString() +
      Deprecated.  +
      use is(emptyString()) instead
      +
      +
      static <T> Matcher<T>isIn(java.util.Collection<T> collection) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isIn(T[] elements) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isOneOf(T... elements) +
      Deprecated.  +
      use is(oneOf(...)) instead
      +
      +
      static <E> Matcher<java.lang.Iterable<E>>iterableWithSize(int size) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
      +
      static <E> Matcher<java.lang.Iterable<E>>iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      static Matcher<java.lang.String>matchesPattern(java.util.regex.Pattern pattern) +
      Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
      +
      static Matcher<java.lang.String>matchesPattern(java.lang.String regex) +
      Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
      +
      static <T> Matcher<T>not(Matcher<T> matcher) +
      Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
      +
      static <T> Matcher<T>not(T value) +
      A shortcut to the frequently used not(equalTo(x)).
      +
      static Matcher<java.lang.Double>notANumber() +
      Creates a matcher of Doubles that matches when an examined double is not a number.
      +
      static Matcher<java.lang.Object>notNullValue() +
      A shortcut to the frequently used not(nullValue()).
      +
      static <T> Matcher<T>notNullValue(java.lang.Class<T> type) +
      A shortcut to the frequently used not(nullValue(X.class)).
      +
      static Matcher<java.lang.Object>nullValue() +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>nullValue(java.lang.Class<T> type) +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>oneOf(T... elements) +
      Creates a matcher that matches when the examined object is equal to one of the + specified elements.
      +
      static <T> Matcher<T>sameInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      static <T> Matcher<T>samePropertyValuesAs(T expectedBean) +
      Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
      +
      static Matcher<java.lang.String>startsWith(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String.
      +
      static Matcher<java.lang.String>startsWithIgnoringCase(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
      +
      static Matcher<java.lang.String>stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) +
      Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
      +
      static Matcher<java.lang.String>stringContainsInOrder(java.lang.String... substrings) +
      Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
      +
      static <T> Matcher<T>theInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      static <T> Matcher<java.lang.Class<?>>typeCompatibleWith(java.lang.Class<T> baseType) +
      Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Matchers

        +
        public Matchers()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second,
        +                                   Matcher<? super T> third)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second,
        +                                   Matcher<? super T> third,
        +                                   Matcher<? super T> fourth)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second,
        +                                   Matcher<? super T> third,
        +                                   Matcher<? super T> fourth,
        +                                   Matcher<? super T> fifth)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> 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)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third,
        +                                 Matcher<? super T> fourth)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third,
        +                                 Matcher<? super T> fourth,
        +                                 Matcher<? super T> fifth)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third,
        +                                 Matcher<? super T> fourth,
        +                                 Matcher<? super T> fifth,
        +                                 Matcher<? super T> sixth)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        both

        +
        public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when both of the specified matchers match the examined object. + For example: +
        assertThat("fab", both(containsString("a")).and(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        either

        +
        public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when either of the specified matchers match the examined object. + For example: +
        assertThat("fan", either(containsString("a")).or(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        describedAs

        +
        public static <T> Matcher<T> describedAs(java.lang.String description,
        +                                         Matcher<T> matcher,
        +                                         java.lang.Object... values)
        +
        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())
        +
        +
        Parameters:
        +
        description - the new description for the wrapped matcher
        +
        matcher - the matcher to wrap
        +
        values - optional values to insert into the tokenised description
        +
        +
      • +
      + + + +
        +
      • +

        everyItem

        +
        public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. + For example: +
        assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to every item provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(Matcher<T> matcher)
        +
        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))
        +
      • +
      + + + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(T value)
        +
        A shortcut to the frequently used is(equalTo(x)). + For example: +
        assertThat(cheese, is(smelly))
        + instead of: +
        assertThat(cheese, is(equalTo(smelly)))
        +
      • +
      + + + +
        +
      • +

        isA

        +
        public static <T> Matcher<T> isA(java.lang.Class<T> type)
        +
        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)))
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything()
        +
        Creates a matcher that always matches, regardless of the examined object.
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything(java.lang.String description)
        +
        Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
        +
        +
        Parameters:
        +
        description - a meaningful String used when describing itself
        +
        +
      • +
      + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        +
        +
        Parameters:
        +
        item - the item to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasItems

        +
        public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItems

        +
        public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        +
        +
        Parameters:
        +
        items - the items to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        equalTo

        +
        public static <T> Matcher<T> equalTo(T operand)
        +
        Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

        + For example: +
        + assertThat("foo", equalTo("foo"));
        + assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
        + 
        +
      • +
      + + + +
        +
      • +

        equalToObject

        +
        public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)
        +
        Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
        +
      • +
      + + + +
        +
      • +

        any

        +
        public static <T> Matcher<T> any(java.lang.Class<T> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
        +
      • +
      + + + +
        +
      • +

        instanceOf

        +
        public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

        + For example: +
        assertThat(new Canoe(), instanceOf(Paddlable.class));
        +
      • +
      + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(Matcher<T> matcher)
        +
        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))))
        +
        +
        Parameters:
        +
        matcher - the matcher whose sense should be inverted
        +
        +
      • +
      + + + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(T value)
        +
        A shortcut to the frequently used not(equalTo(x)). + For example: +
        assertThat(cheese, is(not(smelly)))
        + instead of: +
        assertThat(cheese, is(not(equalTo(smelly))))
        +
        +
        Parameters:
        +
        value - the value that any examined object should not equal
        +
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static Matcher<java.lang.Object> notNullValue()
        +
        A shortcut to the frequently used not(nullValue()). + For example: +
        assertThat(cheese, is(notNullValue()))
        + instead of: +
        assertThat(cheese, is(not(nullValue())))
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
        +
        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))))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static Matcher<java.lang.Object> nullValue()
        +
        Creates a matcher that matches if examined object is null. + For example: +
        assertThat(cheese, is(nullValue())
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
        +
        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))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + + + +
        +
      • +

        sameInstance

        +
        public static <T> Matcher<T> sameInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + + + +
        +
      • +

        theInstance

        +
        public static <T> Matcher<T> theInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + +
        +
      • +

        containsString

        +
        public static Matcher<java.lang.String> containsString(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        containsStringIgnoringCase

        +
        public static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWith

        +
        public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String. +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWithIgnoringCase

        +
        public static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWith

        +
        public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWithIgnoringCase

        +
        public static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String, ignoring case. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        array

        +
        public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)
        +
        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: +
        assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
        +
        +
        Parameters:
        +
        elementMatchers - the matchers that the elements of examined arrays should satisfy
        +
        +
      • +
      + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
        +
        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: +
        assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
        +
        +
        Parameters:
        +
        elementMatcher - the matcher to apply to elements in examined arrays
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(T element)
        +
        A shortcut to the frequently used hasItemInArray(equalTo(x)). + For example: +
        assertThat(hasItemInArray(x))
        + instead of: +
        assertThat(hasItemInArray(equalTo(x)))
        +
        +
        Parameters:
        +
        element - the element that should be present in examined arrays
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(E... items)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items within an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items in the examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> 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: +
        assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
        +

        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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the entries of an examined array, in any order
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the length of an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(int size)
        +
        Creates a matcher for arrays that matches when the length of the array + equals the specified size. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
        +
        +
        Parameters:
        +
        size - the length that an examined array must have for a positive match
        +
        +
      • +
      + + + +
        +
      • +

        emptyArray

        +
        public static <E> Matcher<E[]> emptyArray()
        +
        Creates a matcher for arrays that matches when the length of the array + is zero. + For example: +
        assertThat(new String[0], emptyArray())
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(myMap, is(aMapWithSize(equalTo(2))))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(myMap, is(aMapWithSize(2)))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        anEmptyMap

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()
        +
        Creates a matcher for Maps that matches when the size() method returns + zero. + For example: +
        assertThat(myMap, is(anEmptyMap()))
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Collection
        +
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(2))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Collection
        +
        +
      • +
      + + + +
        +
      • +

        empty

        +
        public static <E> Matcher<java.util.Collection<? extends E>> empty()
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(empty()))
        +
      • +
      + + + +
        +
      • +

        emptyCollectionOf

        +
        public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the collection's content
        +
        +
      • +
      + + + +
        +
      • +

        emptyIterable

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterable()))
        +
      • +
      + + + +
        +
      • +

        emptyIterableOf

        +
        public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the iterable's content
        +
        +
      • +
      + + + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. For a positive match, the examined iterable + must be of the same length as the number of specified items. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. + For example: +
        assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. For a positive match, the examined iterable + must be of the same length as the number of specified matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. For a positive match, the examined iterable + must be of the same length as the specified list of matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. For a positive match, the examined iterable 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. For a positive match, the examined iterable + 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable in any order
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. For a positive match, the examined iterable + 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 iterable. +

        +

        For example:

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
        +
        +
        Parameters:
        +
        items - the items that must be contained within items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the items provided by + an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
        +
        +
        Parameters:
        +
        size - the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
        +                                                                             Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry
        +
        valueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry
        +
        +
      • +
      + + + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
        +                                                                             V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. + For example: +
        assertThat(myMap, hasEntry("bar", "foo"))
        +
        +
        Parameters:
        +
        key - the key that, in combination with the value, must be describe at least one entry
        +
        value - the value that, in combination with the key, must be describe at least one entry
        +
        +
      • +
      + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. + For example: +
        assertThat(myMap, hasKey(equalTo("bar")))
        +
        +
        Parameters:
        +
        keyMatcher - the matcher that must be satisfied by at least one key
        +
        +
      • +
      + + + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. + For example: +
        assertThat(myMap, hasKey("bar"))
        +
        +
        Parameters:
        +
        key - the key that satisfying maps must contain
        +
        +
      • +
      + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasValue(equalTo("foo")))
        +
        +
        Parameters:
        +
        valueMatcher - the matcher that must be satisfied by at least one value
        +
        +
      • +
      + + + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. + For example: +
        assertThat(myMap, hasValue("foo"))
        +
        +
        Parameters:
        +
        value - the value that satisfying maps must contain
        +
        +
      • +
      + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(java.util.Collection<T> collection)
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(T[] elements)
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", is(in(new String[]{"bar", "foo"})))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + +
        +
      • +

        isIn

        +
        public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", isIn(Arrays.asList("bar", "foo")))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isIn

        +
        public static <T> Matcher<T> isIn(T[] elements)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", isIn(new String[]{"bar", "foo"}))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isOneOf

        +
        public static <T> Matcher<T> isOneOf(T... elements)
        +
        Deprecated. use is(oneOf(...)) instead
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", isOneOf("bar", "foo"))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      + + + + + +
        +
      • +

        oneOf

        +
        public static <T> Matcher<T> oneOf(T... elements)
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", is(oneOf("bar", "foo")))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.lang.Double> closeTo(double operand,
        +                                                double error)
        +
        Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. + For example: +
        assertThat(1.03, is(closeTo(1.0, 0.03)))
        +
        +
        Parameters:
        +
        operand - the expected value of matching doubles
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      + + + +
        +
      • +

        notANumber

        +
        public static Matcher<java.lang.Double> notANumber()
        +
        Creates a matcher of Doubles that matches when an examined double is not a number. + For example: +
        assertThat(Double.NaN, is(notANumber()))
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand,
        +                                                    java.math.BigDecimal error)
        +
        Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. The comparison for equality + is done by BigDecimals BigDecimal.compareTo(java.math.BigDecimal) method. + For example: +
        assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
        +
        +
        Parameters:
        +
        operand - the expected value of matching BigDecimals
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      + + + + + +
        +
      • +

        comparesEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, comparesEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(2, greaterThan(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, greaterThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, lessThan(2))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, lessThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
        +
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringCase

        +
        public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. + For example: +
        assertThat("Foo", equalToIgnoringCase("FOO"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringWhiteSpace

        +
        public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. To be + exact, the following whitespace rules are applied: +
          +
        • all leading and trailing whitespace of both the expectedString and the examined string are ignored
        • +
        • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
        • +
        + For example: +
        assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      + + + +
        +
      • +

        emptyOrNullString

        +
        public static Matcher<java.lang.String> emptyOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), is(emptyOrNullString()))
        +
      • +
      + + + +
        +
      • +

        emptyString

        +
        public static Matcher<java.lang.String> emptyString()
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", is(emptyString()))
        +
      • +
      + + + +
        +
      • +

        isEmptyOrNullString

        +
        public static Matcher<java.lang.String> isEmptyOrNullString()
        +
        Deprecated. use is(emptyOrNullString()) instead
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), isEmptyOrNullString())
        +
      • +
      + + + +
        +
      • +

        isEmptyString

        +
        public static Matcher<java.lang.String> isEmptyString()
        +
        Deprecated. use is(emptyString()) instead
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", isEmptyString())
        +
      • +
      + + + +
        +
      • +

        blankOrNullString

        +
        public static Matcher<java.lang.String> blankOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else. + For example: +
        assertThat(((String)null), is(blankOrNullString()))
        +
      • +
      + + + +
        +
      • +

        blankString

        +
        public static Matcher<java.lang.String> blankString()
        +
        Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else. + For example: +
        assertThat("  ", is(blankString()))
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. + For example: +
        assertThat(true, hasToString(equalTo("TRUE")))
        +
        +
        Parameters:
        +
        toStringMatcher - the matcher used to verify the toString result
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. + For example: +
        assertThat(true, hasToString("TRUE"))
        +
        +
        Parameters:
        +
        expectedToString - the expected toString result
        +
        +
      • +
      + + + +
        +
      • +

        typeCompatibleWith

        +
        public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
        +
        Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. + For example: +
        assertThat(Integer.class, typeCompatibleWith(Number.class))
        +
        +
        Parameters:
        +
        baseType - the base class to examine classes against
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
        +                                                       java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
        +
        +
        Parameters:
        +
        eventClass - the class of the event to match on
        +
        source - the source of the event
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any EventObject + announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(myBean)))
        +
        +
        Parameters:
        +
        source - the source of the event
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. + For example: +
        assertThat(myBean, hasProperty("foo"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName,
        +                                         Matcher<?> valueMatcher)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. + For example: +
        assertThat(myBean, hasProperty("foo", equalTo("bar"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        valueMatcher - a matcher for the value of the specified property of the examined bean
        +
        +
      • +
      + + + + + +
        +
      • +

        samePropertyValuesAs

        +
        public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)
        +
        Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. + For example: +
        assertThat(myBean, samePropertyValuesAs(myExpectedBean))
        +
        +
        Parameters:
        +
        expectedBean - the bean against which examined beans are compared
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese"))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/SelfDescribing.html b/docs/javadoc/2.0.0.0/org/hamcrest/SelfDescribing.html new file mode 100644 index 00000000..5e13a62d --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/SelfDescribing.html @@ -0,0 +1,237 @@ + + + + + +SelfDescribing (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface SelfDescribing

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        void describeTo(Description description)
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/StringDescription.html b/docs/javadoc/2.0.0.0/org/hamcrest/StringDescription.html new file mode 100644 index 00000000..ca36fac2 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/StringDescription.html @@ -0,0 +1,417 @@ + + + + + +StringDescription (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class StringDescription

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringDescription

        +
        public StringDescription()
        +
      • +
      + + + +
        +
      • +

        StringDescription

        +
        public StringDescription(java.lang.Appendable out)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        toString

        +
        public static java.lang.String toString(SelfDescribing selfDescribing)
        +
        Return the description of a SelfDescribing object as a String.
        +
        +
        Parameters:
        +
        selfDescribing - The object to be described.
        +
        Returns:
        +
        The description of the object.
        +
        +
      • +
      + + + + + + + +
        +
      • +

        append

        +
        protected void append(java.lang.String str)
        +
        Description copied from class: BaseDescription
        +
        Append the String str to the description. + The default implementation passes every character to BaseDescription.append(char). + Override in subclasses to provide an efficient implementation.
        +
        +
        Overrides:
        +
        append in class BaseDescription
        +
        +
      • +
      + + + +
        +
      • +

        append

        +
        protected void append(char c)
        +
        Description copied from class: BaseDescription
        +
        Append the char c to the description.
        +
        +
        Specified by:
        +
        append in class BaseDescription
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Returns the description as a string.
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/TypeSafeDiagnosingMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/TypeSafeDiagnosingMatcher.html new file mode 100644 index 00000000..97de9c8c --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/TypeSafeDiagnosingMatcher.html @@ -0,0 +1,423 @@ + + + + + +TypeSafeDiagnosingMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class TypeSafeDiagnosingMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TypeSafeDiagnosingMatcher

        +
        protected TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        expectedType - The expectedType of the actual value.
        +
        +
      • +
      + + + +
        +
      • +

        TypeSafeDiagnosingMatcher

        +
        protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        typeFinder - A type finder to extract the type
        +
        +
      • +
      + + + +
        +
      • +

        TypeSafeDiagnosingMatcher

        +
        protected TypeSafeDiagnosingMatcher()
        +
        The default constructor for simple sub types
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        protected abstract boolean matchesSafely(T item,
        +                                         Description mismatchDescription)
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
      • +
      + + + +
        +
      • +

        matches

        +
        public final boolean matches(java.lang.Object item)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        item - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public final void describeMismatch(java.lang.Object item,
        +                                   Description mismatchDescription)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/TypeSafeMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/TypeSafeMatcher.html new file mode 100644 index 00000000..66115555 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/TypeSafeMatcher.html @@ -0,0 +1,432 @@ + + + + + +TypeSafeMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class TypeSafeMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TypeSafeMatcher

        +
        protected TypeSafeMatcher()
        +
        The default constructor for simple sub types
        +
      • +
      + + + +
        +
      • +

        TypeSafeMatcher

        +
        protected TypeSafeMatcher(java.lang.Class<?> expectedType)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        expectedType - The expectedType of the actual value.
        +
        +
      • +
      + + + +
        +
      • +

        TypeSafeMatcher

        +
        protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        typeFinder - A type finder to extract the type
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        protected abstract boolean matchesSafely(T item)
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        protected void describeMismatchSafely(T item,
        +                                      Description mismatchDescription)
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
      • +
      + + + +
        +
      • +

        matches

        +
        public final boolean matches(java.lang.Object item)
        +
        Methods made final to prevent accidental override. + If you need to override this, there's no point on extending TypeSafeMatcher. + Instead, extend the BaseMatcher.
        +
        +
        Parameters:
        +
        item - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public final void describeMismatch(java.lang.Object item,
        +                                   Description description)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/HasProperty.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/HasProperty.html new file mode 100644 index 00000000..6896019b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/HasProperty.html @@ -0,0 +1,384 @@ + + + + + +HasProperty (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class HasProperty<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class HasProperty<T>
    +extends TypeSafeMatcher<T>
    +
    A Matcher that checks that an object has a JavaBean property + with the specified name. If an error occurs during introspection + of the object then this is treated as a mismatch.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasProperty

        +
        public HasProperty(java.lang.String propertyName)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(T obj)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<T>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(T item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<T>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. + For example: +
        assertThat(myBean, hasProperty("foo"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/HasPropertyWithValue.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/HasPropertyWithValue.html new file mode 100644 index 00000000..d809cc0d --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/HasPropertyWithValue.html @@ -0,0 +1,408 @@ + + + + + +HasPropertyWithValue (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class HasPropertyWithValue<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class HasPropertyWithValue<T>
    +extends TypeSafeDiagnosingMatcher<T>
    +

    Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. This is useful for when objects + are created within code under test and passed to a mock object, and you wish + to assert that the created object has certain properties. +

    + +

    Example Usage

    + Consider the situation where we have a class representing a person, which + follows the basic JavaBean convention of having get() and possibly set() + methods for it's properties: +
    + public class Person {
    +   private String name;
    +   public Person(String person) {
    +     this.person = person;
    +   }
    +   public String getName() {
    +     return name;
    +   }
    + }
    + + And that these person objects are generated within a piece of code under test + (a class named PersonGenerator). This object is sent to one of our mock objects + which overrides the PersonGenerationListener interface: +
    + public interface PersonGenerationListener {
    +   public void personGenerated(Person person);
    + }
    + + In order to check that the code under test generates a person with name + "Iain" we would do the following: +
    + Mock personGenListenerMock = mock(PersonGenerationListener.class);
    + personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain")));
    + PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy();
    + +

    If an exception is thrown by the getter method for a property, the property + does not exist, is not readable, or a reflection related exception is thrown + when trying to invoke it then this is treated as an evaluation failure and + the matches method will return false. +

    +

    This matcher class will also work with JavaBean objects that have explicit + bean descriptions via an associated BeanInfo description class. See the + JavaBeans specification for more information: + http://java.sun.com/products/javabeans/docs/index.html +

    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasPropertyWithValue

        +
        public HasPropertyWithValue(java.lang.String propertyName,
        +                            Matcher<?> valueMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName,
        +                                         Matcher<?> valueMatcher)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. + For example: +
        assertThat(myBean, hasProperty("foo", equalTo("bar"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        valueMatcher - a matcher for the value of the specified property of the examined bean
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/PropertyUtil.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/PropertyUtil.html new file mode 100644 index 00000000..5b7a5d79 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/PropertyUtil.html @@ -0,0 +1,354 @@ + + + + + +PropertyUtil (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class PropertyUtil

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.beans.PropertyUtil
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class PropertyUtil
    +extends java.lang.Object
    +
    Utility class for accessing properties on JavaBean objects. + See http://java.sun.com/products/javabeans/docs/index.html for + more information on JavaBeans.
    +
    +
    Since:
    +
    1.1.0
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static java.lang.Object[]NO_ARGUMENTS 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      PropertyUtil() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static java.beans.PropertyDescriptorgetPropertyDescriptor(java.lang.String propertyName, + java.lang.Object fromObj) +
      Returns the description of the property with the provided + name on the provided object's interface.
      +
      static java.beans.PropertyDescriptor[]propertyDescriptorsFor(java.lang.Object fromObj, + java.lang.Class<java.lang.Object> stopClass) +
      Returns all the property descriptors for the class associated with the given object
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NO_ARGUMENTS

        +
        public static final java.lang.Object[] NO_ARGUMENTS
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        PropertyUtil

        +
        public PropertyUtil()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getPropertyDescriptor

        +
        public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName,
        +                                                                  java.lang.Object fromObj)
        +                                                           throws java.lang.IllegalArgumentException
        +
        Returns the description of the property with the provided + name on the provided object's interface.
        +
        +
        Returns:
        +
        the descriptor of the property, or null if the property does not exist.
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if there's a introspection failure
        +
        +
      • +
      + + + +
        +
      • +

        propertyDescriptorsFor

        +
        public static java.beans.PropertyDescriptor[] propertyDescriptorsFor(java.lang.Object fromObj,
        +                                                                     java.lang.Class<java.lang.Object> stopClass)
        +                                                              throws java.lang.IllegalArgumentException
        +
        Returns all the property descriptors for the class associated with the given object
        +
        +
        Parameters:
        +
        fromObj - Use the class of this object
        +
        stopClass - Don't include any properties from this ancestor class upwards.
        +
        Returns:
        +
        Property descriptors
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if there's a introspection failure
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/SamePropertyValuesAs.PropertyMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/SamePropertyValuesAs.PropertyMatcher.html new file mode 100644 index 00000000..dc44dffd --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/SamePropertyValuesAs.PropertyMatcher.html @@ -0,0 +1,332 @@ + + + + + +SamePropertyValuesAs.PropertyMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class SamePropertyValuesAs.PropertyMatcher

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        PropertyMatcher

        +
        public PropertyMatcher(java.beans.PropertyDescriptor descriptor,
        +                       java.lang.Object expectedObject)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/SamePropertyValuesAs.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/SamePropertyValuesAs.html new file mode 100644 index 00000000..fd54cb16 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/SamePropertyValuesAs.html @@ -0,0 +1,382 @@ + + + + + +SamePropertyValuesAs (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class SamePropertyValuesAs<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        SamePropertyValuesAs

        +
        public SamePropertyValuesAs(T expectedBean)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        samePropertyValuesAs

        +
        public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)
        +
        Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. + For example: +
        assertThat(myBean, samePropertyValuesAs(myExpectedBean))
        +
        +
        Parameters:
        +
        expectedBean - the bean against which examined beans are compared
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-frame.html new file mode 100644 index 00000000..1503ecc1 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-frame.html @@ -0,0 +1,24 @@ + + + + + +org.hamcrest.beans (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.beans

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-summary.html new file mode 100644 index 00000000..0ce56cec --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-summary.html @@ -0,0 +1,173 @@ + + + + + +org.hamcrest.beans (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.beans

+
+
Matchers of Java Bean properties and their values.
+
+

See: Description

+
+
+ + + + +

Package org.hamcrest.beans Description

+

Matchers of Java Bean properties and their values.

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-tree.html new file mode 100644 index 00000000..6f03a02a --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/beans/package-tree.html @@ -0,0 +1,155 @@ + + + + + +org.hamcrest.beans Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.beans

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArray.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArray.html new file mode 100644 index 00000000..1b1af959 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArray.html @@ -0,0 +1,440 @@ + + + + + +IsArray (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArray<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T[]>, SelfDescribing
    +
    +
    +
    +
    public class IsArray<T>
    +extends TypeSafeMatcher<T[]>
    +
    Matcher for array whose elements satisfy a sequence of matchers. + The array size must equal the number of element matchers.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArray

        +
        public IsArray(Matcher<? super T>[] elementMatchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(T[] array)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(T[] actual,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        descriptionStart

        +
        protected java.lang.String descriptionStart()
        +
        Returns the string that starts the description. + + Can be overridden in subclasses to customise how the matcher is + described.
        +
      • +
      + + + +
        +
      • +

        descriptionSeparator

        +
        protected java.lang.String descriptionSeparator()
        +
        Returns the string that separates the elements in the description. + + Can be overridden in subclasses to customise how the matcher is + described.
        +
      • +
      + + + +
        +
      • +

        descriptionEnd

        +
        protected java.lang.String descriptionEnd()
        +
        Returns the string that ends the description. + + Can be overridden in subclasses to customise how the matcher is + described.
        +
      • +
      + + + +
        +
      • +

        array

        +
        public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)
        +
        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: +
        assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
        +
        +
        Parameters:
        +
        elementMatchers - the matchers that the elements of examined arrays should satisfy
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContaining.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContaining.html new file mode 100644 index 00000000..516367b2 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContaining.html @@ -0,0 +1,409 @@ + + + + + +IsArrayContaining (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArrayContaining<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T[]>, SelfDescribing
    +
    +
    +
    +
    public class IsArrayContaining<T>
    +extends TypeSafeMatcher<T[]>
    +
    Matches if an array contains an item satisfying a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArrayContaining

        +
        public IsArrayContaining(Matcher<? super T> elementMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(T[] array)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(T[] item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
        +
        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: +
        assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
        +
        +
        Parameters:
        +
        elementMatcher - the matcher to apply to elements in examined arrays
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(T element)
        +
        A shortcut to the frequently used hasItemInArray(equalTo(x)). + For example: +
        assertThat(hasItemInArray(x))
        + instead of: +
        assertThat(hasItemInArray(equalTo(x)))
        +
        +
        Parameters:
        +
        element - the element that should be present in examined arrays
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContainingInAnyOrder.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContainingInAnyOrder.html new file mode 100644 index 00000000..f5a785ab --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContainingInAnyOrder.html @@ -0,0 +1,464 @@ + + + + + +IsArrayContainingInAnyOrder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArrayContainingInAnyOrder<E>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArrayContainingInAnyOrder

        +
        public IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(E[] item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(E[] item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
        +

        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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the entries of an examined array, in any order
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContainingInOrder.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContainingInOrder.html new file mode 100644 index 00000000..71e3463b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayContainingInOrder.html @@ -0,0 +1,434 @@ + + + + + +IsArrayContainingInOrder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArrayContainingInOrder<E>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArrayContainingInOrder

        +
        public IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(E[] item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(E[] item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(E... items)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items within an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items in the examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> 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: +
        assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayWithSize.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayWithSize.html new file mode 100644 index 00000000..f2ca5798 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsArrayWithSize.html @@ -0,0 +1,392 @@ + + + + + +IsArrayWithSize (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArrayWithSize<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<E[]>, SelfDescribing
    +
    +
    +
    +
    public class IsArrayWithSize<E>
    +extends FeatureMatcher<E[],java.lang.Integer>
    +
    Matches if array size satisfies a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArrayWithSize

        +
        public IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(E[] actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<E[],java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the length of an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(int size)
        +
        Creates a matcher for arrays that matches when the length of the array + equals the specified size. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
        +
        +
        Parameters:
        +
        size - the length that an examined array must have for a positive match
        +
        +
      • +
      + + + +
        +
      • +

        emptyArray

        +
        public static <E> Matcher<E[]> emptyArray()
        +
        Creates a matcher for arrays that matches when the length of the array + is zero. + For example: +
        assertThat(new String[0], emptyArray())
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsCollectionWithSize.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsCollectionWithSize.html new file mode 100644 index 00000000..de69caf2 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsCollectionWithSize.html @@ -0,0 +1,370 @@ + + + + + +IsCollectionWithSize (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsCollectionWithSize<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Collection<? extends E>>, SelfDescribing
    +
    +
    +
    +
    public class IsCollectionWithSize<E>
    +extends FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
    +
    Matches if collection size satisfies a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCollectionWithSize

        +
        public IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Collection
        +
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(2))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Collection
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsEmptyCollection.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsEmptyCollection.html new file mode 100644 index 00000000..ffcc083b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsEmptyCollection.html @@ -0,0 +1,398 @@ + + + + + +IsEmptyCollection (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsEmptyCollection<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Collection<? extends E>>, SelfDescribing
    +
    +
    +
    +
    public class IsEmptyCollection<E>
    +extends TypeSafeMatcher<java.util.Collection<? extends E>>
    +
    Tests if collection is empty.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEmptyCollection

        +
        public IsEmptyCollection()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.util.Collection<? extends E> item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.util.Collection<? extends E> item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        empty

        +
        public static <E> Matcher<java.util.Collection<? extends E>> empty()
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(empty()))
        +
      • +
      + + + +
        +
      • +

        emptyCollectionOf

        +
        public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the collection's content
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsEmptyIterable.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsEmptyIterable.html new file mode 100644 index 00000000..36d3b3ca --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsEmptyIterable.html @@ -0,0 +1,394 @@ + + + + + +IsEmptyIterable (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsEmptyIterable<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Iterable<? extends E>>, SelfDescribing
    +
    +
    +
    +
    public class IsEmptyIterable<E>
    +extends TypeSafeMatcher<java.lang.Iterable<? extends E>>
    +
    Tests if collection is empty.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEmptyIterable

        +
        public IsEmptyIterable()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Iterable<? extends E> iterable)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Iterable<? extends E> iter,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        emptyIterable

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterable()))
        +
      • +
      + + + +
        +
      • +

        emptyIterableOf

        +
        public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the iterable's content
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIn.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIn.html new file mode 100644 index 00000000..b3c96d73 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIn.html @@ -0,0 +1,500 @@ + + + + + +IsIn (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIn<T>

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      IsIn(java.util.Collection<T> collection) 
      IsIn(T[] elements) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description buffer) +
      Generates a description of the object.
      +
      static <T> Matcher<T>in(java.util.Collection<T> collection) +
      Creates a matcher that matches when the examined object is found within the + specified collection.
      +
      static <T> Matcher<T>in(T[] elements) +
      Creates a matcher that matches when the examined object is found within the + specified array.
      +
      static <T> Matcher<T>isIn(java.util.Collection<T> collection) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isIn(T[] elements) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isOneOf(T... elements) +
      Deprecated.  +
      use is(oneOf(...)) instead
      +
      +
      booleanmatches(java.lang.Object o) +
      Evaluates the matcher for argument item.
      +
      static <T> Matcher<T>oneOf(T... elements) +
      Creates a matcher that matches when the examined object is equal to one of the + specified elements.
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIn

        +
        public IsIn(java.util.Collection<T> collection)
        +
      • +
      + + + + + +
        +
      • +

        IsIn

        +
        public IsIn(T[] elements)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description buffer)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        buffer - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        isIn

        +
        @Deprecated
        +public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", isIn(Arrays.asList("bar", "foo")))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(java.util.Collection<T> collection)
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isIn

        +
        @Deprecated
        +public static <T> Matcher<T> isIn(T[] elements)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", isIn(new String[]{"bar", "foo"}))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(T[] elements)
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", is(in(new String[]{"bar", "foo"})))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isOneOf

        +
        @Deprecated
        +public static <T> Matcher<T> isOneOf(T... elements)
        +
        Deprecated. use is(oneOf(...)) instead
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", isOneOf("bar", "foo"))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      + + + + + +
        +
      • +

        oneOf

        +
        public static <T> Matcher<T> oneOf(T... elements)
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", is(oneOf("bar", "foo")))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInAnyOrder.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInAnyOrder.html new file mode 100644 index 00000000..6f22ba8d --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInAnyOrder.html @@ -0,0 +1,442 @@ + + + + + +IsIterableContainingInAnyOrder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableContainingInAnyOrder<T>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(Matcher<? super T>... itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(T... items) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? extends T> items, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableContainingInAnyOrder

        +
        public IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? extends T> items,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. For a positive match, the examined iterable 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. For a positive match, the examined iterable + 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable in any order
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. For a positive match, the examined iterable + 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 iterable. +

        +

        For example:

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInOrder.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInOrder.html new file mode 100644 index 00000000..4ce7f5d5 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInOrder.html @@ -0,0 +1,441 @@ + + + + + +IsIterableContainingInOrder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableContainingInOrder<E>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E> itemMatcher) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableContainingInOrder

        +
        public IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? extends E> iterable,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. For a positive match, the examined iterable + must be of the same length as the number of specified items. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. + For example: +
        assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. For a positive match, the examined iterable + must be of the same length as the number of specified matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. For a positive match, the examined iterable + must be of the same length as the specified list of matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html new file mode 100644 index 00000000..4771346c --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html @@ -0,0 +1,413 @@ + + + + + +IsIterableContainingInRelativeOrder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableContainingInRelativeOrder<E>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableContainingInRelativeOrder

        +
        public IsIterableContainingInRelativeOrder(java.util.List<Matcher<? super E>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? extends E> iterable,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
        +
        +
        Parameters:
        +
        items - the items that must be contained within items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the items provided by + an examined Iterable in the same relative order
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableWithSize.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableWithSize.html new file mode 100644 index 00000000..8a01d0b7 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsIterableWithSize.html @@ -0,0 +1,373 @@ + + + + + +IsIterableWithSize (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableWithSize<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Iterable<E>>, SelfDescribing
    +
    +
    +
    +
    public class IsIterableWithSize<E>
    +extends FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableWithSize

        +
        public IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
        +
        +
        Parameters:
        +
        size - the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsMapContaining.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsMapContaining.html new file mode 100644 index 00000000..230e408b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsMapContaining.html @@ -0,0 +1,515 @@ + + + + + +IsMapContaining (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsMapContaining<K,V>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Map<? extends K,? extends V>>, SelfDescribing
    +
    +
    +
    +
    public class IsMapContaining<K,V>
    +extends TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      IsMapContaining(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeMismatchSafely(java.util.Map<? extends K,? extends V> map, + Description mismatchDescription) +
      Subclasses should override this.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(K key, + V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(K key) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(Matcher<? super K> keyMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
      +
      booleanmatchesSafely(java.util.Map<? extends K,? extends V> map) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsMapContaining

        +
        public IsMapContaining(Matcher<? super K> keyMatcher,
        +                       Matcher<? super V> valueMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.util.Map<? extends K,? extends V> map)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
        +                                                                             Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry
        +
        valueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry
        +
        +
      • +
      + + + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
        +                                                                             V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. + For example: +
        assertThat(myMap, hasEntry("bar", "foo"))
        +
        +
        Parameters:
        +
        key - the key that, in combination with the value, must be describe at least one entry
        +
        value - the value that, in combination with the key, must be describe at least one entry
        +
        +
      • +
      + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. + For example: +
        assertThat(myMap, hasKey(equalTo("bar")))
        +
        +
        Parameters:
        +
        keyMatcher - the matcher that must be satisfied by at least one key
        +
        +
      • +
      + + + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. + For example: +
        assertThat(myMap, hasKey("bar"))
        +
        +
        Parameters:
        +
        key - the key that satisfying maps must contain
        +
        +
      • +
      + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasValue(equalTo("foo")))
        +
        +
        Parameters:
        +
        valueMatcher - the matcher that must be satisfied by at least one value
        +
        +
      • +
      + + + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. + For example: +
        assertThat(myMap, hasValue("foo"))
        +
        +
        Parameters:
        +
        value - the value that satisfying maps must contain
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsMapWithSize.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsMapWithSize.html new file mode 100644 index 00000000..e728e7a0 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/IsMapWithSize.html @@ -0,0 +1,390 @@ + + + + + +IsMapWithSize (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsMapWithSize<K,V>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Map<? extends K,? extends V>>, SelfDescribing
    +
    +
    +
    +
    public final class IsMapWithSize<K,V>
    +extends FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>
    +
    Matches if map size satisfies a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsMapWithSize

        +
        public IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(java.util.Map<? extends K,? extends V> actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(myMap, is(aMapWithSize(equalTo(2))))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(myMap, is(aMapWithSize(2)))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        anEmptyMap

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()
        +
        Creates a matcher for Maps that matches when the size() method returns + zero. + For example: +
        assertThat(myMap, is(anEmptyMap()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-frame.html new file mode 100644 index 00000000..a7959e6e --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-frame.html @@ -0,0 +1,34 @@ + + + + + +org.hamcrest.collection (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.collection

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-summary.html new file mode 100644 index 00000000..2e4fa2f9 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-summary.html @@ -0,0 +1,219 @@ + + + + + +org.hamcrest.collection (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.collection

+
+
Matchers of arrays and collections.
+
+

See: Description

+
+
+ + + + +

Package org.hamcrest.collection Description

+

Matchers of arrays and collections.

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-tree.html new file mode 100644 index 00000000..1969ec30 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/collection/package-tree.html @@ -0,0 +1,165 @@ + + + + + +org.hamcrest.collection Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.collection

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/comparator/ComparatorMatcherBuilder.html b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/ComparatorMatcherBuilder.html new file mode 100644 index 00000000..5896a364 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/ComparatorMatcherBuilder.html @@ -0,0 +1,406 @@ + + + + + +ComparatorMatcherBuilder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.comparator
+

Class ComparatorMatcherBuilder<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.comparator.ComparatorMatcherBuilder<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public final class ComparatorMatcherBuilder<T>
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T> ComparatorMatcherBuilder<T>comparedBy(java.util.Comparator<T> comparator) +
      Creates a matcher factory for matchers of Comparatorss of T.
      +
      Matcher<T>comparesEqualTo(T value) +
      Creates a matcher of T object that matches when the examined object is + equal to the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>greaterThan(T value) +
      Creates a matcher of T object that matches when the examined object is + greater than the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>greaterThanOrEqualTo(T value) +
      Creates a matcher of T object that matches when the examined object is + greater than or equal to the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>lessThan(T value) +
      Creates a matcher of T object that matches when the examined object is + less than the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>lessThanOrEqualTo(T value) +
      Creates a matcher of T object that matches when the examined object is + less than or equal to the specified value, as reported by the Comparator used to + create this builder.
      +
      static <T extends java.lang.Comparable<T>>
      ComparatorMatcherBuilder<T>
      usingNaturalOrdering() +
      Creates a matcher factory for matchers of Comparables.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        usingNaturalOrdering

        +
        public static <T extends java.lang.Comparable<T>> ComparatorMatcherBuilder<T> usingNaturalOrdering()
        +
        Creates a matcher factory for matchers of Comparables. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
        +
      • +
      + + + +
        +
      • +

        comparedBy

        +
        public static <T> ComparatorMatcherBuilder<T> comparedBy(java.util.Comparator<T> comparator)
        +
        Creates a matcher factory for matchers of Comparatorss of T. + For example: +
        assertThat(5, comparedBy(new Comparator<Integer>() {
        + public int compare(Integer o1, Integer o2) {
        + return -o1.compareTo(o2);
        + }
        + }).lessThan(4))
        +
      • +
      + + + + + +
        +
      • +

        comparesEqualTo

        +
        public Matcher<T> comparesEqualTo(T value)
        +
        Creates a matcher of T object that matches when the examined object is + equal to the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().comparesEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThan

        +
        public Matcher<T> greaterThan(T value)
        +
        Creates a matcher of T object that matches when the examined object is + greater than the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(2, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThan(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return greater + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThanOrEqualTo

        +
        public Matcher<T> greaterThanOrEqualTo(T value)
        +
        Creates a matcher of T object that matches when the examined object is + greater than or equal to the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return greater + than or equal to zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThan

        +
        public Matcher<T> lessThan(T value)
        +
        Creates a matcher of T object that matches when the examined object is + less than the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThan(2))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return less + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThanOrEqualTo

        +
        public Matcher<T> lessThanOrEqualTo(T value)
        +
        Creates a matcher of T object that matches when the examined object is + less than or equal to the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return less + than or equal to zero
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-frame.html new file mode 100644 index 00000000..2776c536 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-frame.html @@ -0,0 +1,20 @@ + + + + + +org.hamcrest.comparator (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.comparator

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-summary.html new file mode 100644 index 00000000..beb9a727 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-summary.html @@ -0,0 +1,140 @@ + + + + + +org.hamcrest.comparator (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.comparator

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-tree.html new file mode 100644 index 00000000..914b9104 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/comparator/package-tree.html @@ -0,0 +1,135 @@ + + + + + +org.hamcrest.comparator Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.comparator

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/AllOf.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/AllOf.html new file mode 100644 index 00000000..bcffcf38 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/AllOf.html @@ -0,0 +1,365 @@ + + + + + +AllOf (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class AllOf<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class AllOf<T>
    +extends DiagnosingMatcher<T>
    +
    Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so + subsequent matchers are not called if an earlier matcher returns false.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        AllOf

        +
        public AllOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/AnyOf.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/AnyOf.html new file mode 100644 index 00000000..20856eda --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/AnyOf.html @@ -0,0 +1,398 @@ + + + + + +AnyOf (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class AnyOf<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class AnyOf<T>
    +extends BaseMatcher<T>
    +
    Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so + subsequent matchers are not called if an earlier matcher returns true.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      AnyOf(java.lang.Iterable<Matcher<? super T>> matchers) 
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        AnyOf

        +
        public AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Specified by:
        +
        matches in interface Matcher<T>
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Specified by:
        +
        describeTo in interface SelfDescribing
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        @SafeVarargs
        +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        matches

        +
        protected boolean matches(java.lang.Object o,
        +                          boolean shortcut)
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description,
        +                       java.lang.String operator)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html new file mode 100644 index 00000000..82abfd65 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html @@ -0,0 +1,273 @@ + + + + + +CombinableMatcher.CombinableBothMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class CombinableMatcher.CombinableBothMatcher<X>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<X>
    • +
    +
  • +
+
+
    +
  • +
    +
    Enclosing class:
    +
    CombinableMatcher<T>
    +
    +
    +
    +
    public static final class CombinableMatcher.CombinableBothMatcher<X>
    +extends java.lang.Object
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html new file mode 100644 index 00000000..7e31ac30 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html @@ -0,0 +1,273 @@ + + + + + +CombinableMatcher.CombinableEitherMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class CombinableMatcher.CombinableEitherMatcher<X>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher<X>
    • +
    +
  • +
+
+
    +
  • +
    +
    Enclosing class:
    +
    CombinableMatcher<T>
    +
    +
    +
    +
    public static final class CombinableMatcher.CombinableEitherMatcher<X>
    +extends java.lang.Object
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.html new file mode 100644 index 00000000..6309a2e7 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/CombinableMatcher.html @@ -0,0 +1,418 @@ + + + + + +CombinableMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class CombinableMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CombinableMatcher

        +
        public CombinableMatcher(Matcher<? super T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + + + + + + + +
        +
      • +

        both

        +
        public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when both of the specified matchers match the examined object. + For example: +
        assertThat("fab", both(containsString("a")).and(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        either

        +
        public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when either of the specified matchers match the examined object. + For example: +
        assertThat("fan", either(containsString("a")).or(containsString("b")))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/DescribedAs.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/DescribedAs.html new file mode 100644 index 00000000..cdc52121 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/DescribedAs.html @@ -0,0 +1,391 @@ + + + + + +DescribedAs (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class DescribedAs<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class DescribedAs<T>
    +extends BaseMatcher<T>
    +
    Provides a custom description to another matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        DescribedAs

        +
        public DescribedAs(java.lang.String descriptionTemplate,
        +                   Matcher<T> matcher,
        +                   java.lang.Object[] values)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public void describeMismatch(java.lang.Object item,
        +                             Description description)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        describedAs

        +
        public static <T> Matcher<T> describedAs(java.lang.String description,
        +                                         Matcher<T> matcher,
        +                                         java.lang.Object... values)
        +
        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())
        +
        +
        Parameters:
        +
        description - the new description for the wrapped matcher
        +
        matcher - the matcher to wrap
        +
        values - optional values to insert into the tokenised description
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/Every.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/Every.html new file mode 100644 index 00000000..c2dafdd8 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/Every.html @@ -0,0 +1,357 @@ + + + + + +Every (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class Every<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Every

        +
        public Every(Matcher<? super T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Iterable<? extends T> collection,
        +                             Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        everyItem

        +
        public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. + For example: +
        assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to every item provided by the examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/Is.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/Is.html new file mode 100644 index 00000000..d756485e --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/Is.html @@ -0,0 +1,426 @@ + + + + + +Is (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class Is<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class Is<T>
    +extends BaseMatcher<T>
    +
    Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. + + For example: assertThat(cheese, equalTo(smelly)) + vs. assertThat(cheese, is(equalTo(smelly)))
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Is(Matcher<T> matcher) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeMismatch(java.lang.Object item, + Description mismatchDescription) +
      Generate a description of why the matcher has not accepted the item.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static <T> Matcher<T>is(Matcher<T> matcher) +
      Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
      +
      static <T> Matcher<T>is(T value) +
      A shortcut to the frequently used is(equalTo(x)).
      +
      static <T> Matcher<T>isA(java.lang.Class<T> type) +
      A shortcut to the frequently used is(instanceOf(SomeClass.class)).
      +
      booleanmatches(java.lang.Object arg) +
      Evaluates the matcher for argument item.
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Is

        +
        public Is(Matcher<T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object arg)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        arg - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public void describeMismatch(java.lang.Object item,
        +                             Description mismatchDescription)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(Matcher<T> matcher)
        +
        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))
        +
      • +
      + + + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(T value)
        +
        A shortcut to the frequently used is(equalTo(x)). + For example: +
        assertThat(cheese, is(smelly))
        + instead of: +
        assertThat(cheese, is(equalTo(smelly)))
        +
      • +
      + + + +
        +
      • +

        isA

        +
        public static <T> Matcher<T> isA(java.lang.Class<T> type)
        +
        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)))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/IsAnything.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsAnything.html new file mode 100644 index 00000000..3d360634 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsAnything.html @@ -0,0 +1,376 @@ + + + + + +IsAnything (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsAnything<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsAnything<T>
    +extends BaseMatcher<T>
    +
    A matcher that always returns true.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsAnything

        +
        public IsAnything()
        +
      • +
      + + + +
        +
      • +

        IsAnything

        +
        public IsAnything(java.lang.String message)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything()
        +
        Creates a matcher that always matches, regardless of the examined object.
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything(java.lang.String description)
        +
        Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
        +
        +
        Parameters:
        +
        description - a meaningful String used when describing itself
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/IsCollectionContaining.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsCollectionContaining.html new file mode 100644 index 00000000..68612a32 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsCollectionContaining.html @@ -0,0 +1,445 @@ + + + + + +IsCollectionContaining (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsCollectionContaining<T>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(Matcher<? super T> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(T item) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(Matcher<? super T>... itemMatchers) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(T... items) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCollectionContaining

        +
        public IsCollectionContaining(Matcher<? super T> elementMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? super T> collection,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        +
        +
        Parameters:
        +
        item - the item to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        +
        +
        Parameters:
        +
        items - the items to compare against the items provided by the examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/IsEqual.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsEqual.html new file mode 100644 index 00000000..23072803 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsEqual.html @@ -0,0 +1,385 @@ + + + + + +IsEqual (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsEqual<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsEqual<T>
    +extends BaseMatcher<T>
    +
    Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      IsEqual(T equalArg) 
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        IsEqual

        +
        public IsEqual(T equalArg)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object actualValue)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        actualValue - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        equalTo

        +
        public static <T> Matcher<T> equalTo(T operand)
        +
        Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

        + For example: +
        + assertThat("foo", equalTo("foo"));
        + assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
        + 
        +
      • +
      + + + +
        +
      • +

        equalToObject

        +
        public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)
        +
        Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/IsInstanceOf.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsInstanceOf.html new file mode 100644 index 00000000..0a4d495a --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsInstanceOf.html @@ -0,0 +1,386 @@ + + + + + +IsInstanceOf (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsInstanceOf

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Object>, SelfDescribing
    +
    +
    +
    +
    public class IsInstanceOf
    +extends DiagnosingMatcher<java.lang.Object>
    +
    Tests whether the value is an instance of a class. + Classes of basic types will be converted to the relevant "Object" classes
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      IsInstanceOf(java.lang.Class<?> expectedClass) +
      Creates a new instance of IsInstanceOf
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T> Matcher<T>any(java.lang.Class<T> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static <T> Matcher<T>instanceOf(java.lang.Class<?> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      protected booleanmatches(java.lang.Object item, + Description mismatch) 
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsInstanceOf

        +
        public IsInstanceOf(java.lang.Class<?> expectedClass)
        +
        Creates a new instance of IsInstanceOf
        +
        +
        Parameters:
        +
        expectedClass - The predicate evaluates to true for instances of this class + or one of its subclasses.
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        instanceOf

        +
        public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

        + For example: +
        assertThat(new Canoe(), instanceOf(Paddlable.class));
        +
      • +
      + + + +
        +
      • +

        any

        +
        public static <T> Matcher<T> any(java.lang.Class<T> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/IsNot.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsNot.html new file mode 100644 index 00000000..1fd050e0 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsNot.html @@ -0,0 +1,376 @@ + + + + + +IsNot (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsNot<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsNot<T>
    +extends BaseMatcher<T>
    +
    Calculates the logical negation of a matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsNot

        +
        public IsNot(Matcher<T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object arg)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        arg - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(Matcher<T> matcher)
        +
        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))))
        +
        +
        Parameters:
        +
        matcher - the matcher whose sense should be inverted
        +
        +
      • +
      + + + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(T value)
        +
        A shortcut to the frequently used not(equalTo(x)). + For example: +
        assertThat(cheese, is(not(smelly)))
        + instead of: +
        assertThat(cheese, is(not(equalTo(smelly))))
        +
        +
        Parameters:
        +
        value - the value that any examined object should not equal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/IsNull.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsNull.html new file mode 100644 index 00000000..a42a1e88 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsNull.html @@ -0,0 +1,412 @@ + + + + + +IsNull (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsNull<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsNull

        +
        public IsNull()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static Matcher<java.lang.Object> nullValue()
        +
        Creates a matcher that matches if examined object is null. + For example: +
        assertThat(cheese, is(nullValue())
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static Matcher<java.lang.Object> notNullValue()
        +
        A shortcut to the frequently used not(nullValue()). + For example: +
        assertThat(cheese, is(notNullValue()))
        + instead of: +
        assertThat(cheese, is(not(nullValue())))
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
        +
        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))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
        +
        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))))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/IsSame.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsSame.html new file mode 100644 index 00000000..ffc5fb72 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/IsSame.html @@ -0,0 +1,376 @@ + + + + + +IsSame (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsSame<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsSame<T>
    +extends BaseMatcher<T>
    +
    Is the value the same object as another value?
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        IsSame

        +
        public IsSame(T object)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object arg)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        arg - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        sameInstance

        +
        public static <T> Matcher<T> sameInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + + + +
        +
      • +

        theInstance

        +
        public static <T> Matcher<T> theInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/StringContains.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/StringContains.html new file mode 100644 index 00000000..1b2154ed --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/StringContains.html @@ -0,0 +1,379 @@ + + + + + +StringContains (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class StringContains

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class StringContains
    +extends SubstringMatcher
    +
    Tests if the argument is a string that contains a substring.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringContains

        +
        public StringContains(boolean ignoringCase,
        +                      java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        containsString

        +
        public static Matcher<java.lang.String> containsString(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        containsStringIgnoringCase

        +
        public static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/StringEndsWith.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/StringEndsWith.html new file mode 100644 index 00000000..f4a40482 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/StringEndsWith.html @@ -0,0 +1,379 @@ + + + + + +StringEndsWith (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class StringEndsWith

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class StringEndsWith
    +extends SubstringMatcher
    +
    Tests if the argument is a string that contains a substring.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringEndsWith

        +
        public StringEndsWith(boolean ignoringCase,
        +                      java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        endsWith

        +
        public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWithIgnoringCase

        +
        public static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String, ignoring case. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/StringStartsWith.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/StringStartsWith.html new file mode 100644 index 00000000..388619a8 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/StringStartsWith.html @@ -0,0 +1,385 @@ + + + + + +StringStartsWith (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class StringStartsWith

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class StringStartsWith
    +extends SubstringMatcher
    +
    Tests if the argument is a string that contains a substring.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringStartsWith

        +
        public StringStartsWith(boolean ignoringCase,
        +                        java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        startsWith

        +
        public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String. +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWithIgnoringCase

        +
        public static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/SubstringMatcher.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/SubstringMatcher.html new file mode 100644 index 00000000..9514dc0f --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/SubstringMatcher.html @@ -0,0 +1,425 @@ + + + + + +SubstringMatcher (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class SubstringMatcher

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        substring

        +
        protected final java.lang.String substring
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SubstringMatcher

        +
        protected SubstringMatcher(java.lang.String relationship,
        +                           boolean ignoringCase,
        +                           java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        converted

        +
        protected java.lang.String converted(java.lang.String arg)
        +
      • +
      + + + +
        +
      • +

        evalSubstringOf

        +
        protected abstract boolean evalSubstringOf(java.lang.String string)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/package-frame.html new file mode 100644 index 00000000..19d46e02 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/package-frame.html @@ -0,0 +1,38 @@ + + + + + +org.hamcrest.core (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.core

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/package-summary.html new file mode 100644 index 00000000..43e1b16f --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/package-summary.html @@ -0,0 +1,249 @@ + + + + + +org.hamcrest.core (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.core

+
+
Fundamental matchers of objects and values, and composite matchers.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    AllOf<T> +
    Calculates the logical conjunction of multiple matchers.
    +
    AnyOf<T> +
    Calculates the logical disjunction of multiple matchers.
    +
    CombinableMatcher<T> 
    CombinableMatcher.CombinableBothMatcher<X> 
    CombinableMatcher.CombinableEitherMatcher<X> 
    DescribedAs<T> +
    Provides a custom description to another matcher.
    +
    Every<T> 
    Is<T> +
    Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
    +
    IsAnything<T> +
    A matcher that always returns true.
    +
    IsCollectionContaining<T> 
    IsEqual<T> +
    Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
    +
    IsInstanceOf +
    Tests whether the value is an instance of a class.
    +
    IsNot<T> +
    Calculates the logical negation of a matcher.
    +
    IsNull<T> +
    Is the value null?
    +
    IsSame<T> +
    Is the value the same object as another value?
    +
    StringContains +
    Tests if the argument is a string that contains a substring.
    +
    StringEndsWith +
    Tests if the argument is a string that contains a substring.
    +
    StringStartsWith +
    Tests if the argument is a string that contains a substring.
    +
    SubstringMatcher 
    +
  • +
+ + + +

Package org.hamcrest.core Description

+

Fundamental matchers of objects and values, and composite matchers.

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/core/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/core/package-tree.html new file mode 100644 index 00000000..ab095610 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/core/package-tree.html @@ -0,0 +1,172 @@ + + + + + +org.hamcrest.core Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.core

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/ArrayIterator.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/ArrayIterator.html new file mode 100644 index 00000000..cc78093e --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/ArrayIterator.html @@ -0,0 +1,319 @@ + + + + + +ArrayIterator (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class ArrayIterator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.ArrayIterator
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.util.Iterator<java.lang.Object>
    +
    +
    +
    +
    public class ArrayIterator
    +extends java.lang.Object
    +implements java.util.Iterator<java.lang.Object>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ArrayIterator(java.lang.Object array) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanhasNext() 
      java.lang.Objectnext() 
      voidremove() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Iterator

        +forEachRemaining
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ArrayIterator

        +
        public ArrayIterator(java.lang.Object array)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        hasNext

        +
        public boolean hasNext()
        +
        +
        Specified by:
        +
        hasNext in interface java.util.Iterator<java.lang.Object>
        +
        +
      • +
      + + + +
        +
      • +

        next

        +
        public java.lang.Object next()
        +
        +
        Specified by:
        +
        next in interface java.util.Iterator<java.lang.Object>
        +
        +
      • +
      + + + +
        +
      • +

        remove

        +
        public void remove()
        +
        +
        Specified by:
        +
        remove in interface java.util.Iterator<java.lang.Object>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/NullSafety.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/NullSafety.html new file mode 100644 index 00000000..e9b8d65a --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/NullSafety.html @@ -0,0 +1,269 @@ + + + + + +NullSafety (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class NullSafety

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.NullSafety
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class NullSafety
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      NullSafety() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <E> java.util.List<Matcher<? super E>>nullSafe(Matcher<? super E>[] itemMatchers) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        NullSafety

        +
        public NullSafety()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        nullSafe

        +
        public static <E> java.util.List<Matcher<? super E>> nullSafe(Matcher<? super E>[] itemMatchers)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/ReflectiveTypeFinder.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/ReflectiveTypeFinder.html new file mode 100644 index 00000000..82bafa0b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/ReflectiveTypeFinder.html @@ -0,0 +1,311 @@ + + + + + +ReflectiveTypeFinder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class ReflectiveTypeFinder

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.ReflectiveTypeFinder
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class ReflectiveTypeFinder
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ReflectiveTypeFinder(java.lang.String methodName, + int expectedNumberOfParameters, + int typedParameter) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      protected booleancanObtainExpectedTypeFrom(java.lang.reflect.Method method) 
      protected java.lang.Class<?>expectedTypeFrom(java.lang.reflect.Method method) 
      java.lang.Class<?>findExpectedType(java.lang.Class<?> fromClass) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ReflectiveTypeFinder

        +
        public ReflectiveTypeFinder(java.lang.String methodName,
        +                            int expectedNumberOfParameters,
        +                            int typedParameter)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        findExpectedType

        +
        public java.lang.Class<?> findExpectedType(java.lang.Class<?> fromClass)
        +
      • +
      + + + +
        +
      • +

        canObtainExpectedTypeFrom

        +
        protected boolean canObtainExpectedTypeFrom(java.lang.reflect.Method method)
        +
        +
        Parameters:
        +
        method - The method to examine.
        +
        Returns:
        +
        true if this method references the relevant type
        +
        +
      • +
      + + + +
        +
      • +

        expectedTypeFrom

        +
        protected java.lang.Class<?> expectedTypeFrom(java.lang.reflect.Method method)
        +
        +
        Parameters:
        +
        method - The method from which to extract
        +
        Returns:
        +
        The type we're looking for
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/SelfDescribingValue.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/SelfDescribingValue.html new file mode 100644 index 00000000..3ad1defa --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/SelfDescribingValue.html @@ -0,0 +1,288 @@ + + + + + +SelfDescribingValue (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class SelfDescribingValue<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.SelfDescribingValue<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    SelfDescribing
    +
    +
    +
    +
    public class SelfDescribingValue<T>
    +extends java.lang.Object
    +implements SelfDescribing
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SelfDescribingValue(T value) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        SelfDescribingValue

        +
        public SelfDescribingValue(T value)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Specified by:
        +
        describeTo in interface SelfDescribing
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/SelfDescribingValueIterator.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/SelfDescribingValueIterator.html new file mode 100644 index 00000000..42424e8d --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/SelfDescribingValueIterator.html @@ -0,0 +1,319 @@ + + + + + +SelfDescribingValueIterator (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class SelfDescribingValueIterator<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.SelfDescribingValueIterator<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.util.Iterator<SelfDescribing>
    +
    +
    +
    +
    public class SelfDescribingValueIterator<T>
    +extends java.lang.Object
    +implements java.util.Iterator<SelfDescribing>
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanhasNext() 
      SelfDescribingnext() 
      voidremove() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Iterator

        +forEachRemaining
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SelfDescribingValueIterator

        +
        public SelfDescribingValueIterator(java.util.Iterator<T> values)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        hasNext

        +
        public boolean hasNext()
        +
        +
        Specified by:
        +
        hasNext in interface java.util.Iterator<SelfDescribing>
        +
        +
      • +
      + + + + + + + +
        +
      • +

        remove

        +
        public void remove()
        +
        +
        Specified by:
        +
        remove in interface java.util.Iterator<SelfDescribing>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-frame.html new file mode 100644 index 00000000..505ca165 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-frame.html @@ -0,0 +1,24 @@ + + + + + +org.hamcrest.internal (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.internal

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-summary.html new file mode 100644 index 00000000..fd11a7ab --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-summary.html @@ -0,0 +1,156 @@ + + + + + +org.hamcrest.internal (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.internal

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-tree.html new file mode 100644 index 00000000..afb392a2 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/internal/package-tree.html @@ -0,0 +1,139 @@ + + + + + +org.hamcrest.internal Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.internal

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/io/FileMatchers.FileStatus.html b/docs/javadoc/2.0.0.0/org/hamcrest/io/FileMatchers.FileStatus.html new file mode 100644 index 00000000..c8578482 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/io/FileMatchers.FileStatus.html @@ -0,0 +1,223 @@ + + + + + +FileMatchers.FileStatus (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.io
+

Interface FileMatchers.FileStatus

+
+
+
+
    +
  • +
    +
    Enclosing class:
    +
    FileMatchers
    +
    +
    +
    +
    public static interface FileMatchers.FileStatus
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        check

        +
        boolean check(java.io.File actual)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/io/FileMatchers.html b/docs/javadoc/2.0.0.0/org/hamcrest/io/FileMatchers.html new file mode 100644 index 00000000..c5a3825b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/io/FileMatchers.html @@ -0,0 +1,493 @@ + + + + + +FileMatchers (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.io
+

Class FileMatchers

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.io.FileMatchers
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public final class FileMatchers
    +extends java.lang.Object
    +
  • +
+
+
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FileMatchers

        +
        public FileMatchers()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        anExistingDirectory

        +
        public static Matcher<java.io.File> anExistingDirectory()
        +
      • +
      + + + +
        +
      • +

        anExistingFileOrDirectory

        +
        public static Matcher<java.io.File> anExistingFileOrDirectory()
        +
      • +
      + + + +
        +
      • +

        anExistingFile

        +
        public static Matcher<java.io.File> anExistingFile()
        +
      • +
      + + + +
        +
      • +

        aReadableFile

        +
        public static Matcher<java.io.File> aReadableFile()
        +
      • +
      + + + +
        +
      • +

        aWritableFile

        +
        public static Matcher<java.io.File> aWritableFile()
        +
      • +
      + + + +
        +
      • +

        aFileWithSize

        +
        public static Matcher<java.io.File> aFileWithSize(long size)
        +
      • +
      + + + +
        +
      • +

        aFileWithSize

        +
        public static Matcher<java.io.File> aFileWithSize(Matcher<java.lang.Long> expected)
        +
      • +
      + + + +
        +
      • +

        aFileNamed

        +
        public static Matcher<java.io.File> aFileNamed(Matcher<java.lang.String> expected)
        +
      • +
      + + + +
        +
      • +

        aFileWithCanonicalPath

        +
        public static Matcher<java.io.File> aFileWithCanonicalPath(Matcher<java.lang.String> expected)
        +
      • +
      + + + +
        +
      • +

        aFileWithAbsolutePath

        +
        public static Matcher<java.io.File> aFileWithAbsolutePath(Matcher<java.lang.String> expected)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/io/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/io/package-frame.html new file mode 100644 index 00000000..96efe59a --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/io/package-frame.html @@ -0,0 +1,24 @@ + + + + + +org.hamcrest.io (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.io

+
+

Interfaces

+ +

Classes

+ +
+ + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/io/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/io/package-summary.html new file mode 100644 index 00000000..b89df8d0 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/io/package-summary.html @@ -0,0 +1,155 @@ + + + + + +org.hamcrest.io (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.io

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/io/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/io/package-tree.html new file mode 100644 index 00000000..9f021fff --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/io/package-tree.html @@ -0,0 +1,139 @@ + + + + + +org.hamcrest.io Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.io

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Interface Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/number/BigDecimalCloseTo.html b/docs/javadoc/2.0.0.0/org/hamcrest/number/BigDecimalCloseTo.html new file mode 100644 index 00000000..9961d07c --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/number/BigDecimalCloseTo.html @@ -0,0 +1,383 @@ + + + + + +BigDecimalCloseTo (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class BigDecimalCloseTo

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BigDecimalCloseTo

        +
        public BigDecimalCloseTo(java.math.BigDecimal value,
        +                         java.math.BigDecimal error)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.math.BigDecimal item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.math.BigDecimal>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.math.BigDecimal item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.math.BigDecimal>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand,
        +                                                    java.math.BigDecimal error)
        +
        Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. The comparison for equality + is done by BigDecimals BigDecimal.compareTo(java.math.BigDecimal) method. + For example: +
        assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
        +
        +
        Parameters:
        +
        operand - the expected value of matching BigDecimals
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/number/IsCloseTo.html b/docs/javadoc/2.0.0.0/org/hamcrest/number/IsCloseTo.html new file mode 100644 index 00000000..bf2f3da5 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/number/IsCloseTo.html @@ -0,0 +1,384 @@ + + + + + +IsCloseTo (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class IsCloseTo

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Double>, SelfDescribing
    +
    +
    +
    +
    public class IsCloseTo
    +extends TypeSafeMatcher<java.lang.Double>
    +
    Is the value a number equal to a value within some range of + acceptable error?
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCloseTo

        +
        public IsCloseTo(double value,
        +                 double error)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Double item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Double item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.lang.Double> closeTo(double operand,
        +                                                double error)
        +
        Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. + For example: +
        assertThat(1.03, is(closeTo(1.0, 0.03)))
        +
        +
        Parameters:
        +
        operand - the expected value of matching doubles
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/number/IsNaN.html b/docs/javadoc/2.0.0.0/org/hamcrest/number/IsNaN.html new file mode 100644 index 00000000..6a8b45d3 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/number/IsNaN.html @@ -0,0 +1,338 @@ + + + + + +IsNaN (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class IsNaN

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Double>, SelfDescribing
    +
    +
    +
    +
    public final class IsNaN
    +extends TypeSafeMatcher<java.lang.Double>
    +
    Is the value a number actually not a number (NaN)?
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Double item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Double item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        notANumber

        +
        public static Matcher<java.lang.Double> notANumber()
        +
        Creates a matcher of Doubles that matches when an examined double is not a number. + For example: +
        assertThat(Double.NaN, is(notANumber()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/number/OrderingComparison.html b/docs/javadoc/2.0.0.0/org/hamcrest/number/OrderingComparison.html new file mode 100644 index 00000000..bdd07069 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/number/OrderingComparison.html @@ -0,0 +1,366 @@ + + + + + +OrderingComparison (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class OrderingComparison

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.number.OrderingComparison
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class OrderingComparison
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      comparesEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        comparesEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, comparesEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(2, greaterThan(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, greaterThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, lessThan(2))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, lessThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/number/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/number/package-frame.html new file mode 100644 index 00000000..1a76762b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/number/package-frame.html @@ -0,0 +1,23 @@ + + + + + +org.hamcrest.number (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.number

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/number/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/number/package-summary.html new file mode 100644 index 00000000..e4062aa7 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/number/package-summary.html @@ -0,0 +1,166 @@ + + + + + +org.hamcrest.number (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.number

+
+
Matchers that perform numeric comparisons.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    BigDecimalCloseTo 
    IsCloseTo +
    Is the value a number equal to a value within some range of + acceptable error?
    +
    IsNaN +
    Is the value a number actually not a number (NaN)?
    +
    OrderingComparison 
    +
  • +
+ + + +

Package org.hamcrest.number Description

+

Matchers that perform numeric comparisons.

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/number/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/number/package-tree.html new file mode 100644 index 00000000..cdd89dc5 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/number/package-tree.html @@ -0,0 +1,146 @@ + + + + + +org.hamcrest.number Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.number

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/object/HasToString.html b/docs/javadoc/2.0.0.0/org/hamcrest/object/HasToString.html new file mode 100644 index 00000000..ef0a0843 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/object/HasToString.html @@ -0,0 +1,371 @@ + + + + + +HasToString (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.object
+

Class HasToString<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasToString

        +
        public HasToString(Matcher<? super java.lang.String> toStringMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.String featureValueOf(T actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<T,java.lang.String>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. + For example: +
        assertThat(true, hasToString(equalTo("TRUE")))
        +
        +
        Parameters:
        +
        toStringMatcher - the matcher used to verify the toString result
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. + For example: +
        assertThat(true, hasToString("TRUE"))
        +
        +
        Parameters:
        +
        expectedToString - the expected toString result
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/object/IsCompatibleType.html b/docs/javadoc/2.0.0.0/org/hamcrest/object/IsCompatibleType.html new file mode 100644 index 00000000..760dea51 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/object/IsCompatibleType.html @@ -0,0 +1,377 @@ + + + + + +IsCompatibleType (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.object
+

Class IsCompatibleType<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCompatibleType

        +
        public IsCompatibleType(java.lang.Class<T> type)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Class<?> cls)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Class<?>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Class<?> cls,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Class<?>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        typeCompatibleWith

        +
        public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
        +
        Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. + For example: +
        assertThat(Integer.class, typeCompatibleWith(Number.class))
        +
        +
        Parameters:
        +
        baseType - the base class to examine classes against
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/object/IsEventFrom.html b/docs/javadoc/2.0.0.0/org/hamcrest/object/IsEventFrom.html new file mode 100644 index 00000000..60544da1 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/object/IsEventFrom.html @@ -0,0 +1,385 @@ + + + + + +IsEventFrom (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.object
+

Class IsEventFrom

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.EventObject>, SelfDescribing
    +
    +
    +
    +
    public class IsEventFrom
    +extends TypeSafeDiagnosingMatcher<java.util.EventObject>
    +
    Tests if the value is an event announced by a specific object.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEventFrom

        +
        public IsEventFrom(java.lang.Class<?> eventClass,
        +                   java.lang.Object source)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.util.EventObject item,
        +                             Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.util.EventObject>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
        +                                                       java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
        +
        +
        Parameters:
        +
        eventClass - the class of the event to match on
        +
        source - the source of the event
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any EventObject + announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(myBean)))
        +
        +
        Parameters:
        +
        source - the source of the event
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/object/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/object/package-frame.html new file mode 100644 index 00000000..d350cd90 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/object/package-frame.html @@ -0,0 +1,22 @@ + + + + + +org.hamcrest.object (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.object

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/object/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/object/package-summary.html new file mode 100644 index 00000000..5375a99d --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/object/package-summary.html @@ -0,0 +1,159 @@ + + + + + +org.hamcrest.object (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.object

+
+
Matchers that inspect objects and classes.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    HasToString<T> 
    IsCompatibleType<T> 
    IsEventFrom +
    Tests if the value is an event announced by a specific object.
    +
    +
  • +
+ + + +

Package org.hamcrest.object Description

+

Matchers that inspect objects and classes.

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/object/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/object/package-tree.html new file mode 100644 index 00000000..be365e29 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/object/package-tree.html @@ -0,0 +1,153 @@ + + + + + +org.hamcrest.object Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.object

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/package-frame.html new file mode 100644 index 00000000..bbbad77c --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/package-frame.html @@ -0,0 +1,40 @@ + + + + + +org.hamcrest (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/package-summary.html new file mode 100644 index 00000000..b04272f6 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/package-summary.html @@ -0,0 +1,247 @@ + + + + + +org.hamcrest (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/package-tree.html new file mode 100644 index 00000000..ff799c21 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/package-tree.html @@ -0,0 +1,170 @@ + + + + + +org.hamcrest Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Interface Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/IsBlankString.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsBlankString.html new file mode 100644 index 00000000..611e6ac5 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsBlankString.html @@ -0,0 +1,336 @@ + + + + + +IsBlankString (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsBlankString

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public final class IsBlankString
    +extends TypeSafeMatcher<java.lang.String>
    +
    Matches blank Strings (and null).
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        blankString

        +
        public static Matcher<java.lang.String> blankString()
        +
        Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else. + For example: +
        assertThat("  ", is(blankString()))
        +
      • +
      + + + +
        +
      • +

        blankOrNullString

        +
        public static Matcher<java.lang.String> blankOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else. + For example: +
        assertThat(((String)null), is(blankOrNullString()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEmptyString.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEmptyString.html new file mode 100644 index 00000000..d89eb071 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEmptyString.html @@ -0,0 +1,379 @@ + + + + + +IsEmptyString (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsEmptyString

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public final class IsEmptyString
    +extends TypeSafeMatcher<java.lang.String>
    +
    Matches empty Strings (and null).
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        isEmptyString

        +
        @Deprecated
        +public static Matcher<java.lang.String> isEmptyString()
        +
        Deprecated. use is(emptyString()) instead
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", isEmptyString())
        +
      • +
      + + + +
        +
      • +

        emptyString

        +
        public static Matcher<java.lang.String> emptyString()
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", is(emptyString()))
        +
      • +
      + + + +
        +
      • +

        isEmptyOrNullString

        +
        @Deprecated
        +public static Matcher<java.lang.String> isEmptyOrNullString()
        +
        Deprecated. use is(emptyOrNullString()) instead
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), isEmptyOrNullString())
        +
      • +
      + + + +
        +
      • +

        emptyOrNullString

        +
        public static Matcher<java.lang.String> emptyOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), is(emptyOrNullString()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEqualIgnoringCase.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEqualIgnoringCase.html new file mode 100644 index 00000000..1cb976a6 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEqualIgnoringCase.html @@ -0,0 +1,378 @@ + + + + + +IsEqualIgnoringCase (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsEqualIgnoringCase

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class IsEqualIgnoringCase
    +extends TypeSafeMatcher<java.lang.String>
    +
    Tests if a string is equal to another string, regardless of the case.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEqualIgnoringCase

        +
        public IsEqualIgnoringCase(java.lang.String string)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringCase

        +
        public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. + For example: +
        assertThat("Foo", equalToIgnoringCase("FOO"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEqualIgnoringWhiteSpace.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEqualIgnoringWhiteSpace.html new file mode 100644 index 00000000..93d1b74d --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/IsEqualIgnoringWhiteSpace.html @@ -0,0 +1,396 @@ + + + + + +IsEqualIgnoringWhiteSpace (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsEqualIgnoringWhiteSpace

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class IsEqualIgnoringWhiteSpace
    +extends TypeSafeMatcher<java.lang.String>
    +
    Tests if a string is equal to another string, ignoring any changes in whitespace.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEqualIgnoringWhiteSpace

        +
        public IsEqualIgnoringWhiteSpace(java.lang.String string)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        stripSpace

        +
        public java.lang.String stripSpace(java.lang.String toBeStripped)
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringWhiteSpace

        +
        public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. To be + exact, the following whitespace rules are applied: +
          +
        • all leading and trailing whitespace of both the expectedString and the examined string are ignored
        • +
        • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
        • +
        + For example: +
        assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/MatchesPattern.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/MatchesPattern.html new file mode 100644 index 00000000..42985786 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/MatchesPattern.html @@ -0,0 +1,365 @@ + + + + + +MatchesPattern (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class MatchesPattern

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MatchesPattern

        +
        public MatchesPattern(java.util.regex.Pattern pattern)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/StringContainsInOrder.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/StringContainsInOrder.html new file mode 100644 index 00000000..6b85765b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/StringContainsInOrder.html @@ -0,0 +1,403 @@ + + + + + +StringContainsInOrder (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class StringContainsInOrder

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringContainsInOrder

        +
        public StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String s)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/package-frame.html new file mode 100644 index 00000000..3b2d0b9a --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/package-frame.html @@ -0,0 +1,25 @@ + + + + + +org.hamcrest.text (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.text

+ + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/package-summary.html new file mode 100644 index 00000000..448ba4d9 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/package-summary.html @@ -0,0 +1,177 @@ + + + + + +org.hamcrest.text (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.text

+
+
Matchers that perform text comparisons.
+
+

See: Description

+
+
+ + + + +

Package org.hamcrest.text Description

+

Matchers that perform text comparisons.

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/text/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/text/package-tree.html new file mode 100644 index 00000000..d3c5a678 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/text/package-tree.html @@ -0,0 +1,148 @@ + + + + + +org.hamcrest.text Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.text

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/xml/HasXPath.html b/docs/javadoc/2.0.0.0/org/hamcrest/xml/HasXPath.html new file mode 100644 index 00000000..9800eb44 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/xml/HasXPath.html @@ -0,0 +1,509 @@ + + + + + +HasXPath (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + + +
+
org.hamcrest.xml
+

Class HasXPath

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<org.w3c.dom.Node>, SelfDescribing
    +
    +
    +
    +
    public class HasXPath
    +extends TypeSafeDiagnosingMatcher<org.w3c.dom.Node>
    +
    Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static javax.xml.namespace.NamespaceContextNO_NAMESPACE_CONTEXT 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      HasXPath(java.lang.String xPathExpression, + Matcher<java.lang.String> valueMatcher) 
      HasXPath(java.lang.String xPathExpression, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
      +
      booleanmatchesSafely(org.w3c.dom.Node item, + Description mismatch) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NO_NAMESPACE_CONTEXT

        +
        public static final javax.xml.namespace.NamespaceContext NO_NAMESPACE_CONTEXT
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasXPath

        +
        public HasXPath(java.lang.String xPathExpression,
        +                Matcher<java.lang.String> valueMatcher)
        +
        +
        Parameters:
        +
        xPathExpression - XPath expression.
        +
        valueMatcher - Matcher to use at given XPath. + May be null to specify that the XPath must exist but the value is irrelevant.
        +
        +
      • +
      + + + +
        +
      • +

        HasXPath

        +
        public HasXPath(java.lang.String xPathExpression,
        +                javax.xml.namespace.NamespaceContext namespaceContext,
        +                Matcher<java.lang.String> valueMatcher)
        +
        +
        Parameters:
        +
        xPathExpression - XPath expression.
        +
        namespaceContext - Resolves XML namespace prefixes in the XPath expression
        +
        valueMatcher - Matcher to use at given XPath. + May be null to specify that the XPath must exist but the value is irrelevant.
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(org.w3c.dom.Node item,
        +                             Description mismatch)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<org.w3c.dom.Node>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese"))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-frame.html b/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-frame.html new file mode 100644 index 00000000..704d957b --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-frame.html @@ -0,0 +1,20 @@ + + + + + +org.hamcrest.xml (JavaHamcrest 2.0.0.0 API) + + + + + +

org.hamcrest.xml

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-summary.html b/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-summary.html new file mode 100644 index 00000000..25b4a6c0 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-summary.html @@ -0,0 +1,151 @@ + + + + + +org.hamcrest.xml (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Package org.hamcrest.xml

+
+
Matchers of XML documents.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    HasXPath +
    Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
    +
    +
  • +
+ + + +

Package org.hamcrest.xml Description

+

Matchers of XML documents.

+
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-tree.html b/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-tree.html new file mode 100644 index 00000000..e506f908 --- /dev/null +++ b/docs/javadoc/2.0.0.0/org/hamcrest/xml/package-tree.html @@ -0,0 +1,143 @@ + + + + + +org.hamcrest.xml Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.xml

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.0.0.0/overview-frame.html b/docs/javadoc/2.0.0.0/overview-frame.html new file mode 100644 index 00000000..af4d3f56 --- /dev/null +++ b/docs/javadoc/2.0.0.0/overview-frame.html @@ -0,0 +1,31 @@ + + + + + +Overview List (JavaHamcrest 2.0.0.0 API) + + + + + + + +

 

+ + diff --git a/docs/javadoc/2.0.0.0/overview-summary.html b/docs/javadoc/2.0.0.0/overview-summary.html new file mode 100644 index 00000000..c7a7ccb8 --- /dev/null +++ b/docs/javadoc/2.0.0.0/overview-summary.html @@ -0,0 +1,190 @@ + + + + + +Overview (JavaHamcrest 2.0.0.0 API) + + + + + + + + +
+ + + + + + + +
+ + +
+

JavaHamcrest 2.0.0.0 API

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
org.hamcrest 
org.hamcrest.beans +
Matchers of Java Bean properties and their values.
+
org.hamcrest.collection +
Matchers of arrays and collections.
+
org.hamcrest.comparator 
org.hamcrest.core +
Fundamental matchers of objects and values, and composite matchers.
+
org.hamcrest.internal 
org.hamcrest.io 
org.hamcrest.number +
Matchers that perform numeric comparisons.
+
org.hamcrest.object +
Matchers that inspect objects and classes.
+
org.hamcrest.text +
Matchers that perform text comparisons.
+
org.hamcrest.xml +
Matchers of XML documents.
+
+
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.0.0.0/overview-tree.html b/docs/javadoc/2.0.0.0/overview-tree.html new file mode 100644 index 00000000..2362e598 --- /dev/null +++ b/docs/javadoc/2.0.0.0/overview-tree.html @@ -0,0 +1,250 @@ + + + + + +Class Hierarchy (JavaHamcrest 2.0.0.0 API) + + + + + + + + +
+ + + + + + + +
+ + + +
+

Class Hierarchy

+ +

Interface Hierarchy

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.0.0.0/package-list b/docs/javadoc/2.0.0.0/package-list new file mode 100644 index 00000000..37d7af53 --- /dev/null +++ b/docs/javadoc/2.0.0.0/package-list @@ -0,0 +1,11 @@ +org.hamcrest +org.hamcrest.beans +org.hamcrest.collection +org.hamcrest.comparator +org.hamcrest.core +org.hamcrest.internal +org.hamcrest.io +org.hamcrest.number +org.hamcrest.object +org.hamcrest.text +org.hamcrest.xml diff --git a/docs/javadoc/2.0.0.0/script.js b/docs/javadoc/2.0.0.0/script.js new file mode 100644 index 00000000..b3463569 --- /dev/null +++ b/docs/javadoc/2.0.0.0/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/docs/javadoc/2.0.0.0/stylesheet.css b/docs/javadoc/2.0.0.0/stylesheet.css new file mode 100644 index 00000000..cebb4fd8 --- /dev/null +++ b/docs/javadoc/2.0.0.0/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; + width:100%; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/docs/javadoc/2.1/allclasses-frame.html b/docs/javadoc/2.1/allclasses-frame.html new file mode 100644 index 00000000..e92aacf7 --- /dev/null +++ b/docs/javadoc/2.1/allclasses-frame.html @@ -0,0 +1,102 @@ + + + + + +All Classes (Hamcrest 2.1 API) + + + + + +

All Classes

+ + + diff --git a/docs/javadoc/2.1/allclasses-noframe.html b/docs/javadoc/2.1/allclasses-noframe.html new file mode 100644 index 00000000..f19f045f --- /dev/null +++ b/docs/javadoc/2.1/allclasses-noframe.html @@ -0,0 +1,102 @@ + + + + + +All Classes (Hamcrest 2.1 API) + + + + + +

All Classes

+ + + diff --git a/docs/javadoc/2.1/constant-values.html b/docs/javadoc/2.1/constant-values.html new file mode 100644 index 00000000..cba88bac --- /dev/null +++ b/docs/javadoc/2.1/constant-values.html @@ -0,0 +1,122 @@ + + + + + +Constant Field Values (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Constant Field Values

+

Contents

+
+ + + + + + diff --git a/docs/javadoc/2.1/deprecated-list.html b/docs/javadoc/2.1/deprecated-list.html new file mode 100644 index 00000000..98c50cd4 --- /dev/null +++ b/docs/javadoc/2.1/deprecated-list.html @@ -0,0 +1,290 @@ + + + + + +Deprecated List (Hamcrest 2.1 API) + + + + + + + + +
+ + + + + + + +
+ + +
+

Deprecated API

+

Contents

+ +
+
+ + + + + + + +
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.1/help-doc.html b/docs/javadoc/2.1/help-doc.html new file mode 100644 index 00000000..09176b9b --- /dev/null +++ b/docs/javadoc/2.1/help-doc.html @@ -0,0 +1,223 @@ + + + + + +API Help (Hamcrest 2.1 API) + + + + + + + + +
+ + + + + + + +
+ + +
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
    +
  • +

    Overview

    +

    The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +
  • +
  • +

    Package

    +

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    +
      +
    • Interfaces (italic)
    • +
    • Classes
    • +
    • Enums
    • +
    • Exceptions
    • +
    • Errors
    • +
    • Annotation Types
    • +
    +
  • +
  • +

    Class/Interface

    +

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
      +
    • Class inheritance diagram
    • +
    • Direct Subclasses
    • +
    • All Known Subinterfaces
    • +
    • All Known Implementing Classes
    • +
    • Class/interface declaration
    • +
    • Class/interface description
    • +
    +
      +
    • Nested Class Summary
    • +
    • Field Summary
    • +
    • Constructor Summary
    • +
    • Method Summary
    • +
    +
      +
    • Field Detail
    • +
    • Constructor Detail
    • +
    • Method Detail
    • +
    +

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    +
  • +
  • +

    Annotation Type

    +

    Each annotation type has its own separate page with the following sections:

    +
      +
    • Annotation Type declaration
    • +
    • Annotation Type description
    • +
    • Required Element Summary
    • +
    • Optional Element Summary
    • +
    • Element Detail
    • +
    +
  • +
  • +

    Enum

    +

    Each enum has its own separate page with the following sections:

    +
      +
    • Enum declaration
    • +
    • Enum description
    • +
    • Enum Constant Summary
    • +
    • Enum Constant Detail
    • +
    +
  • +
  • +

    Tree (Class Hierarchy)

    +

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    +
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • +
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • +
    +
  • +
  • +

    Deprecated API

    +

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    +
  • +
  • +

    Index

    +

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    +
  • +
  • +

    Prev/Next

    +

    These links take you to the next or previous class, interface, package, or related page.

    +
  • +
  • +

    Frames/No Frames

    +

    These links show and hide the HTML frames. All pages are available with or without frames.

    +
  • +
  • +

    All Classes

    +

    The All Classes link shows all classes and interfaces except non-static nested types.

    +
  • +
  • +

    Serialized Form

    +

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    +
  • +
  • +

    Constant Field Values

    +

    The Constant Field Values page lists the static final fields and their values.

    +
  • +
+This help file applies to API documentation generated using the standard doclet.
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.1/index-all.html b/docs/javadoc/2.1/index-all.html new file mode 100644 index 00000000..552cf009 --- /dev/null +++ b/docs/javadoc/2.1/index-all.html @@ -0,0 +1,2768 @@ + + + + + +Index (Hamcrest 2.1 API) + + + + + + + + +
+ + + + + + + +
+ + +
A B C D E F G H I L M N O P R S T U _  + + +

A

+
+
aFileNamed(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithAbsolutePath(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithCanonicalPath(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithSize(long) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
aFileWithSize(Matcher<Long>) - Static method in class org.hamcrest.io.FileMatchers
+
 
+
AllOf<T> - Class in org.hamcrest.core
+
+
Calculates the logical conjunction of multiple matchers.
+
+
AllOf(Iterable<Matcher<? super T>>) - Constructor for class org.hamcrest.core.AllOf
+
 
+
allOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.core.AllOf
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>...) - Static method in class org.hamcrest.core.AllOf
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
allOf(Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
aMapWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsMapWithSize
+
+
Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
aMapWithSize(int) - Static method in class org.hamcrest.collection.IsMapWithSize
+
+
Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size.
+
+
aMapWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
aMapWithSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size.
+
+
and(Condition.Step<? super T, U>) - Method in class org.hamcrest.Condition
+
 
+
and(Matcher<? super T>) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
and(Matcher<? super X>) - Method in class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher
+
 
+
anEmptyMap() - Static method in class org.hamcrest.collection.IsMapWithSize
+
+
Creates a matcher for Maps that matches when the size() method returns + zero.
+
+
anEmptyMap() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps that matches when the size() method returns + zero.
+
+
anExistingDirectory() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
anExistingFile() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
anExistingFileOrDirectory() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
any(Class<T>) - Static method in class org.hamcrest.core.IsInstanceOf
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
any(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
any(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
AnyOf<T> - Class in org.hamcrest.core
+
+
Calculates the logical disjunction of multiple matchers.
+
+
AnyOf(Iterable<Matcher<? super T>>) - Constructor for class org.hamcrest.core.AnyOf
+
 
+
anyOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.core.AnyOf
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<? super T>...) - Static method in class org.hamcrest.core.AnyOf
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<? super T>...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Iterable<Matcher<? super T>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(Matcher<T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>, Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anything() - Static method in class org.hamcrest.core.IsAnything
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
anything(String) - Static method in class org.hamcrest.core.IsAnything
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+
+
anything() - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
anything(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+
+
anything() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
anything(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+
+
append(String) - Method in class org.hamcrest.BaseDescription
+
+
Append the String str to the description.
+
+
append(char) - Method in class org.hamcrest.BaseDescription
+
+
Append the char c to the description.
+
+
append(String) - Method in class org.hamcrest.StringDescription
+
 
+
append(char) - Method in class org.hamcrest.StringDescription
+
 
+
appendDescriptionOf(SelfDescribing) - Method in class org.hamcrest.BaseDescription
+
 
+
appendDescriptionOf(SelfDescribing) - Method in interface org.hamcrest.Description
+
+
Appends the description of a SelfDescribing value to this description.
+
+
appendDescriptionOf(SelfDescribing) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendList(String, String, String, Iterable<? extends SelfDescribing>) - Method in class org.hamcrest.BaseDescription
+
 
+
appendList(String, String, String, Iterable<? extends SelfDescribing>) - Method in interface org.hamcrest.Description
+
+
Appends a list of SelfDescribing objects + to the description.
+
+
appendList(String, String, String, Iterable<? extends SelfDescribing>) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendText(String) - Method in class org.hamcrest.BaseDescription
+
 
+
appendText(String) - Method in interface org.hamcrest.Description
+
+
Appends some plain text to the description.
+
+
appendText(String) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendValue(Object) - Method in class org.hamcrest.BaseDescription
+
 
+
appendValue(Object) - Method in interface org.hamcrest.Description
+
+
Appends an arbitrary value to the description.
+
+
appendValue(Object) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendValueList(String, String, String, T...) - Method in class org.hamcrest.BaseDescription
+
 
+
appendValueList(String, String, String, Iterable<T>) - Method in class org.hamcrest.BaseDescription
+
 
+
appendValueList(String, String, String, T...) - Method in interface org.hamcrest.Description
+
+
Appends a list of values to the description.
+
+
appendValueList(String, String, String, Iterable<T>) - Method in interface org.hamcrest.Description
+
+
Appends a list of values to the description.
+
+
appendValueList(String, String, String, T...) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendValueList(String, String, String, Iterable<T>) - Method in class org.hamcrest.Description.NullDescription
+
 
+
apply(I, Description) - Method in interface org.hamcrest.Condition.Step
+
 
+
aReadableFile() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
array(Matcher<? super T>...) - Static method in class org.hamcrest.collection.IsArray
+
+
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+
+
array(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+
+
ArrayAsIterableMatcher<E> - Class in org.hamcrest.collection
+
 
+
ArrayAsIterableMatcher(TypeSafeDiagnosingMatcher<Iterable<? extends E>>, Collection<Matcher<? super E>>, String) - Constructor for class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
arrayContaining(E...) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
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.
+
+
arrayContaining(Matcher<? super E>...) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+
+
arrayContaining(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers.
+
+
arrayContaining(E...) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated. + +
+
+
arrayContaining(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated. + +
+
+
arrayContaining(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated. +
As of version 2.1, use ArrayMatching.arrayContaining(List).
+
+
+
arrayContaining(E...) - Static method in class org.hamcrest.Matchers
+
+
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.
+
+
arrayContaining(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
+
+
arrayContaining(List<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers.
+
+
arrayContainingInAnyOrder(Matcher<? super E>...) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers.
+
+
arrayContainingInAnyOrder(Collection<Matcher<? super E>>) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
+ 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.
+
+
arrayContainingInAnyOrder(E...) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
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.
+
+
arrayContainingInAnyOrder(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated. + +
+
+
arrayContainingInAnyOrder(Collection<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated. + +
+
+
arrayContainingInAnyOrder(E...) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated. + +
+
+
arrayContainingInAnyOrder(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers.
+
+
arrayContainingInAnyOrder(Collection<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
+ 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.
+
+
arrayContainingInAnyOrder(E...) - Static method in class org.hamcrest.Matchers
+
+
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.
+
+
ArrayIterator - Class in org.hamcrest.internal
+
 
+
ArrayIterator(Object) - Constructor for class org.hamcrest.internal.ArrayIterator
+
 
+
ArrayMatching - Class in org.hamcrest.collection
+
 
+
ArrayMatching() - Constructor for class org.hamcrest.collection.ArrayMatching
+
 
+
arrayWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsArrayWithSize
+
+
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+
+
arrayWithSize(int) - Static method in class org.hamcrest.collection.IsArrayWithSize
+
+
Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+
+
arrayWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
+
+
arrayWithSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the length of the array + equals the specified size.
+
+
asEqualMatchers(E[]) - Static method in class org.hamcrest.collection.ArrayMatching
+
 
+
assertThat(T, Matcher<? super T>) - Static method in class org.hamcrest.MatcherAssert
+
 
+
assertThat(String, T, Matcher<? super T>) - Static method in class org.hamcrest.MatcherAssert
+
 
+
assertThat(String, boolean) - Static method in class org.hamcrest.MatcherAssert
+
 
+
asString(SelfDescribing) - Static method in class org.hamcrest.StringDescription
+
+ +
+
aWritableFile() - Static method in class org.hamcrest.io.FileMatchers
+
 
+
+ + + +

B

+
+
BaseDescription - Class in org.hamcrest
+
+
A Description that is stored as a string.
+
+
BaseDescription() - Constructor for class org.hamcrest.BaseDescription
+
 
+
BaseMatcher<T> - Class in org.hamcrest
+
+
BaseClass for all Matcher implementations.
+
+
BaseMatcher() - Constructor for class org.hamcrest.BaseMatcher
+
 
+
BigDecimalCloseTo - Class in org.hamcrest.number
+
 
+
BigDecimalCloseTo(BigDecimal, BigDecimal) - Constructor for class org.hamcrest.number.BigDecimalCloseTo
+
 
+
blankOrNullString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else.
+
+
blankOrNullString() - Static method in class org.hamcrest.text.IsBlankString
+
+
Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else.
+
+
blankString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else.
+
+
blankString() - Static method in class org.hamcrest.text.IsBlankString
+
+
Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else.
+
+
both(Matcher<? super LHS>) - Static method in class org.hamcrest.core.CombinableMatcher
+
+
Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
both(Matcher<? super LHS>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
both(Matcher<? super LHS>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
+ + + +

C

+
+
CAN_READ - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
CAN_WRITE - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
CharSequenceLength - Class in org.hamcrest.text
+
 
+
CharSequenceLength(Matcher<? super Integer>) - Constructor for class org.hamcrest.text.CharSequenceLength
+
 
+
check(File) - Method in interface org.hamcrest.io.FileMatchers.FileStatus
+
 
+
closeTo(double, double) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+
+
closeTo(BigDecimal, BigDecimal) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+
+
closeTo(BigDecimal, BigDecimal) - Static method in class org.hamcrest.number.BigDecimalCloseTo
+
+
Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
+
+
closeTo(double, double) - Static method in class org.hamcrest.number.IsCloseTo
+
+
Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
+
+
CombinableBothMatcher(Matcher<? super X>) - Constructor for class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher
+
 
+
CombinableEitherMatcher(Matcher<? super X>) - Constructor for class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher
+
 
+
CombinableMatcher<T> - Class in org.hamcrest.core
+
 
+
CombinableMatcher(Matcher<? super T>) - Constructor for class org.hamcrest.core.CombinableMatcher
+
 
+
CombinableMatcher.CombinableBothMatcher<X> - Class in org.hamcrest.core
+
 
+
CombinableMatcher.CombinableEitherMatcher<X> - Class in org.hamcrest.core
+
 
+
ComparatorMatcherBuilder<T> - Class in org.hamcrest.comparator
+
 
+
comparedBy(Comparator<T>) - Static method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher factory for matchers of Comparatorss of T.
+
+
comparesEqualTo(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + equal to the specified value, as reported by the Comparator used to + create this builder.
+
+
comparesEqualTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+
+
comparesEqualTo(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
+
+
Condition<T> - Class in org.hamcrest
+
+
A Condition implements part of a multi-step match.
+
+
Condition.Step<I,O> - Interface in org.hamcrest
+
 
+
contains(E...) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+
+
contains(Matcher<? super E>) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+
+
contains(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+
+
contains(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+
+
contains(E...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
+
+
contains(Matcher<? super E>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
+
+
contains(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
+
+
contains(List<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
+
+
containsInAnyOrder(Matcher<? super T>...) - Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+
+
containsInAnyOrder(T...) - Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+
+
containsInAnyOrder(Collection<Matcher<? super T>>) - Static method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+
+
containsInAnyOrder(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
+
+
containsInAnyOrder(T...) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
+
+
containsInAnyOrder(Collection<Matcher<? super T>>) - Static method in class org.hamcrest.Matchers
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
+
+
containsInRelativeOrder(E...) - Static method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
+
+
containsInRelativeOrder(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
+
+
containsInRelativeOrder(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
+
+
containsInRelativeOrder(E...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
+
+
containsInRelativeOrder(Matcher<? super E>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
+
+
containsInRelativeOrder(List<Matcher<? super E>>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
+
+
containsString(String) - Static method in class org.hamcrest.core.StringContains
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere.
+
+
containsString(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere.
+
+
containsString(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere.
+
+
containsStringIgnoringCase(String) - Static method in class org.hamcrest.core.StringContains
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
+
+
containsStringIgnoringCase(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
+
+
containsStringIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
+
+
converted(String) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
CoreMatchers - Class in org.hamcrest
+
 
+
CoreMatchers() - Constructor for class org.hamcrest.CoreMatchers
+
 
+
CustomMatcher<T> - Class in org.hamcrest
+
+
Utility class for writing one off matchers.
+
+
CustomMatcher(String) - Constructor for class org.hamcrest.CustomMatcher
+
 
+
CustomTypeSafeMatcher<T> - Class in org.hamcrest
+
+
Utility class for writing one off matchers.
+
+
CustomTypeSafeMatcher(String) - Constructor for class org.hamcrest.CustomTypeSafeMatcher
+
 
+
+ + + +

D

+
+
DescribedAs<T> - Class in org.hamcrest.core
+
+
Provides a custom description to another matcher.
+
+
DescribedAs(String, Matcher<T>, Object[]) - Constructor for class org.hamcrest.core.DescribedAs
+
 
+
describedAs(String, Matcher<T>, Object...) - Static method in class org.hamcrest.core.DescribedAs
+
+
Wraps an existing matcher, overriding its description with that specified.
+
+
describedAs(String, Matcher<T>, Object...) - Static method in class org.hamcrest.CoreMatchers
+
+
Wraps an existing matcher, overriding its description with that specified.
+
+
describedAs(String, Matcher<T>, Object...) - Static method in class org.hamcrest.Matchers
+
+
Wraps an existing matcher, overriding its description with that specified.
+
+
describeMismatch(Object, Description) - Method in class org.hamcrest.BaseMatcher
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.core.DescribedAs
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.core.Is
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.DiagnosingMatcher
+
 
+
describeMismatch(Object, Description) - Method in interface org.hamcrest.Matcher
+
+
Generate a description of why the matcher has not accepted the item.
+
+
describeMismatch(Object, Description) - Method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
 
+
describeMismatch(Object, Description) - Method in class org.hamcrest.TypeSafeMatcher
+
 
+
describeMismatchSafely(T, Description) - Method in class org.hamcrest.beans.HasProperty
+
 
+
describeMismatchSafely(E[], Description) - Method in class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
describeMismatchSafely(T[], Description) - Method in class org.hamcrest.collection.HasItemInArray
+
 
+
describeMismatchSafely(T[], Description) - Method in class org.hamcrest.collection.IsArray
+
 
+
describeMismatchSafely(E[], Description) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated.
+
describeMismatchSafely(E[], Description) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated.
+
describeMismatchSafely(Collection<? extends E>, Description) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
describeMismatchSafely(Iterable<? extends E>, Description) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
describeMismatchSafely(Map<? extends K, ? extends V>, Description) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
describeMismatchSafely(BigDecimal, Description) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
describeMismatchSafely(Double, Description) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
describeMismatchSafely(Double, Description) - Method in class org.hamcrest.number.IsNaN
+
 
+
describeMismatchSafely(Class<?>, Description) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.text.StringContainsInOrder
+
 
+
describeMismatchSafely(T, Description) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Subclasses should override this.
+
+
describeTo(Description) - Method in class org.hamcrest.beans.HasProperty
+
 
+
describeTo(Description) - Method in class org.hamcrest.beans.HasPropertyWithValue
+
 
+
describeTo(Description) - Method in class org.hamcrest.beans.SamePropertyValuesAs
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.HasItemInArray
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsArray
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated.
+
describeTo(Description) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated.
+
describeTo(Description) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIn
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIterableContainingInOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.AllOf
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.AnyOf
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.DescribedAs
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.Every
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.Is
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsAnything
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated.
+
describeTo(Description) - Method in class org.hamcrest.core.IsEqual
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsInstanceOf
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsIterableContaining
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsNot
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsNull
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.IsSame
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.StringRegularExpression
+
 
+
describeTo(Description) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.CustomMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.CustomTypeSafeMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.FeatureMatcher
+
 
+
describeTo(Description) - Method in class org.hamcrest.internal.SelfDescribingValue
+
 
+
describeTo(Description) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
describeTo(Description) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
describeTo(Description) - Method in class org.hamcrest.number.IsNaN
+
 
+
describeTo(Description) - Method in class org.hamcrest.object.HasEqualValues
+
 
+
describeTo(Description) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
describeTo(Description) - Method in class org.hamcrest.object.IsEventFrom
+
 
+
describeTo(Description) - Method in interface org.hamcrest.SelfDescribing
+
+
Generates a description of the object.
+
+
describeTo(Description) - Method in class org.hamcrest.text.IsBlankString
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.IsEmptyString
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.MatchesPattern
+
 
+
describeTo(Description) - Method in class org.hamcrest.text.StringContainsInOrder
+
 
+
describeTo(Description) - Method in class org.hamcrest.xml.HasXPath
+
 
+
Description - Interface in org.hamcrest
+
+
A description of a Matcher.
+
+
Description.NullDescription - Class in org.hamcrest
+
 
+
descriptionEnd() - Method in class org.hamcrest.collection.IsArray
+
+
Returns the string that ends the description.
+
+
descriptionSeparator() - Method in class org.hamcrest.collection.IsArray
+
+
Returns the string that separates the elements in the description.
+
+
descriptionStart() - Method in class org.hamcrest.collection.IsArray
+
+
Returns the string that starts the description.
+
+
DiagnosingMatcher<T> - Class in org.hamcrest
+
+
TODO(ngd): Document.
+
+
DiagnosingMatcher() - Constructor for class org.hamcrest.DiagnosingMatcher
+
 
+
+ + + +

E

+
+
either(Matcher<? super LHS>) - Static method in class org.hamcrest.core.CombinableMatcher
+
+
Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
either(Matcher<? super LHS>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
either(Matcher<? super LHS>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
empty() - Static method in class org.hamcrest.collection.IsEmptyCollection
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
empty() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
emptyArray() - Static method in class org.hamcrest.collection.IsArrayWithSize
+
+
Creates a matcher for arrays that matches when the length of the array + is zero.
+
+
emptyArray() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the length of the array + is zero.
+
+
emptyCollectionOf(Class<E>) - Static method in class org.hamcrest.collection.IsEmptyCollection
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
emptyCollectionOf(Class<E>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
+
+
emptyIterable() - Static method in class org.hamcrest.collection.IsEmptyIterable
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyIterable() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyIterableOf(Class<E>) - Static method in class org.hamcrest.collection.IsEmptyIterable
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyIterableOf(Class<E>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
emptyOrNullString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is null, or + has zero length.
+
+
emptyOrNullString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Creates a matcher of String that matches when the examined string is null, or + has zero length.
+
+
emptyString() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string has zero length.
+
+
emptyString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Creates a matcher of String that matches when the examined string has zero length.
+
+
endsWith(String) - Static method in class org.hamcrest.core.StringEndsWith
+
+
Creates a matcher that matches if the examined String ends with the specified + String.
+
+
endsWith(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String.
+
+
endsWith(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String.
+
+
endsWithIgnoringCase(String) - Static method in class org.hamcrest.core.StringEndsWith
+
+
Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
+
+
endsWithIgnoringCase(String) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
+
+
endsWithIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
+
+
equalTo(T) - Static method in class org.hamcrest.core.IsEqual
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+
+
equalTo(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+
+
equalTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
+
+
equalToCompressingWhiteSpace(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+
+
equalToCompressingWhiteSpace(String) - Static method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
+
+
equalToIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+
+
equalToIgnoringCase(String) - Static method in class org.hamcrest.text.IsEqualIgnoringCase
+
+
Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
+
+
equalToIgnoringWhiteSpace(String) - Static method in class org.hamcrest.Matchers
+
+ +
+
equalToIgnoringWhiteSpace(String) - Static method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
+ +
+
equalToObject(Object) - Static method in class org.hamcrest.core.IsEqual
+
+
Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
+
+
equalToObject(Object) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
+
+
equalToObject(Object) - Static method in class org.hamcrest.Matchers
+
+
Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
+
+
evalSubstringOf(String) - Method in class org.hamcrest.core.StringContains
+
 
+
evalSubstringOf(String) - Method in class org.hamcrest.core.StringEndsWith
+
 
+
evalSubstringOf(String) - Method in class org.hamcrest.core.StringStartsWith
+
 
+
evalSubstringOf(String) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
eventFrom(Class<? extends EventObject>, Object) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+
+
eventFrom(Object) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of EventObject that matches any EventObject + announced by source.
+
+
eventFrom(Class<? extends EventObject>, Object) - Static method in class org.hamcrest.object.IsEventFrom
+
+
Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
+
+
eventFrom(Object) - Static method in class org.hamcrest.object.IsEventFrom
+
+
Creates a matcher of EventObject that matches any EventObject + announced by source.
+
+
Every<T> - Class in org.hamcrest.core
+
 
+
Every(Matcher<? super T>) - Constructor for class org.hamcrest.core.Every
+
 
+
everyItem(Matcher<U>) - Static method in class org.hamcrest.core.Every
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+
+
everyItem(Matcher<U>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+
+
everyItem(Matcher<U>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
+
+
EXISTS - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
+ + + +

F

+
+
FeatureMatcher<T,U> - Class in org.hamcrest
+
+
Supporting class for matching a feature of an object.
+
+
FeatureMatcher(Matcher<? super U>, String, String) - Constructor for class org.hamcrest.FeatureMatcher
+
+
Constructor
+
+
featureValueOf(E[]) - Method in class org.hamcrest.collection.IsArrayWithSize
+
 
+
featureValueOf(Collection<? extends E>) - Method in class org.hamcrest.collection.IsCollectionWithSize
+
 
+
featureValueOf(Iterable<E>) - Method in class org.hamcrest.collection.IsIterableWithSize
+
 
+
featureValueOf(Map<? extends K, ? extends V>) - Method in class org.hamcrest.collection.IsMapWithSize
+
 
+
featureValueOf(T) - Method in class org.hamcrest.FeatureMatcher
+
+
Implement this to extract the interesting feature.
+
+
featureValueOf(T) - Method in class org.hamcrest.object.HasToString
+
 
+
featureValueOf(CharSequence) - Method in class org.hamcrest.text.CharSequenceLength
+
 
+
FileMatchers - Class in org.hamcrest.io
+
 
+
FileMatchers() - Constructor for class org.hamcrest.io.FileMatchers
+
 
+
FileMatchers.FileStatus - Interface in org.hamcrest.io
+
 
+
findExpectedType(Class<?>) - Method in class org.hamcrest.internal.ReflectiveTypeFinder
+
 
+
+ + + +

G

+
+
getPropertyDescriptor(String, Object) - Static method in class org.hamcrest.beans.PropertyUtil
+
+
Returns the description of the property with the provided + name on the provided object's interface.
+
+
greaterThan(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + greater than the specified value, as reported by the Comparator used to + create this builder.
+
+
greaterThan(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+
+
greaterThan(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
+
+
greaterThanOrEqualTo(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + greater than or equal to the specified value, as reported by the Comparator used to + create this builder.
+
+
greaterThanOrEqualTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
greaterThanOrEqualTo(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
+ + + +

H

+
+
hasEntry(Matcher<? super K>, Matcher<? super V>) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+
+
hasEntry(K, V) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+
+
hasEntry(Matcher<? super K>, Matcher<? super V>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
+
+
hasEntry(K, V) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
+
+
HasEqualValues<T> - Class in org.hamcrest.object
+
 
+
HasEqualValues(T) - Constructor for class org.hamcrest.object.HasEqualValues
+
 
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated. + +
+
+
hasItem(T) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated. +
As of version 2.1, use IsIterableContaining.hasItem(Object).
+
+
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.core.IsIterableContaining
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+
+
hasItem(T) - Static method in class org.hamcrest.core.IsIterableContaining
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+
+
hasItem(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
+
+
hasItem(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
+
+
hasItemInArray(Matcher<? super T>) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+
+
hasItemInArray(T) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
A shortcut to the frequently used hasItemInArray(equalTo(x)).
+
+
HasItemInArray<T> - Class in org.hamcrest.collection
+
+
Matches if an array contains an item satisfying a nested matcher.
+
+
HasItemInArray(Matcher<? super T>) - Constructor for class org.hamcrest.collection.HasItemInArray
+
 
+
hasItemInArray(Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
+
+
hasItemInArray(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used hasItemInArray(equalTo(x)).
+
+
hasItems(Matcher<? super T>...) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated. + +
+
+
hasItems(T...) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated. + +
+
+
hasItems(Matcher<? super T>...) - Static method in class org.hamcrest.core.IsIterableContaining
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+
+
hasItems(T...) - Static method in class org.hamcrest.core.IsIterableContaining
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+
+
hasItems(Matcher<? super T>...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+
+
hasItems(T...) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+
+
hasItems(Matcher<? super T>...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
+
+
hasItems(T...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
+
+
hasKey(Matcher<? super K>) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+
+
hasKey(K) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+
+
hasKey(Matcher<? super K>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
+
+
hasKey(K) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
+
+
hasLength(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of CharSequence that matches when a char sequence has the length + of the specified argument.
+
+
hasLength(int) - Static method in class org.hamcrest.text.CharSequenceLength
+
+
Creates a matcher of CharSequence that matches when a char sequence has the given length + For example:
+
+
hasLength(Matcher<? super Integer>) - Static method in class org.hamcrest.text.CharSequenceLength
+
+
Creates a matcher of CharSequence that matches when a char sequence has the given length + For example:
+
+
hasNext() - Method in class org.hamcrest.internal.ArrayIterator
+
 
+
hasNext() - Method in class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
HasProperty<T> - Class in org.hamcrest.beans
+
+
A Matcher that checks that an object has a JavaBean property + with the specified name.
+
+
HasProperty(String) - Constructor for class org.hamcrest.beans.HasProperty
+
 
+
hasProperty(String) - Static method in class org.hamcrest.beans.HasProperty
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+
+
hasProperty(String, Matcher<?>) - Static method in class org.hamcrest.beans.HasPropertyWithValue
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+
+
hasProperty(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
+
+
hasProperty(String, Matcher<?>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
+
+
hasPropertyAtPath(String, Matcher<T>) - Static method in class org.hamcrest.beans.HasPropertyWithValue
+
+
Creates a matcher that matches when the examined object is a graph of + JavaBean objects that can be navigated along the declared dot-separated path + and the final element of that path is a JavaBean property whose value satisfies the + specified matcher.
+
+
HasPropertyWithValue<T> - Class in org.hamcrest.beans
+
+
Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
+
+
HasPropertyWithValue(String, Matcher<?>) - Constructor for class org.hamcrest.beans.HasPropertyWithValue
+
 
+
HasPropertyWithValue(String, Matcher<?>, String) - Constructor for class org.hamcrest.beans.HasPropertyWithValue
+
 
+
hasSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsCollectionWithSize
+
+
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
hasSize(int) - Static method in class org.hamcrest.collection.IsCollectionWithSize
+
+
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+
+
hasSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
+
+
hasSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
+
+
hasToString(Matcher<? super String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+
+
hasToString(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+
+
HasToString<T> - Class in org.hamcrest.object
+
 
+
HasToString(Matcher<? super String>) - Constructor for class org.hamcrest.object.HasToString
+
 
+
hasToString(Matcher<? super String>) - Static method in class org.hamcrest.object.HasToString
+
+
Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
+
+
hasToString(String) - Static method in class org.hamcrest.object.HasToString
+
+
Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
+
+
hasValue(Matcher<? super V>) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+
+
hasValue(V) - Static method in class org.hamcrest.collection.IsMapContaining
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+
+
hasValue(Matcher<? super V>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
+
+
hasValue(V) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
+
+
hasXPath(String, Matcher<String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+
+
hasXPath(String, NamespaceContext, Matcher<String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+
+
hasXPath(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+
+
hasXPath(String, NamespaceContext) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+
+
HasXPath - Class in org.hamcrest.xml
+
+
Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+
+
HasXPath(String, Matcher<String>) - Constructor for class org.hamcrest.xml.HasXPath
+
 
+
HasXPath(String, NamespaceContext, Matcher<String>) - Constructor for class org.hamcrest.xml.HasXPath
+
 
+
hasXPath(String, Matcher<String>) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
+
+
hasXPath(String, NamespaceContext, Matcher<String>) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
+
+
hasXPath(String) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
+
+
hasXPath(String, NamespaceContext) - Static method in class org.hamcrest.xml.HasXPath
+
+
Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
+
+
+ + + +

I

+
+
in(Collection<T>) - Static method in class org.hamcrest.collection.IsIn
+
+
Creates a matcher that matches when the examined object is found within the + specified collection.
+
+
in(T[]) - Static method in class org.hamcrest.collection.IsIn
+
+
Creates a matcher that matches when the examined object is found within the + specified array.
+
+
in(Collection<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is found within the + specified collection.
+
+
in(T[]) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is found within the + specified array.
+
+
instanceOf(Class<?>) - Static method in class org.hamcrest.core.IsInstanceOf
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
instanceOf(Class<?>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
instanceOf(Class<?>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
+
+
Is<T> - Class in org.hamcrest.core
+
+
Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
+
+
Is(Matcher<T>) - Constructor for class org.hamcrest.core.Is
+
 
+
is(Matcher<T>) - Static method in class org.hamcrest.core.Is
+
+
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+
+
is(T) - Static method in class org.hamcrest.core.Is
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
is(Matcher<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+
+
is(T) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
is(Matcher<T>) - Static method in class org.hamcrest.Matchers
+
+
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+
+
is(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
IS_DIRECTORY - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
IS_FILE - Static variable in class org.hamcrest.io.FileMatchers
+
 
+
isA(Class<?>) - Static method in class org.hamcrest.core.Is
+
+
A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
isA(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
isA(Class<?>) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
IsAnything<T> - Class in org.hamcrest.core
+
+
A matcher that always returns true.
+
+
IsAnything() - Constructor for class org.hamcrest.core.IsAnything
+
 
+
IsAnything(String) - Constructor for class org.hamcrest.core.IsAnything
+
 
+
IsArray<T> - Class in org.hamcrest.collection
+
+
Matcher for array whose elements satisfy a sequence of matchers.
+
+
IsArray(Matcher<? super T>[]) - Constructor for class org.hamcrest.collection.IsArray
+
 
+
IsArrayContainingInAnyOrder<E> - Class in org.hamcrest.collection
+
+
Deprecated. +
As of release 2.1, replaced by ArrayMatching.
+
+
+
IsArrayContainingInAnyOrder(Collection<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated.
+
IsArrayContainingInOrder<E> - Class in org.hamcrest.collection
+
+
Deprecated. +
As of release 2.1, replaced by ArrayMatching.
+
+
+
IsArrayContainingInOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated.
+
IsArrayWithSize<E> - Class in org.hamcrest.collection
+
+
Matches if array size satisfies a nested matcher.
+
+
IsArrayWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsArrayWithSize
+
 
+
IsBlankString - Class in org.hamcrest.text
+
+
Matches blank Strings (and null).
+
+
IsCloseTo - Class in org.hamcrest.number
+
+
Is the value a number equal to a value within some range of + acceptable error?
+
+
IsCloseTo(double, double) - Constructor for class org.hamcrest.number.IsCloseTo
+
 
+
IsCollectionContaining<T> - Class in org.hamcrest.core
+
+
Deprecated. +
As of release 2.1, replaced by IsIterableContaining.
+
+
+
IsCollectionContaining(Matcher<? super T>) - Constructor for class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated.
+
IsCollectionWithSize<E> - Class in org.hamcrest.collection
+
+
Matches if collection size satisfies a nested matcher.
+
+
IsCollectionWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsCollectionWithSize
+
 
+
IsCompatibleType<T> - Class in org.hamcrest.object
+
 
+
IsCompatibleType(Class<T>) - Constructor for class org.hamcrest.object.IsCompatibleType
+
 
+
IsEmptyCollection<E> - Class in org.hamcrest.collection
+
+
Tests if collection is empty.
+
+
IsEmptyCollection() - Constructor for class org.hamcrest.collection.IsEmptyCollection
+
 
+
IsEmptyIterable<E> - Class in org.hamcrest.collection
+
+
Tests if collection is empty.
+
+
IsEmptyIterable() - Constructor for class org.hamcrest.collection.IsEmptyIterable
+
 
+
isEmptyOrNullString() - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(emptyOrNullString()) instead
+
+
+
isEmptyOrNullString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Deprecated. +
use is(emptyOrNullString()) instead
+
+
+
isEmptyString() - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(emptyString()) instead
+
+
+
IsEmptyString - Class in org.hamcrest.text
+
+
Matches empty Strings (and null).
+
+
isEmptyString() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Deprecated. +
use is(emptyString()) instead
+
+
+
IsEqual<T> - Class in org.hamcrest.core
+
+
Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
+
+
IsEqual(T) - Constructor for class org.hamcrest.core.IsEqual
+
 
+
IsEqualCompressingWhiteSpace - Class in org.hamcrest.text
+
+
Tests if a string is equal to another string, compressing any changes in whitespace.
+
+
IsEqualCompressingWhiteSpace(String) - Constructor for class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
 
+
IsEqualIgnoringCase - Class in org.hamcrest.text
+
+
Tests if a string is equal to another string, regardless of the case.
+
+
IsEqualIgnoringCase(String) - Constructor for class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
IsEventFrom - Class in org.hamcrest.object
+
+
Tests if the value is an event announced by a specific object.
+
+
IsEventFrom(Class<?>, Object) - Constructor for class org.hamcrest.object.IsEventFrom
+
 
+
IsIn<T> - Class in org.hamcrest.collection
+
 
+
IsIn(Collection<T>) - Constructor for class org.hamcrest.collection.IsIn
+
 
+
IsIn(T[]) - Constructor for class org.hamcrest.collection.IsIn
+
 
+
isIn(Collection<T>) - Static method in class org.hamcrest.collection.IsIn
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
isIn(T[]) - Static method in class org.hamcrest.collection.IsIn
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
isIn(Collection<T>) - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
isIn(T[]) - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
IsInstanceOf - Class in org.hamcrest.core
+
+
Tests whether the value is an instance of a class.
+
+
IsInstanceOf(Class<?>) - Constructor for class org.hamcrest.core.IsInstanceOf
+
+
Creates a new instance of IsInstanceOf
+
+
IsIterableContaining<T> - Class in org.hamcrest.core
+
 
+
IsIterableContaining(Matcher<? super T>) - Constructor for class org.hamcrest.core.IsIterableContaining
+
 
+
IsIterableContainingInAnyOrder<T> - Class in org.hamcrest.collection
+
 
+
IsIterableContainingInAnyOrder(Collection<Matcher<? super T>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
 
+
IsIterableContainingInOrder<E> - Class in org.hamcrest.collection
+
 
+
IsIterableContainingInOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInOrder
+
 
+
IsIterableContainingInRelativeOrder<E> - Class in org.hamcrest.collection
+
 
+
IsIterableContainingInRelativeOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
 
+
IsIterableWithSize<E> - Class in org.hamcrest.collection
+
 
+
IsIterableWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsIterableWithSize
+
 
+
IsMapContaining<K,V> - Class in org.hamcrest.collection
+
 
+
IsMapContaining(Matcher<? super K>, Matcher<? super V>) - Constructor for class org.hamcrest.collection.IsMapContaining
+
 
+
IsMapWithSize<K,V> - Class in org.hamcrest.collection
+
+
Matches if map size satisfies a nested matcher.
+
+
IsMapWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsMapWithSize
+
 
+
IsNaN - Class in org.hamcrest.number
+
+
Is the value a number actually not a number (NaN)?
+
+
IsNot<T> - Class in org.hamcrest.core
+
+
Calculates the logical negation of a matcher.
+
+
IsNot(Matcher<T>) - Constructor for class org.hamcrest.core.IsNot
+
 
+
isNotNull(Object, Description) - Static method in class org.hamcrest.BaseMatcher
+
+
Useful null-check method.
+
+
IsNull<T> - Class in org.hamcrest.core
+
+
Is the value null?
+
+
IsNull() - Constructor for class org.hamcrest.core.IsNull
+
 
+
isOneOf(T...) - Static method in class org.hamcrest.collection.IsIn
+
+
Deprecated. +
use is(oneOf(...)) instead
+
+
+
isOneOf(T...) - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(oneOf(...)) instead
+
+
+
IsSame<T> - Class in org.hamcrest.core
+
+
Is the value the same object as another value?
+
+
IsSame(T) - Constructor for class org.hamcrest.core.IsSame
+
 
+
iterableMatcher - Variable in class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
iterableWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.collection.IsIterableWithSize
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+
+
iterableWithSize(int) - Static method in class org.hamcrest.collection.IsIterableWithSize
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+
+
iterableWithSize(Matcher<? super Integer>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
+
+
iterableWithSize(int) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
+
+
+ + + +

L

+
+
lessThan(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + less than the specified value, as reported by the Comparator used to + create this builder.
+
+
lessThan(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+
+
lessThan(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
+
+
lessThanOrEqualTo(T) - Method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher of T object that matches when the examined object is + less than or equal to the specified value, as reported by the Comparator used to + create this builder.
+
+
lessThanOrEqualTo(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
lessThanOrEqualTo(T) - Static method in class org.hamcrest.number.OrderingComparison
+
+
Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
+
+
+ + + +

M

+
+
matched(T, Description) - Static method in class org.hamcrest.Condition
+
 
+
Matcher<T> - Interface in org.hamcrest
+
+
+ A matcher over acceptable values.
+
+
MatcherAssert - Class in org.hamcrest
+
 
+
MatcherAssert() - Constructor for class org.hamcrest.MatcherAssert
+
 
+
matchers - Variable in class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
Matchers - Class in org.hamcrest
+
 
+
Matchers() - Constructor for class org.hamcrest.Matchers
+
 
+
matches(Object, Description) - Method in class org.hamcrest.beans.SamePropertyValuesAs
+
 
+
matches(Object) - Method in class org.hamcrest.collection.IsIn
+
 
+
matches(Object, Description) - Method in class org.hamcrest.core.AllOf
+
 
+
matches(Object) - Method in class org.hamcrest.core.AnyOf
+
 
+
matches(Object) - Method in class org.hamcrest.core.DescribedAs
+
 
+
matches(Object) - Method in class org.hamcrest.core.Is
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsAnything
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsEqual
+
 
+
matches(Object, Description) - Method in class org.hamcrest.core.IsInstanceOf
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsNot
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsNull
+
 
+
matches(Object) - Method in class org.hamcrest.core.IsSame
+
 
+
matches(Object) - Method in class org.hamcrest.DiagnosingMatcher
+
 
+
matches(Object, Description) - Method in class org.hamcrest.DiagnosingMatcher
+
 
+
matches(Object) - Method in interface org.hamcrest.Matcher
+
+
Evaluates the matcher for argument item.
+
+
matches(Object) - Method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
 
+
matches(Object) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Methods made final to prevent accidental override.
+
+
matchesPattern(Pattern) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
+
+
matchesPattern(String) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
+
+
MatchesPattern - Class in org.hamcrest.text
+
 
+
MatchesPattern(Pattern) - Constructor for class org.hamcrest.text.MatchesPattern
+
 
+
matchesPattern(Pattern) - Static method in class org.hamcrest.text.MatchesPattern
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
+
+
matchesPattern(String) - Static method in class org.hamcrest.text.MatchesPattern
+
+
Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
+
+
matchesRegex(Pattern) - Static method in class org.hamcrest.core.StringRegularExpression
+
+
Creates a matcher that checks if the examined string matches a specified Pattern.
+
+
matchesRegex(String) - Static method in class org.hamcrest.core.StringRegularExpression
+
+
Creates a matcher that checks if the examined string matches a specified regex.
+
+
matchesRegex(Pattern) - Static method in class org.hamcrest.Matchers
+
+
Validate a string with a Pattern.
+
+
matchesRegex(String) - Static method in class org.hamcrest.Matchers
+
+
Validate a string with a regex.
+
+
matchesSafely(T) - Method in class org.hamcrest.beans.HasProperty
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.beans.HasPropertyWithValue
+
 
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
matchesSafely(T[]) - Method in class org.hamcrest.collection.HasItemInArray
+
 
+
matchesSafely(T[]) - Method in class org.hamcrest.collection.IsArray
+
 
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated.
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated.
+
matchesSafely(Collection<? extends E>) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
matchesSafely(Iterable<? extends E>) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
matchesSafely(Iterable<? extends T>, Description) - Method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
 
+
matchesSafely(Iterable<? extends E>, Description) - Method in class org.hamcrest.collection.IsIterableContainingInOrder
+
 
+
matchesSafely(Iterable<? extends E>, Description) - Method in class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
 
+
matchesSafely(Map<? extends K, ? extends V>) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
matchesSafely(Iterable<? extends T>, Description) - Method in class org.hamcrest.core.Every
+
 
+
matchesSafely(Iterable<? super T>, Description) - Method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated.
+
matchesSafely(Iterable<? super T>, Description) - Method in class org.hamcrest.core.IsIterableContaining
+
 
+
matchesSafely(String, Description) - Method in class org.hamcrest.core.StringRegularExpression
+
 
+
matchesSafely(String) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.FeatureMatcher
+
 
+
matchesSafely(BigDecimal) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
matchesSafely(Double) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
matchesSafely(Double) - Method in class org.hamcrest.number.IsNaN
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.object.HasEqualValues
+
 
+
matchesSafely(Class<?>) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
matchesSafely(EventObject, Description) - Method in class org.hamcrest.object.IsEventFrom
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsBlankString
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsEmptyString
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.IsEqualIgnoringCase
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.MatchesPattern
+
 
+
matchesSafely(String) - Method in class org.hamcrest.text.StringContainsInOrder
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Subclasses should implement this.
+
+
matchesSafely(T) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Subclasses should implement this.
+
+
matchesSafely(Node, Description) - Method in class org.hamcrest.xml.HasXPath
+
 
+
matching(Matcher<T>, String) - Method in class org.hamcrest.Condition
+
 
+
matching(Matcher<T>) - Method in class org.hamcrest.Condition
+
 
+
+ + + +

N

+
+
next() - Method in class org.hamcrest.internal.ArrayIterator
+
 
+
next() - Method in class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
NO_ARGUMENTS - Static variable in class org.hamcrest.beans.PropertyUtil
+
 
+
NO_NAMESPACE_CONTEXT - Static variable in class org.hamcrest.xml.HasXPath
+
 
+
NONE - Static variable in interface org.hamcrest.Description
+
+
A description that consumes input but does nothing.
+
+
not(Matcher<T>) - Static method in class org.hamcrest.core.IsNot
+
+
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+
+
not(T) - Static method in class org.hamcrest.core.IsNot
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
not(Matcher<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+
+
not(T) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
not(Matcher<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
+
+
not(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
NOT_MATCHED - Static variable in class org.hamcrest.Condition
+
 
+
notANumber() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Doubles that matches when an examined double is not a number.
+
+
notANumber() - Static method in class org.hamcrest.number.IsNaN
+
+
Creates a matcher of Doubles that matches when an examined double is not a number.
+
+
notMatched() - Static method in class org.hamcrest.Condition
+
 
+
notNullValue() - Static method in class org.hamcrest.core.IsNull
+
+
A shortcut to the frequently used not(nullValue()).
+
+
notNullValue(Class<T>) - Static method in class org.hamcrest.core.IsNull
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
notNullValue() - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(nullValue()).
+
+
notNullValue(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
notNullValue() - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used not(nullValue()).
+
+
notNullValue(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
NullDescription() - Constructor for class org.hamcrest.Description.NullDescription
+
 
+
nullSafe(Matcher<? super E>[]) - Static method in class org.hamcrest.internal.NullSafety
+
 
+
NullSafety - Class in org.hamcrest.internal
+
 
+
NullSafety() - Constructor for class org.hamcrest.internal.NullSafety
+
 
+
nullValue() - Static method in class org.hamcrest.core.IsNull
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue(Class<T>) - Static method in class org.hamcrest.core.IsNull
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue() - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue() - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if examined object is null.
+
+
nullValue(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches if examined object is null.
+
+
+ + + +

O

+
+
oneOf(T...) - Static method in class org.hamcrest.collection.IsIn
+
+
Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+
+
oneOf(T...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object is equal to one of the + specified elements.
+
+
or(Matcher<? super X>) - Method in class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher
+
 
+
or(Matcher<? super T>) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
OrderingComparison - Class in org.hamcrest.number
+
 
+
org.hamcrest - package org.hamcrest
+
 
+
org.hamcrest.beans - package org.hamcrest.beans
+
+
Matchers of Java Bean properties and their values.
+
+
org.hamcrest.collection - package org.hamcrest.collection
+
+
Matchers of arrays and collections.
+
+
org.hamcrest.comparator - package org.hamcrest.comparator
+
 
+
org.hamcrest.core - package org.hamcrest.core
+
+
Fundamental matchers of objects and values, and composite matchers.
+
+
org.hamcrest.internal - package org.hamcrest.internal
+
 
+
org.hamcrest.io - package org.hamcrest.io
+
 
+
org.hamcrest.number - package org.hamcrest.number
+
+
Matchers that perform numeric comparisons.
+
+
org.hamcrest.object - package org.hamcrest.object
+
+
Matchers that inspect objects and classes.
+
+
org.hamcrest.text - package org.hamcrest.text
+
+
Matchers that perform text comparisons.
+
+
org.hamcrest.xml - package org.hamcrest.xml
+
+
Matchers of XML documents.
+
+
+ + + +

P

+
+
propertyDescriptorsFor(Object, Class<Object>) - Static method in class org.hamcrest.beans.PropertyUtil
+
+
Returns all the property descriptors for the class associated with the given object
+
+
PropertyUtil - Class in org.hamcrest.beans
+
+
Utility class for accessing properties on JavaBean objects.
+
+
PropertyUtil() - Constructor for class org.hamcrest.beans.PropertyUtil
+
 
+
+ + + +

R

+
+
ReflectiveTypeFinder - Class in org.hamcrest.internal
+
 
+
ReflectiveTypeFinder(String, int, int) - Constructor for class org.hamcrest.internal.ReflectiveTypeFinder
+
 
+
remove() - Method in class org.hamcrest.internal.ArrayIterator
+
 
+
remove() - Method in class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
+ + + +

S

+
+
sameInstance(T) - Static method in class org.hamcrest.core.IsSame
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
sameInstance(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
sameInstance(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
SamePropertyValuesAs<T> - Class in org.hamcrest.beans
+
 
+
SamePropertyValuesAs(T, List<String>) - Constructor for class org.hamcrest.beans.SamePropertyValuesAs
+
 
+
samePropertyValuesAs(B, String...) - Static method in class org.hamcrest.beans.SamePropertyValuesAs
+
+
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+
+
samePropertyValuesAs(B, String...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
+
+
SelfDescribing - Interface in org.hamcrest
+
+
The ability of an object to describe itself.
+
+
SelfDescribingValue<T> - Class in org.hamcrest.internal
+
 
+
SelfDescribingValue(T) - Constructor for class org.hamcrest.internal.SelfDescribingValue
+
 
+
SelfDescribingValueIterator<T> - Class in org.hamcrest.internal
+
 
+
SelfDescribingValueIterator(Iterator<T>) - Constructor for class org.hamcrest.internal.SelfDescribingValueIterator
+
 
+
startsWith(String) - Static method in class org.hamcrest.core.StringStartsWith
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String.
+
+
startsWith(String) - Static method in class org.hamcrest.CoreMatchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String.
+
+
startsWith(String) - Static method in class org.hamcrest.Matchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String.
+
+
startsWithIgnoringCase(String) - Static method in class org.hamcrest.core.StringStartsWith
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
+
+
startsWithIgnoringCase(String) - Static method in class org.hamcrest.CoreMatchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
+
+
startsWithIgnoringCase(String) - Static method in class org.hamcrest.Matchers
+
+
+ Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
+
+
StringContains - Class in org.hamcrest.core
+
+
Tests if the argument is a string that contains a specific substring.
+
+
StringContains(boolean, String) - Constructor for class org.hamcrest.core.StringContains
+
 
+
stringContainsInOrder(Iterable<String>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
stringContainsInOrder(String...) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
StringContainsInOrder - Class in org.hamcrest.text
+
 
+
StringContainsInOrder(Iterable<String>) - Constructor for class org.hamcrest.text.StringContainsInOrder
+
 
+
stringContainsInOrder(Iterable<String>) - Static method in class org.hamcrest.text.StringContainsInOrder
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
stringContainsInOrder(String...) - Static method in class org.hamcrest.text.StringContainsInOrder
+
+
Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
+
+
StringDescription - Class in org.hamcrest
+
+
A Description that is stored as a string.
+
+
StringDescription() - Constructor for class org.hamcrest.StringDescription
+
 
+
StringDescription(Appendable) - Constructor for class org.hamcrest.StringDescription
+
 
+
StringEndsWith - Class in org.hamcrest.core
+
+
Tests if the argument is a string that ends with a specific substring.
+
+
StringEndsWith(boolean, String) - Constructor for class org.hamcrest.core.StringEndsWith
+
 
+
StringRegularExpression - Class in org.hamcrest.core
+
 
+
StringRegularExpression(Pattern) - Constructor for class org.hamcrest.core.StringRegularExpression
+
 
+
StringStartsWith - Class in org.hamcrest.core
+
+
Tests if the argument is a string that starts with a specific substring.
+
+
StringStartsWith(boolean, String) - Constructor for class org.hamcrest.core.StringStartsWith
+
 
+
stripSpaces(String) - Method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
 
+
substring - Variable in class org.hamcrest.core.SubstringMatcher
+
 
+
SubstringMatcher - Class in org.hamcrest.core
+
 
+
SubstringMatcher(String, boolean, String) - Constructor for class org.hamcrest.core.SubstringMatcher
+
 
+
+ + + +

T

+
+
theInstance(T) - Static method in class org.hamcrest.core.IsSame
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
theInstance(T) - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
theInstance(T) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
+
+
then(Condition.Step<? super T, U>) - Method in class org.hamcrest.Condition
+
 
+
toString() - Method in class org.hamcrest.BaseMatcher
+
 
+
toString() - Method in class org.hamcrest.Description.NullDescription
+
 
+
toString(SelfDescribing) - Static method in class org.hamcrest.StringDescription
+
+
Return the description of a SelfDescribing object as a String.
+
+
toString() - Method in class org.hamcrest.StringDescription
+
+
Returns the description as a string.
+
+
typeCompatibleWith(Class<T>) - Static method in class org.hamcrest.Matchers
+
+
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+
+
typeCompatibleWith(Class<T>) - Static method in class org.hamcrest.object.IsCompatibleType
+
+
Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
+
+
TypeSafeDiagnosingMatcher<T> - Class in org.hamcrest
+
+
Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected.
+
+
TypeSafeDiagnosingMatcher(Class<?>) - Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
TypeSafeDiagnosingMatcher(ReflectiveTypeFinder) - Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
TypeSafeDiagnosingMatcher() - Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
The default constructor for simple sub types
+
+
TypeSafeMatcher<T> - Class in org.hamcrest
+
+
Convenient base class for Matchers that require a non-null value of a specific type.
+
+
TypeSafeMatcher() - Constructor for class org.hamcrest.TypeSafeMatcher
+
+
The default constructor for simple sub types
+
+
TypeSafeMatcher(Class<?>) - Constructor for class org.hamcrest.TypeSafeMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
TypeSafeMatcher(ReflectiveTypeFinder) - Constructor for class org.hamcrest.TypeSafeMatcher
+
+
Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
+
+
+ + + +

U

+
+
usingNaturalOrdering() - Static method in class org.hamcrest.comparator.ComparatorMatcherBuilder
+
+
Creates a matcher factory for matchers of Comparables.
+
+
+ + + +

_

+
+
_dont_implement_Matcher___instead_extend_BaseMatcher_() - Method in class org.hamcrest.BaseMatcher
+
+
Deprecated.
+
+
_dont_implement_Matcher___instead_extend_BaseMatcher_() - Method in interface org.hamcrest.Matcher
+
+
Deprecated. +
to make
+
+
+
+A B C D E F G H I L M N O P R S T U _ 
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.1/index.html b/docs/javadoc/2.1/index.html new file mode 100644 index 00000000..ca5d01e6 --- /dev/null +++ b/docs/javadoc/2.1/index.html @@ -0,0 +1,75 @@ + + + + + +Hamcrest 2.1 API + + + + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> + + + diff --git a/docs/javadoc/2.1/org/hamcrest/BaseDescription.html b/docs/javadoc/2.1/org/hamcrest/BaseDescription.html new file mode 100644 index 00000000..9ce91dc2 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/BaseDescription.html @@ -0,0 +1,479 @@ + + + + + +BaseDescription (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class BaseDescription

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.BaseDescription
    • +
    +
  • +
+
+ +
+
+
    +
  • + + + + + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      BaseDescription() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and TypeMethod and Description
      protected abstract voidappend(char c) +
      Append the char c to the description.
      +
      protected voidappend(java.lang.String str) +
      Append the String str to the description.
      +
      DescriptionappendDescriptionOf(SelfDescribing value) +
      Appends the description of a SelfDescribing value to this description.
      +
      DescriptionappendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values) +
      Appends a list of SelfDescribing objects + to the description.
      +
      DescriptionappendText(java.lang.String text) +
      Appends some plain text to the description.
      +
      DescriptionappendValue(java.lang.Object value) +
      Appends an arbitrary value to the description.
      +
      <T> DescriptionappendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values) +
      Appends a list of values to the description.
      +
      <T> DescriptionappendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values) +
      Appends a list of values to the description.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BaseDescription

        +
        public BaseDescription()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        appendText

        +
        public Description appendText(java.lang.String text)
        +
        Description copied from interface: Description
        +
        Appends some plain text to the description.
        +
        +
        Specified by:
        +
        appendText in interface Description
        +
        +
      • +
      + + + + + + + +
        +
      • +

        appendValue

        +
        public Description appendValue(java.lang.Object value)
        +
        Description copied from interface: Description
        +
        Appends an arbitrary value to the description.
        +
        +
        Specified by:
        +
        appendValue in interface Description
        +
        +
      • +
      + + + + + +
        +
      • +

        appendValueList

        +
        @SafeVarargs
        +public final <T> Description appendValueList(java.lang.String start,
        +                                                          java.lang.String separator,
        +                                                          java.lang.String end,
        +                                                          T... values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendValueList

        +
        public <T> Description appendValueList(java.lang.String start,
        +                                       java.lang.String separator,
        +                                       java.lang.String end,
        +                                       java.lang.Iterable<T> values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendList

        +
        public Description appendList(java.lang.String start,
        +                              java.lang.String separator,
        +                              java.lang.String end,
        +                              java.lang.Iterable<? extends SelfDescribing> values)
        +
        Description copied from interface: Description
        +
        Appends a list of SelfDescribing objects + to the description.
        +
        +
        Specified by:
        +
        appendList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        append

        +
        protected void append(java.lang.String str)
        +
        Append the String str to the description. + The default implementation passes every character to append(char). + Override in subclasses to provide an efficient implementation.
        +
      • +
      + + + +
        +
      • +

        append

        +
        protected abstract void append(char c)
        +
        Append the char c to the description.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/BaseMatcher.html b/docs/javadoc/2.1/org/hamcrest/BaseMatcher.html new file mode 100644 index 00000000..21313a57 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/BaseMatcher.html @@ -0,0 +1,383 @@ + + + + + +BaseMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class BaseMatcher<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.BaseMatcher<T>
    • +
    +
  • +
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BaseMatcher

        +
        public BaseMatcher()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeMismatch

        +
        public void describeMismatch(java.lang.Object item,
        +                             Description description)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        isNotNull

        +
        protected static boolean isNotNull(java.lang.Object actual,
        +                                   Description mismatch)
        +
        Useful null-check method. Writes a mismatch description if the actual object is null
        +
        +
        Parameters:
        +
        actual - the object to check
        +
        mismatch - where to write the mismatch description, if any
        +
        Returns:
        +
        false iff the actual object is null
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/Condition.Step.html b/docs/javadoc/2.1/org/hamcrest/Condition.Step.html new file mode 100644 index 00000000..17f80523 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/Condition.Step.html @@ -0,0 +1,227 @@ + + + + + +Condition.Step (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface Condition.Step<I,O>

+
+
+
+
    +
  • +
    +
    Enclosing class:
    +
    Condition<T>
    +
    +
    +
    +
    public static interface Condition.Step<I,O>
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/Condition.html b/docs/javadoc/2.1/org/hamcrest/Condition.html new file mode 100644 index 00000000..eae1e968 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/Condition.html @@ -0,0 +1,367 @@ + + + + + +Condition (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class Condition<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.Condition<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public abstract class Condition<T>
    +extends java.lang.Object
    +
    A Condition implements part of a multi-step match. We sometimes need to write matchers + that have a sequence of steps, where each step depends on the result of the previous + step and we can stop processing as soon as a step fails. These classes provide + infrastructure for writing such a sequence. + + Based on https://github.com/npryce/maybe-java
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NOT_MATCHED

        +
        public static final org.hamcrest.Condition.NotMatched<java.lang.Object> NOT_MATCHED
        +
      • +
      +
    • +
    + + +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/CoreMatchers.html b/docs/javadoc/2.1/org/hamcrest/CoreMatchers.html new file mode 100644 index 00000000..a2ad61d6 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/CoreMatchers.html @@ -0,0 +1,1077 @@ + + + + + +CoreMatchers (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class CoreMatchers

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.CoreMatchers
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class CoreMatchers
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      CoreMatchers() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T> Matcher<T>allOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>any(java.lang.Class<T> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> AnyOf<T>anyOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static Matcher<java.lang.Object>anything() +
      Creates a matcher that always matches, regardless of the examined object.
      +
      static Matcher<java.lang.Object>anything(java.lang.String description) +
      Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
      +
      static <LHS> CombinableMatcher.CombinableBothMatcher<LHS>both(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when both of the specified matchers match the examined object.
      +
      static Matcher<java.lang.String>containsString(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere.
      +
      static Matcher<java.lang.String>containsStringIgnoringCase(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
      +
      static <T> Matcher<T>describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) +
      Wraps an existing matcher, overriding its description with that specified.
      +
      static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS>either(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when either of the specified matchers match the examined object.
      +
      static Matcher<java.lang.String>endsWith(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String.
      +
      static Matcher<java.lang.String>endsWithIgnoringCase(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
      +
      static <T> Matcher<T>equalTo(T operand) +
      Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
      +
      static Matcher<java.lang.Object>equalToObject(java.lang.Object operand) +
      Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
      +
      static <U> Matcher<java.lang.Iterable<? extends U>>everyItem(Matcher<U> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(Matcher<? super T> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(T item) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(Matcher<? super T>... itemMatchers) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(T... items) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
      +
      static <T> Matcher<T>instanceOf(java.lang.Class<?> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> Matcher<T>is(Matcher<T> matcher) +
      Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
      +
      static <T> Matcher<T>is(T value) +
      A shortcut to the frequently used is(equalTo(x)).
      +
      static <T> Matcher<T>isA(java.lang.Class<T> type) +
      A shortcut to the frequently used is(instanceOf(SomeClass.class)).
      +
      static <T> Matcher<T>not(Matcher<T> matcher) +
      Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
      +
      static <T> Matcher<T>not(T value) +
      A shortcut to the frequently used not(equalTo(x)).
      +
      static Matcher<java.lang.Object>notNullValue() +
      A shortcut to the frequently used not(nullValue()).
      +
      static <T> Matcher<T>notNullValue(java.lang.Class<T> type) +
      A shortcut to the frequently used not(nullValue(X.class)).
      +
      static Matcher<java.lang.Object>nullValue() +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>nullValue(java.lang.Class<T> type) +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>sameInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      static Matcher<java.lang.String>startsWith(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String.
      +
      static Matcher<java.lang.String>startsWithIgnoringCase(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
      +
      static <T> Matcher<T>theInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CoreMatchers

        +
        public CoreMatchers()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        @SafeVarargs
        +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        both

        +
        public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when both of the specified matchers match the examined object. + For example: +
        assertThat("fab", both(containsString("a")).and(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        either

        +
        public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when either of the specified matchers match the examined object. + For example: +
        assertThat("fan", either(containsString("a")).or(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        describedAs

        +
        public static <T> Matcher<T> describedAs(java.lang.String description,
        +                                         Matcher<T> matcher,
        +                                         java.lang.Object... values)
        +
        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())
        +
        +
        Parameters:
        +
        description - the new description for the wrapped matcher
        +
        matcher - the matcher to wrap
        +
        values - optional values to insert into the tokenised description
        +
        +
      • +
      + + + +
        +
      • +

        everyItem

        +
        public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. + For example: +
        assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to every item provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(Matcher<T> matcher)
        +
        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))
        +
      • +
      + + + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(T value)
        +
        A shortcut to the frequently used is(equalTo(x)). + For example: +
        assertThat(cheese, is(smelly))
        + instead of: +
        assertThat(cheese, is(equalTo(smelly)))
        +
      • +
      + + + +
        +
      • +

        isA

        +
        public static <T> Matcher<T> isA(java.lang.Class<T> type)
        +
        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)))
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything()
        +
        Creates a matcher that always matches, regardless of the examined object.
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything(java.lang.String description)
        +
        Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
        +
        +
        Parameters:
        +
        description - a meaningful String used when describing itself
        +
        +
      • +
      + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        +
        +
        Parameters:
        +
        item - the item to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        +
        +
        Parameters:
        +
        items - the items to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        equalTo

        +
        public static <T> Matcher<T> equalTo(T operand)
        +
        Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

        + For example: +
        + assertThat("foo", equalTo("foo"));
        + assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
        + 
        +
      • +
      + + + +
        +
      • +

        equalToObject

        +
        public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)
        +
        Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
        +
      • +
      + + + +
        +
      • +

        any

        +
        public static <T> Matcher<T> any(java.lang.Class<T> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
        +
      • +
      + + + +
        +
      • +

        instanceOf

        +
        public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

        + For example: +
        assertThat(new Canoe(), instanceOf(Paddlable.class));
        +
      • +
      + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(Matcher<T> matcher)
        +
        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))))
        +
        +
        Parameters:
        +
        matcher - the matcher whose sense should be inverted
        +
        +
      • +
      + + + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(T value)
        +
        A shortcut to the frequently used not(equalTo(x)). + For example: +
        assertThat(cheese, is(not(smelly)))
        + instead of: +
        assertThat(cheese, is(not(equalTo(smelly))))
        +
        +
        Parameters:
        +
        value - the value that any examined object should not equal
        +
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static Matcher<java.lang.Object> notNullValue()
        +
        A shortcut to the frequently used not(nullValue()). + For example: +
        assertThat(cheese, is(notNullValue()))
        + instead of: +
        assertThat(cheese, is(not(nullValue())))
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
        +
        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))))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static Matcher<java.lang.Object> nullValue()
        +
        Creates a matcher that matches if examined object is null. + For example: +
        assertThat(cheese, is(nullValue())
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
        +
        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))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + + + +
        +
      • +

        sameInstance

        +
        public static <T> Matcher<T> sameInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + + + +
        +
      • +

        theInstance

        +
        public static <T> Matcher<T> theInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + +
        +
      • +

        containsString

        +
        public static Matcher<java.lang.String> containsString(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        containsStringIgnoringCase

        +
        public static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWith

        +
        public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String. +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWithIgnoringCase

        +
        public static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWith

        +
        public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWithIgnoringCase

        +
        public static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String, ignoring case. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/CustomMatcher.html b/docs/javadoc/2.1/org/hamcrest/CustomMatcher.html new file mode 100644 index 00000000..d08d8c2a --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/CustomMatcher.html @@ -0,0 +1,324 @@ + + + + + +CustomMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class CustomMatcher<T>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    T - The type of object being matched.
    +
    +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public abstract class CustomMatcher<T>
    +extends BaseMatcher<T>
    +
    Utility class for writing one off matchers. + For example: +
    + Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
    +   public boolean matches(Object object) {
    +     return ((object instanceof String) && !((String) object).isEmpty();
    +   }
    + };
    + 
    +

    + This class is designed for scenarios where an anonymous inner class + matcher makes sense. It should not be used by API designers implementing + matchers.

    +
    +
    See Also:
    +
    for a type safe variant of this class that you probably + want to use.
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CustomMatcher

        +
        public CustomMatcher(java.lang.String description)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        public final void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/CustomTypeSafeMatcher.html b/docs/javadoc/2.1/org/hamcrest/CustomTypeSafeMatcher.html new file mode 100644 index 00000000..93ac03d2 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/CustomTypeSafeMatcher.html @@ -0,0 +1,327 @@ + + + + + +CustomTypeSafeMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class CustomTypeSafeMatcher<T>

+
+
+ +
+
    +
  • +
    +
    Type Parameters:
    +
    T - The type of object being matched
    +
    +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public abstract class CustomTypeSafeMatcher<T>
    +extends TypeSafeMatcher<T>
    +
    Utility class for writing one off matchers. + For example: +
    + Matcher<String> aNonEmptyString = new CustomTypeSafeMatcher<String>("a non empty string") {
    +   public boolean matchesSafely(String string) {
    +     return !string.isEmpty();
    +   }
    +   public void describeMismatchSafely(String string, Description mismatchDescription) {
    +     mismatchDescription.appendText("was empty");
    +   }
    + };
    + 
    + This is a variant of CustomMatcher that first type checks + the argument being matched. By the time TypeSafeMatcher.matchesSafely(T) is + is called the argument is guaranteed to be non-null and of the correct + type.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CustomTypeSafeMatcher

        +
        public CustomTypeSafeMatcher(java.lang.String description)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        public final void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/Description.NullDescription.html b/docs/javadoc/2.1/org/hamcrest/Description.NullDescription.html new file mode 100644 index 00000000..3ecb79b7 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/Description.NullDescription.html @@ -0,0 +1,460 @@ + + + + + +Description.NullDescription (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class Description.NullDescription

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.Description.NullDescription
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Description
    +
    +
    +
    Enclosing interface:
    +
    Description
    +
    +
    +
    +
    public static final class Description.NullDescription
    +extends java.lang.Object
    +implements Description
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        NullDescription

        +
        public NullDescription()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        appendList

        +
        public Description appendList(java.lang.String start,
        +                              java.lang.String separator,
        +                              java.lang.String end,
        +                              java.lang.Iterable<? extends SelfDescribing> values)
        +
        Description copied from interface: Description
        +
        Appends a list of SelfDescribing objects + to the description.
        +
        +
        Specified by:
        +
        appendList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendText

        +
        public Description appendText(java.lang.String text)
        +
        Description copied from interface: Description
        +
        Appends some plain text to the description.
        +
        +
        Specified by:
        +
        appendText in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendValue

        +
        public Description appendValue(java.lang.Object value)
        +
        Description copied from interface: Description
        +
        Appends an arbitrary value to the description.
        +
        +
        Specified by:
        +
        appendValue in interface Description
        +
        +
      • +
      + + + + + +
        +
      • +

        appendValueList

        +
        public <T> Description appendValueList(java.lang.String start,
        +                                       java.lang.String separator,
        +                                       java.lang.String end,
        +                                       T... values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        appendValueList

        +
        public <T> Description appendValueList(java.lang.String start,
        +                                       java.lang.String separator,
        +                                       java.lang.String end,
        +                                       java.lang.Iterable<T> values)
        +
        Description copied from interface: Description
        +
        Appends a list of values to the description.
        +
        +
        Specified by:
        +
        appendValueList in interface Description
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/Description.html b/docs/javadoc/2.1/org/hamcrest/Description.html new file mode 100644 index 00000000..91237e7d --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/Description.html @@ -0,0 +1,392 @@ + + + + + +Description (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface Description

+
+
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NONE

        +
        static final Description NONE
        +
        A description that consumes input but does nothing.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        appendText

        +
        Description appendText(java.lang.String text)
        +
        Appends some plain text to the description.
        +
      • +
      + + + + + + + +
        +
      • +

        appendValue

        +
        Description appendValue(java.lang.Object value)
        +
        Appends an arbitrary value to the description.
        +
      • +
      + + + + + +
        +
      • +

        appendValueList

        +
        <T> Description appendValueList(java.lang.String start,
        +                                java.lang.String separator,
        +                                java.lang.String end,
        +                                T... values)
        +
        Appends a list of values to the description.
        +
      • +
      + + + +
        +
      • +

        appendValueList

        +
        <T> Description appendValueList(java.lang.String start,
        +                                java.lang.String separator,
        +                                java.lang.String end,
        +                                java.lang.Iterable<T> values)
        +
        Appends a list of values to the description.
        +
      • +
      + + + +
        +
      • +

        appendList

        +
        Description appendList(java.lang.String start,
        +                       java.lang.String separator,
        +                       java.lang.String end,
        +                       java.lang.Iterable<? extends SelfDescribing> values)
        +
        Appends a list of SelfDescribing objects + to the description.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/DiagnosingMatcher.html b/docs/javadoc/2.1/org/hamcrest/DiagnosingMatcher.html new file mode 100644 index 00000000..1986de88 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/DiagnosingMatcher.html @@ -0,0 +1,365 @@ + + + + + +DiagnosingMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class DiagnosingMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        DiagnosingMatcher

        +
        public DiagnosingMatcher()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public final boolean matches(java.lang.Object item)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        item - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public final void describeMismatch(java.lang.Object item,
        +                                   Description mismatchDescription)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        matches

        +
        protected abstract boolean matches(java.lang.Object item,
        +                                   Description mismatchDescription)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/FeatureMatcher.html b/docs/javadoc/2.1/org/hamcrest/FeatureMatcher.html new file mode 100644 index 00000000..318e0cad --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/FeatureMatcher.html @@ -0,0 +1,381 @@ + + + + + +FeatureMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class FeatureMatcher<T,U>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FeatureMatcher

        +
        public FeatureMatcher(Matcher<? super U> subMatcher,
        +                      java.lang.String featureDescription,
        +                      java.lang.String featureName)
        +
        Constructor
        +
        +
        Parameters:
        +
        subMatcher - The matcher to apply to the feature
        +
        featureDescription - Descriptive text to use in describeTo
        +
        featureName - Identifying text for mismatch message
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        featureValueOf

        +
        protected abstract U featureValueOf(T actual)
        +
        Implement this to extract the interesting feature.
        +
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public final void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/Matcher.html b/docs/javadoc/2.1/org/hamcrest/Matcher.html new file mode 100644 index 00000000..0eaa13e7 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/Matcher.html @@ -0,0 +1,328 @@ + + + + + +Matcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface Matcher<T>

+
+
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        boolean matches(java.lang.Object actual)
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        actual - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        void describeMismatch(java.lang.Object actual,
        +                      Description mismatchDescription)
        +
        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 + will not check this.
        +
        +
        Parameters:
        +
        actual - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        _dont_implement_Matcher___instead_extend_BaseMatcher_

        +
        @Deprecated
        +void _dont_implement_Matcher___instead_extend_BaseMatcher_()
        +
        Deprecated. to make
        +
        This method simply acts a friendly reminder not to implement Matcher directly and + instead extend BaseMatcher. It's easy to ignore JavaDoc, but a bit harder to ignore + compile errors .
        +
        +
        See Also:
        +
        for reasons why., +BaseMatcher
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/MatcherAssert.html b/docs/javadoc/2.1/org/hamcrest/MatcherAssert.html new file mode 100644 index 00000000..4c753c08 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/MatcherAssert.html @@ -0,0 +1,307 @@ + + + + + +MatcherAssert (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class MatcherAssert

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.MatcherAssert
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class MatcherAssert
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      MatcherAssert() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static voidassertThat(java.lang.String reason, + boolean assertion) 
      static <T> voidassertThat(java.lang.String reason, + T actual, + Matcher<? super T> matcher) 
      static <T> voidassertThat(T actual, + Matcher<? super T> matcher) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MatcherAssert

        +
        public MatcherAssert()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        assertThat

        +
        public static <T> void assertThat(T actual,
        +                                  Matcher<? super T> matcher)
        +
      • +
      + + + + + +
        +
      • +

        assertThat

        +
        public static <T> void assertThat(java.lang.String reason,
        +                                  T actual,
        +                                  Matcher<? super T> matcher)
        +
      • +
      + + + +
        +
      • +

        assertThat

        +
        public static void assertThat(java.lang.String reason,
        +                              boolean assertion)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/Matchers.html b/docs/javadoc/2.1/org/hamcrest/Matchers.html new file mode 100644 index 00000000..3ce516b2 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/Matchers.html @@ -0,0 +1,3426 @@ + + + + + +Matchers (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class Matchers

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.Matchers
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class Matchers
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Matchers() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      static <T> Matcher<T>allOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <T> Matcher<T>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) +
      Creates a matcher that matches if the examined object matches ALL of the specified matchers.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>aMapWithSize(int size) +
      Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>anEmptyMap() +
      Creates a matcher for Maps that matches when the size() method returns + zero.
      +
      static <T> Matcher<T>any(java.lang.Class<T> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> AnyOf<T>anyOf(java.lang.Iterable<Matcher<? super T>> matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<? super T>... matchers) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static <T> AnyOf<T>anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth) +
      Creates a matcher that matches if the examined object matches ANY of the specified matchers.
      +
      static Matcher<java.lang.Object>anything() +
      Creates a matcher that always matches, regardless of the examined object.
      +
      static Matcher<java.lang.Object>anything(java.lang.String description) +
      Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
      +
      static <T> IsArray<T>array(Matcher<? super T>... elementMatchers) +
      Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
      +
      static <E> Matcher<E[]>arrayContaining(E... items) +
      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.
      +
      static <E> Matcher<E[]>arrayContaining(java.util.List<Matcher<? super E>> 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.
      +
      static <E> Matcher<E[]>arrayContaining(Matcher<? super E>... itemMatchers) +
      Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(E... items) +
      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.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(Matcher<? super E>... 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.
      +
      static <E> Matcher<E[]>arrayWithSize(int size) +
      Creates a matcher for arrays that matches when the length of the array + equals the specified size.
      +
      static <E> Matcher<E[]>arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
      +
      static Matcher<java.lang.String>blankOrNullString() +
      Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else.
      +
      static Matcher<java.lang.String>blankString() +
      Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else.
      +
      static <LHS> CombinableMatcher.CombinableBothMatcher<LHS>both(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when both of the specified matchers match the examined object.
      +
      static Matcher<java.math.BigDecimal>closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error) +
      Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error.
      +
      static Matcher<java.lang.Double>closeTo(double operand, + double error) +
      Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      comparesEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E> itemMatcher) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(Matcher<? super T>... itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(T... items) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
      +
      static Matcher<java.lang.String>containsString(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere.
      +
      static Matcher<java.lang.String>containsStringIgnoringCase(java.lang.String substring) +
      Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
      +
      static <T> Matcher<T>describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values) +
      Wraps an existing matcher, overriding its description with that specified.
      +
      static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS>either(Matcher<? super LHS> matcher) +
      Creates a matcher that matches when either of the specified matchers match the examined object.
      +
      static <E> Matcher<java.util.Collection<? extends E>>empty() +
      Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
      +
      static <E> Matcher<E[]>emptyArray() +
      Creates a matcher for arrays that matches when the length of the array + is zero.
      +
      static <E> Matcher<java.util.Collection<E>>emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType) +
      Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>emptyIterable() +
      Creates a matcher for Iterables matching examined iterables that yield no items.
      +
      static <E> Matcher<java.lang.Iterable<E>>emptyIterableOf(java.lang.Class<E> unusedToForceReturnType) +
      Creates a matcher for Iterables matching examined iterables that yield no items.
      +
      static Matcher<java.lang.String>emptyOrNullString() +
      Creates a matcher of String that matches when the examined string is null, or + has zero length.
      +
      static Matcher<java.lang.String>emptyString() +
      Creates a matcher of String that matches when the examined string has zero length.
      +
      static Matcher<java.lang.String>endsWith(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String.
      +
      static Matcher<java.lang.String>endsWithIgnoringCase(java.lang.String suffix) +
      Creates a matcher that matches if the examined String ends with the specified + String, ignoring case.
      +
      static <T> Matcher<T>equalTo(T operand) +
      Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on + the examined object.
      +
      static Matcher<java.lang.String>equalToCompressingWhiteSpace(java.lang.String expectedString) +
      Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored.
      +
      static Matcher<java.lang.String>equalToIgnoringCase(java.lang.String expectedString) +
      Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
      +
      static Matcher<java.lang.String>equalToIgnoringWhiteSpace(java.lang.String expectedString) + +
      static Matcher<java.lang.Object>equalToObject(java.lang.Object operand) +
      Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
      +
      static Matcher<java.util.EventObject>eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source) +
      Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
      +
      static Matcher<java.util.EventObject>eventFrom(java.lang.Object source) +
      Creates a matcher of EventObject that matches any EventObject + announced by source.
      +
      static <U> Matcher<java.lang.Iterable<? extends U>>everyItem(Matcher<U> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(K key, + V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(Matcher<? super T> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(T item) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
      +
      static <T> Matcher<T[]>hasItemInArray(Matcher<? super T> elementMatcher) +
      Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
      +
      static <T> Matcher<T[]>hasItemInArray(T element) +
      A shortcut to the frequently used hasItemInArray(equalTo(x)).
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(Matcher<? super T>... itemMatchers) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(T... items) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(K key) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(Matcher<? super K> keyMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
      +
      static Matcher<java.lang.CharSequence>hasLength(int length) +
      Creates a matcher of CharSequence that matches when a char sequence has the length + of the specified argument.
      +
      static <T> Matcher<T>hasProperty(java.lang.String propertyName) +
      Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
      +
      static <T> Matcher<T>hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher) +
      Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher.
      +
      static <E> Matcher<java.util.Collection<? extends E>>hasSize(int size) +
      Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size.
      +
      static <E> Matcher<java.util.Collection<? extends E>>hasSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher.
      +
      static <T> Matcher<T>hasToString(Matcher<? super java.lang.String> toStringMatcher) +
      Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
      +
      static <T> Matcher<T>hasToString(java.lang.String expectedToString) +
      Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
      +
      static <T> Matcher<T>in(java.util.Collection<T> collection) +
      Creates a matcher that matches when the examined object is found within the + specified collection.
      +
      static <T> Matcher<T>in(T[] elements) +
      Creates a matcher that matches when the examined object is found within the + specified array.
      +
      static <T> Matcher<T>instanceOf(java.lang.Class<?> type) +
      Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the Class.isInstance(Object) method on that type, passing the + the examined object.
      +
      static <T> Matcher<T>is(Matcher<T> matcher) +
      Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
      +
      static <T> Matcher<T>is(T value) +
      A shortcut to the frequently used is(equalTo(x)).
      +
      static <T> Matcher<T>isA(java.lang.Class<?> type) +
      A shortcut to the frequently used is(instanceOf(SomeClass.class)).
      +
      static Matcher<java.lang.String>isEmptyOrNullString() +
      Deprecated.  +
      use is(emptyOrNullString()) instead
      +
      +
      static Matcher<java.lang.String>isEmptyString() +
      Deprecated.  +
      use is(emptyString()) instead
      +
      +
      static <T> Matcher<T>isIn(java.util.Collection<T> collection) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isIn(T[] elements) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isOneOf(T... elements) +
      Deprecated.  +
      use is(oneOf(...)) instead
      +
      +
      static <E> Matcher<java.lang.Iterable<E>>iterableWithSize(int size) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument.
      +
      static <E> Matcher<java.lang.Iterable<E>>iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      static Matcher<java.lang.String>matchesPattern(java.util.regex.Pattern pattern) +
      Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
      +
      static Matcher<java.lang.String>matchesPattern(java.lang.String regex) +
      Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
      +
      static Matcher<java.lang.String>matchesRegex(java.util.regex.Pattern pattern) +
      Validate a string with a Pattern.
      +
      static Matcher<java.lang.String>matchesRegex(java.lang.String regex) +
      Validate a string with a regex.
      +
      static <T> Matcher<T>not(Matcher<T> matcher) +
      Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match.
      +
      static <T> Matcher<T>not(T value) +
      A shortcut to the frequently used not(equalTo(x)).
      +
      static Matcher<java.lang.Double>notANumber() +
      Creates a matcher of Doubles that matches when an examined double is not a number.
      +
      static Matcher<java.lang.Object>notNullValue() +
      A shortcut to the frequently used not(nullValue()).
      +
      static <T> Matcher<T>notNullValue(java.lang.Class<T> type) +
      A shortcut to the frequently used not(nullValue(X.class)).
      +
      static Matcher<java.lang.Object>nullValue() +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>nullValue(java.lang.Class<T> type) +
      Creates a matcher that matches if examined object is null.
      +
      static <T> Matcher<T>oneOf(T... elements) +
      Creates a matcher that matches when the examined object is equal to one of the + specified elements.
      +
      static <T> Matcher<T>sameInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      static <B> Matcher<B>samePropertyValuesAs(B expectedBean, + java.lang.String... ignoredProperties) +
      Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean.
      +
      static Matcher<java.lang.String>startsWith(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String.
      +
      static Matcher<java.lang.String>startsWithIgnoringCase(java.lang.String prefix) +
      + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
      +
      static Matcher<java.lang.String>stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) +
      Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
      +
      static Matcher<java.lang.String>stringContainsInOrder(java.lang.String... substrings) +
      Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance.
      +
      static <T> Matcher<T>theInstance(T target) +
      Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
      +
      static <T> Matcher<java.lang.Class<?>>typeCompatibleWith(java.lang.Class<T> baseType) +
      Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Matchers

        +
        public Matchers()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second,
        +                                   Matcher<? super T> third)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second,
        +                                   Matcher<? super T> third,
        +                                   Matcher<? super T> fourth)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(Matcher<? super T> first,
        +                                   Matcher<? super T> second,
        +                                   Matcher<? super T> third,
        +                                   Matcher<? super T> fourth,
        +                                   Matcher<? super T> fifth)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> 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)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        @SafeVarargs
        +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third,
        +                                 Matcher<? super T> fourth)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third,
        +                                 Matcher<? super T> fourth,
        +                                 Matcher<? super T> fifth)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(Matcher<T> first,
        +                                 Matcher<? super T> second,
        +                                 Matcher<? super T> third,
        +                                 Matcher<? super T> fourth,
        +                                 Matcher<? super T> fifth,
        +                                 Matcher<? super T> sixth)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        both

        +
        public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when both of the specified matchers match the examined object. + For example: +
        assertThat("fab", both(containsString("a")).and(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        either

        +
        public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when either of the specified matchers match the examined object. + For example: +
        assertThat("fan", either(containsString("a")).or(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        describedAs

        +
        public static <T> Matcher<T> describedAs(java.lang.String description,
        +                                         Matcher<T> matcher,
        +                                         java.lang.Object... values)
        +
        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())
        +
        +
        Parameters:
        +
        description - the new description for the wrapped matcher
        +
        matcher - the matcher to wrap
        +
        values - optional values to insert into the tokenized description
        +
        +
      • +
      + + + +
        +
      • +

        everyItem

        +
        public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. + For example: +
        assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to every item provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(Matcher<T> matcher)
        +
        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))
        +
      • +
      + + + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(T value)
        +
        A shortcut to the frequently used is(equalTo(x)). + For example: +
        assertThat(cheese, is(smelly))
        + instead of: +
        assertThat(cheese, is(equalTo(smelly)))
        +
      • +
      + + + +
        +
      • +

        isA

        +
        public static <T> Matcher<T> isA(java.lang.Class<?> type)
        +
        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)))
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything()
        +
        Creates a matcher that always matches, regardless of the examined object.
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything(java.lang.String description)
        +
        Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
        +
        +
        Parameters:
        +
        description - a meaningful String used when describing itself
        +
        +
      • +
      + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        +
        +
        Parameters:
        +
        item - the item to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        +
        +
        Parameters:
        +
        items - the items to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        equalTo

        +
        public static <T> Matcher<T> equalTo(T operand)
        +
        Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

        + For example: +
        + assertThat("foo", equalTo("foo"));
        + assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
        + 
        +
      • +
      + + + +
        +
      • +

        equalToObject

        +
        public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)
        +
        Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
        +
      • +
      + + + +
        +
      • +

        any

        +
        public static <T> Matcher<T> any(java.lang.Class<T> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
        +
      • +
      + + + +
        +
      • +

        instanceOf

        +
        public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

        + For example: +
        assertThat(new Canoe(), instanceOf(Paddlable.class));
        +
      • +
      + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(Matcher<T> matcher)
        +
        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))))
        +
        +
        Parameters:
        +
        matcher - the matcher whose sense should be inverted
        +
        +
      • +
      + + + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(T value)
        +
        A shortcut to the frequently used not(equalTo(x)). + For example: +
        assertThat(cheese, is(not(smelly)))
        + instead of: +
        assertThat(cheese, is(not(equalTo(smelly))))
        +
        +
        Parameters:
        +
        value - the value that any examined object should not equal
        +
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static Matcher<java.lang.Object> notNullValue()
        +
        A shortcut to the frequently used not(nullValue()). + For example: +
        assertThat(cheese, is(notNullValue()))
        + instead of: +
        assertThat(cheese, is(not(nullValue())))
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
        +
        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))))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static Matcher<java.lang.Object> nullValue()
        +
        Creates a matcher that matches if examined object is null. + For example: +
        assertThat(cheese, is(nullValue())
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
        +
        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))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + + + +
        +
      • +

        sameInstance

        +
        public static <T> Matcher<T> sameInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + + + +
        +
      • +

        theInstance

        +
        public static <T> Matcher<T> theInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + +
        +
      • +

        containsString

        +
        public static Matcher<java.lang.String> containsString(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        containsStringIgnoringCase

        +
        public static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case. + For example: +
        assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWith

        +
        public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String. +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWithIgnoringCase

        +
        public static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case +

        + For example: +
        assertThat("myStringOfNote", startsWithIgnoringCase("My"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWith

        +
        public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWithIgnoringCase

        +
        public static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String, ignoring case. + For example: +
        assertThat("myStringOfNote", endsWithIgnoringCase("note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        matchesRegex

        +
        public static Matcher<java.lang.String> matchesRegex(java.util.regex.Pattern pattern)
        +
        Validate a string with a Pattern. + +
        + assertThat("abc", matchesRegex(Pattern.compile("ˆ[a-z]$"));
        + 
        +
        +
        Parameters:
        +
        pattern - the pattern to be used.
        +
        Returns:
        +
        The matcher.
        +
        +
      • +
      + + + +
        +
      • +

        matchesRegex

        +
        public static Matcher<java.lang.String> matchesRegex(java.lang.String regex)
        +
        Validate a string with a regex. + +
        + assertThat("abc", matchesRegex("ˆ[a-z]+$"));
        + 
        +
        +
        Parameters:
        +
        regex - The regex to be used for the validation.
        +
        Returns:
        +
        The matcher.
        +
        +
      • +
      + + + +
        +
      • +

        array

        +
        @SafeVarargs
        +public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)
        +
        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: +
        assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
        +
        +
        Parameters:
        +
        elementMatchers - the matchers that the elements of examined arrays should satisfy
        +
        +
      • +
      + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
        +
        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: +
        assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
        +
        +
        Parameters:
        +
        elementMatcher - the matcher to apply to elements in examined arrays
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(T element)
        +
        A shortcut to the frequently used hasItemInArray(equalTo(x)). + For example: +
        assertThat(hasItemInArray(x))
        + instead of: +
        assertThat(hasItemInArray(equalTo(x)))
        +
        +
        Parameters:
        +
        element - the element that should be present in examined arrays
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContaining

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContaining(E... items)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, arrayContaining("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items within an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items in the examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> 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: +
        assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
        +

        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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the entries of an examined array, in any order
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the length of an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(int size)
        +
        Creates a matcher for arrays that matches when the length of the array + equals the specified size. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
        +
        +
        Parameters:
        +
        size - the length that an examined array must have for a positive match
        +
        +
      • +
      + + + +
        +
      • +

        emptyArray

        +
        public static <E> Matcher<E[]> emptyArray()
        +
        Creates a matcher for arrays that matches when the length of the array + is zero. + For example: +
        assertThat(new String[0], emptyArray())
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(myMap, is(aMapWithSize(equalTo(2))))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(myMap, is(aMapWithSize(2)))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        anEmptyMap

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()
        +
        Creates a matcher for Maps that matches when the size() method returns + zero. + For example: +
        assertThat(myMap, is(anEmptyMap()))
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Collection
        +
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(2))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Collection
        +
        +
      • +
      + + + +
        +
      • +

        empty

        +
        public static <E> Matcher<java.util.Collection<? extends E>> empty()
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(empty()))
        +
      • +
      + + + +
        +
      • +

        emptyCollectionOf

        +
        public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the collection's content
        +
        +
      • +
      + + + +
        +
      • +

        emptyIterable

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterable()))
        +
      • +
      + + + +
        +
      • +

        emptyIterableOf

        +
        public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the iterable's content
        +
        +
      • +
      + + + + + +
        +
      • +

        contains

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. For a positive match, the examined iterable + must be of the same length as the number of specified items. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. + For example: +
        assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. For a positive match, the examined iterable + must be of the same length as the number of specified matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. For a positive match, the examined iterable + must be of the same length as the specified list of matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. For a positive match, the examined iterable 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInAnyOrder

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. For a positive match, the examined iterable + 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable in any order
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. For a positive match, the examined iterable + 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 iterable. +

        +

        For example:

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInRelativeOrder

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
        +
        +
        Parameters:
        +
        items - the items that must be contained within items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the items provided by + an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
        +
        +
        Parameters:
        +
        size - the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
        +                                                                             Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry
        +
        valueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry
        +
        +
      • +
      + + + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
        +                                                                             V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. + For example: +
        assertThat(myMap, hasEntry("bar", "foo"))
        +
        +
        Parameters:
        +
        key - the key that, in combination with the value, must be describe at least one entry
        +
        value - the value that, in combination with the key, must be describe at least one entry
        +
        +
      • +
      + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. + For example: +
        assertThat(myMap, hasKey(equalTo("bar")))
        +
        +
        Parameters:
        +
        keyMatcher - the matcher that must be satisfied by at least one key
        +
        +
      • +
      + + + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. + For example: +
        assertThat(myMap, hasKey("bar"))
        +
        +
        Parameters:
        +
        key - the key that satisfying maps must contain
        +
        +
      • +
      + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasValue(equalTo("foo")))
        +
        +
        Parameters:
        +
        valueMatcher - the matcher that must be satisfied by at least one value
        +
        +
      • +
      + + + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. + For example: +
        assertThat(myMap, hasValue("foo"))
        +
        +
        Parameters:
        +
        value - the value that satisfying maps must contain
        +
        +
      • +
      + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(java.util.Collection<T> collection)
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(T[] elements)
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", is(in(new String[]{"bar", "foo"})))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + +
        +
      • +

        isIn

        +
        public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", isIn(Arrays.asList("bar", "foo")))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isIn

        +
        public static <T> Matcher<T> isIn(T[] elements)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", isIn(new String[]{"bar", "foo"}))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isOneOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> isOneOf(T... elements)
        +
        Deprecated. use is(oneOf(...)) instead
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", isOneOf("bar", "foo"))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      + + + + + +
        +
      • +

        oneOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> oneOf(T... elements)
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", is(oneOf("bar", "foo")))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.lang.Double> closeTo(double operand,
        +                                                double error)
        +
        Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. + For example: +
        assertThat(1.03, is(closeTo(1.0, 0.03)))
        +
        +
        Parameters:
        +
        operand - the expected value of matching doubles
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      + + + +
        +
      • +

        notANumber

        +
        public static Matcher<java.lang.Double> notANumber()
        +
        Creates a matcher of Doubles that matches when an examined double is not a number. + For example: +
        assertThat(Double.NaN, is(notANumber()))
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand,
        +                                                    java.math.BigDecimal error)
        +
        Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. The comparison for equality + is done by BigDecimals BigDecimal.compareTo(java.math.BigDecimal) method. + For example: +
        assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
        +
        +
        Parameters:
        +
        operand - the expected value of matching BigDecimals
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      + + + + + +
        +
      • +

        comparesEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, comparesEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(2, greaterThan(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, greaterThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, lessThan(2))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, lessThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
        +
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringCase

        +
        public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. + For example: +
        assertThat("Foo", equalToIgnoringCase("FOO"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringWhiteSpace

        +
        public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
        + +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      + + + +
        +
      • +

        equalToCompressingWhiteSpace

        +
        public static Matcher<java.lang.String> equalToCompressingWhiteSpace(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. To be + exact, the following whitespace rules are applied: +
          +
        • all leading and trailing whitespace of both the expectedString and the examined string are ignored
        • +
        • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
        • +
        + For example: +
        assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      + + + +
        +
      • +

        emptyOrNullString

        +
        public static Matcher<java.lang.String> emptyOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), is(emptyOrNullString()))
        +
      • +
      + + + +
        +
      • +

        emptyString

        +
        public static Matcher<java.lang.String> emptyString()
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", is(emptyString()))
        +
      • +
      + + + +
        +
      • +

        isEmptyOrNullString

        +
        public static Matcher<java.lang.String> isEmptyOrNullString()
        +
        Deprecated. use is(emptyOrNullString()) instead
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), isEmptyOrNullString())
        +
      • +
      + + + +
        +
      • +

        isEmptyString

        +
        public static Matcher<java.lang.String> isEmptyString()
        +
        Deprecated. use is(emptyString()) instead
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", isEmptyString())
        +
      • +
      + + + +
        +
      • +

        blankOrNullString

        +
        public static Matcher<java.lang.String> blankOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else. + For example: +
        assertThat(((String)null), is(blankOrNullString()))
        +
      • +
      + + + +
        +
      • +

        blankString

        +
        public static Matcher<java.lang.String> blankString()
        +
        Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else. + For example: +
        assertThat("  ", is(blankString()))
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      + + + +
        +
      • +

        hasLength

        +
        public static Matcher<java.lang.CharSequence> hasLength(int length)
        +
        Creates a matcher of CharSequence that matches when a char sequence has the length + of the specified argument. + For example: + +
        + assertThat("text", length(4))
        + 
        +
        +
        Parameters:
        +
        length - the expected length of the string
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. + For example: +
        assertThat(true, hasToString(equalTo("TRUE")))
        +
        +
        Parameters:
        +
        toStringMatcher - the matcher used to verify the toString result
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. + For example: +
        assertThat(true, hasToString("TRUE"))
        +
        +
        Parameters:
        +
        expectedToString - the expected toString result
        +
        +
      • +
      + + + +
        +
      • +

        typeCompatibleWith

        +
        public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
        +
        Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. + For example: +
        assertThat(Integer.class, typeCompatibleWith(Number.class))
        +
        +
        Parameters:
        +
        baseType - the base class to examine classes against
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
        +                                                       java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
        +
        +
        Parameters:
        +
        eventClass - the class of the event to match on
        +
        source - the source of the event
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any EventObject + announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(myBean)))
        +
        +
        Parameters:
        +
        source - the source of the event
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. + For example: +
        assertThat(myBean, hasProperty("foo"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName,
        +                                         Matcher<?> valueMatcher)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. + For example: +
        assertThat(myBean, hasProperty("foo", equalTo("bar"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        valueMatcher - a matcher for the value of the specified property of the examined bean
        +
        +
      • +
      + + + + + +
        +
      • +

        samePropertyValuesAs

        +
        public static <B> Matcher<B> samePropertyValuesAs(B expectedBean,
        +                                                  java.lang.String... ignoredProperties)
        +
        Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. If any properties are marked as ignored, they will be dropped from + both the expected and actual bean. Note that the ignored properties use JavaBean + display names, for example
        age
        rather than method names such as
        getAge
        . + For example: +
        assertThat(myBean, samePropertyValuesAs(myExpectedBean))
        +
        assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
        +
        +
        Parameters:
        +
        expectedBean - the bean against which examined beans are compared
        +
        ignoredProperties - do not check any of these named properties.
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese"))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/SelfDescribing.html b/docs/javadoc/2.1/org/hamcrest/SelfDescribing.html new file mode 100644 index 00000000..8af333cd --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/SelfDescribing.html @@ -0,0 +1,237 @@ + + + + + +SelfDescribing (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Interface SelfDescribing

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        void describeTo(Description description)
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/StringDescription.html b/docs/javadoc/2.1/org/hamcrest/StringDescription.html new file mode 100644 index 00000000..4f7859f0 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/StringDescription.html @@ -0,0 +1,417 @@ + + + + + +StringDescription (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class StringDescription

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringDescription

        +
        public StringDescription()
        +
      • +
      + + + +
        +
      • +

        StringDescription

        +
        public StringDescription(java.lang.Appendable out)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        toString

        +
        public static java.lang.String toString(SelfDescribing selfDescribing)
        +
        Return the description of a SelfDescribing object as a String.
        +
        +
        Parameters:
        +
        selfDescribing - The object to be described.
        +
        Returns:
        +
        The description of the object.
        +
        +
      • +
      + + + + + + + +
        +
      • +

        append

        +
        protected void append(java.lang.String str)
        +
        Description copied from class: BaseDescription
        +
        Append the String str to the description. + The default implementation passes every character to BaseDescription.append(char). + Override in subclasses to provide an efficient implementation.
        +
        +
        Overrides:
        +
        append in class BaseDescription
        +
        +
      • +
      + + + +
        +
      • +

        append

        +
        protected void append(char c)
        +
        Description copied from class: BaseDescription
        +
        Append the char c to the description.
        +
        +
        Specified by:
        +
        append in class BaseDescription
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        Returns the description as a string.
        +
        +
        Overrides:
        +
        toString in class java.lang.Object
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/TypeSafeDiagnosingMatcher.html b/docs/javadoc/2.1/org/hamcrest/TypeSafeDiagnosingMatcher.html new file mode 100644 index 00000000..2a0c4bd6 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/TypeSafeDiagnosingMatcher.html @@ -0,0 +1,423 @@ + + + + + +TypeSafeDiagnosingMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class TypeSafeDiagnosingMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TypeSafeDiagnosingMatcher

        +
        protected TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        expectedType - The expectedType of the actual value.
        +
        +
      • +
      + + + +
        +
      • +

        TypeSafeDiagnosingMatcher

        +
        protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        typeFinder - A type finder to extract the type
        +
        +
      • +
      + + + +
        +
      • +

        TypeSafeDiagnosingMatcher

        +
        protected TypeSafeDiagnosingMatcher()
        +
        The default constructor for simple sub types
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        protected abstract boolean matchesSafely(T item,
        +                                         Description mismatchDescription)
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
      • +
      + + + +
        +
      • +

        matches

        +
        public final boolean matches(java.lang.Object item)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        item - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public final void describeMismatch(java.lang.Object item,
        +                                   Description mismatchDescription)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/TypeSafeMatcher.html b/docs/javadoc/2.1/org/hamcrest/TypeSafeMatcher.html new file mode 100644 index 00000000..c706dbb2 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/TypeSafeMatcher.html @@ -0,0 +1,432 @@ + + + + + +TypeSafeMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest
+

Class TypeSafeMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TypeSafeMatcher

        +
        protected TypeSafeMatcher()
        +
        The default constructor for simple sub types
        +
      • +
      + + + +
        +
      • +

        TypeSafeMatcher

        +
        protected TypeSafeMatcher(java.lang.Class<?> expectedType)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        expectedType - The expectedType of the actual value.
        +
        +
      • +
      + + + +
        +
      • +

        TypeSafeMatcher

        +
        protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder)
        +
        Use this constructor if the subclass that implements matchesSafely + is not the class that binds <T> to a type.
        +
        +
        Parameters:
        +
        typeFinder - A type finder to extract the type
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        protected abstract boolean matchesSafely(T item)
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        protected void describeMismatchSafely(T item,
        +                                      Description mismatchDescription)
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
      • +
      + + + +
        +
      • +

        matches

        +
        public final boolean matches(java.lang.Object item)
        +
        Methods made final to prevent accidental override. + If you need to override this, there's no point on extending TypeSafeMatcher. + Instead, extend the BaseMatcher.
        +
        +
        Parameters:
        +
        item - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public final void describeMismatch(java.lang.Object item,
        +                                   Description description)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/beans/HasProperty.html b/docs/javadoc/2.1/org/hamcrest/beans/HasProperty.html new file mode 100644 index 00000000..4d9183b5 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/beans/HasProperty.html @@ -0,0 +1,384 @@ + + + + + +HasProperty (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class HasProperty<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class HasProperty<T>
    +extends TypeSafeMatcher<T>
    +
    A Matcher that checks that an object has a JavaBean property + with the specified name. If an error occurs during introspection + of the object then this is treated as a mismatch.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasProperty

        +
        public HasProperty(java.lang.String propertyName)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(T obj)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<T>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(T item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<T>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. + For example: +
        assertThat(myBean, hasProperty("foo"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/beans/HasPropertyWithValue.html b/docs/javadoc/2.1/org/hamcrest/beans/HasPropertyWithValue.html new file mode 100644 index 00000000..49edb6b5 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/beans/HasPropertyWithValue.html @@ -0,0 +1,455 @@ + + + + + +HasPropertyWithValue (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class HasPropertyWithValue<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class HasPropertyWithValue<T>
    +extends TypeSafeDiagnosingMatcher<T>
    +

    Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. This is useful for when objects + are created within code under test and passed to a mock object, and you wish + to assert that the created object has certain properties. +

    + +

    Example Usage

    + Consider the situation where we have a class representing a person, which + follows the basic JavaBean convention of having get() and possibly set() + methods for it's properties: +
    + public class Person {
    +   private String name;
    +   public Person(String person) {
    +     this.person = person;
    +   }
    +   public String getName() {
    +     return name;
    +   }
    + }
    + + And that these person objects are generated within a piece of code under test + (a class named PersonGenerator). This object is sent to one of our mock objects + which overrides the PersonGenerationListener interface: +
    + public interface PersonGenerationListener {
    +   public void personGenerated(Person person);
    + }
    + + In order to check that the code under test generates a person with name + "Iain" we would do the following: +
    + Mock personGenListenerMock = mock(PersonGenerationListener.class);
    + personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain")));
    + PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy();
    + +

    If an exception is thrown by the getter method for a property, the property + does not exist, is not readable, or a reflection related exception is thrown + when trying to invoke it then this is treated as an evaluation failure and + the matches method will return false. +

    +

    This matcher class will also work with JavaBean objects that have explicit + bean descriptions via an associated BeanInfo description class. See the + JavaBeans specification for more information: + http://java.sun.com/products/javabeans/docs/index.html +

    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasPropertyWithValue

        +
        public HasPropertyWithValue(java.lang.String propertyName,
        +                            Matcher<?> valueMatcher)
        +
      • +
      + + + +
        +
      • +

        HasPropertyWithValue

        +
        public HasPropertyWithValue(java.lang.String propertyName,
        +                            Matcher<?> valueMatcher,
        +                            java.lang.String messageFormat)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasProperty

        +
        public static <T> Matcher<T> hasProperty(java.lang.String propertyName,
        +                                         Matcher<?> valueMatcher)
        +
        Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. + For example: +
        assertThat(myBean, hasProperty("foo", equalTo("bar"))
        +
        +
        Parameters:
        +
        propertyName - the name of the JavaBean property that examined beans should possess
        +
        valueMatcher - a matcher for the value of the specified property of the examined bean
        +
        +
      • +
      + + + +
        +
      • +

        hasPropertyAtPath

        +
        public static <T> Matcher<T> hasPropertyAtPath(java.lang.String path,
        +                                               Matcher<T> valueMatcher)
        +
        Creates a matcher that matches when the examined object is a graph of + JavaBean objects that can be navigated along the declared dot-separated path + and the final element of that path is a JavaBean property whose value satisfies the + specified matcher. + For example: +
        assertThat(myBean, hasProperty("foo.bar.baz", equalTo("a property value"))
        +
        +
        Parameters:
        +
        path - the dot-separated path from the examined object to the JavaBean property
        +
        valueMatcher - a matcher for the value of the specified property of the examined bean
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/beans/PropertyUtil.html b/docs/javadoc/2.1/org/hamcrest/beans/PropertyUtil.html new file mode 100644 index 00000000..48dd62c1 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/beans/PropertyUtil.html @@ -0,0 +1,354 @@ + + + + + +PropertyUtil (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class PropertyUtil

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.beans.PropertyUtil
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class PropertyUtil
    +extends java.lang.Object
    +
    Utility class for accessing properties on JavaBean objects. + See http://java.sun.com/products/javabeans/docs/index.html for + more information on JavaBeans.
    +
    +
    Since:
    +
    1.1.0
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static java.lang.Object[]NO_ARGUMENTS 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      PropertyUtil() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static java.beans.PropertyDescriptorgetPropertyDescriptor(java.lang.String propertyName, + java.lang.Object fromObj) +
      Returns the description of the property with the provided + name on the provided object's interface.
      +
      static java.beans.PropertyDescriptor[]propertyDescriptorsFor(java.lang.Object fromObj, + java.lang.Class<java.lang.Object> stopClass) +
      Returns all the property descriptors for the class associated with the given object
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NO_ARGUMENTS

        +
        public static final java.lang.Object[] NO_ARGUMENTS
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        PropertyUtil

        +
        public PropertyUtil()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getPropertyDescriptor

        +
        public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName,
        +                                                                  java.lang.Object fromObj)
        +                                                           throws java.lang.IllegalArgumentException
        +
        Returns the description of the property with the provided + name on the provided object's interface.
        +
        +
        Returns:
        +
        the descriptor of the property, or null if the property does not exist.
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if there's a introspection failure
        +
        +
      • +
      + + + +
        +
      • +

        propertyDescriptorsFor

        +
        public static java.beans.PropertyDescriptor[] propertyDescriptorsFor(java.lang.Object fromObj,
        +                                                                     java.lang.Class<java.lang.Object> stopClass)
        +                                                              throws java.lang.IllegalArgumentException
        +
        Returns all the property descriptors for the class associated with the given object
        +
        +
        Parameters:
        +
        fromObj - Use the class of this object
        +
        stopClass - Don't include any properties from this ancestor class upwards.
        +
        Returns:
        +
        Property descriptors
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if there's a introspection failure
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/beans/SamePropertyValuesAs.html b/docs/javadoc/2.1/org/hamcrest/beans/SamePropertyValuesAs.html new file mode 100644 index 00000000..18887364 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/beans/SamePropertyValuesAs.html @@ -0,0 +1,364 @@ + + + + + +SamePropertyValuesAs (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.beans
+

Class SamePropertyValuesAs<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        SamePropertyValuesAs

        +
        public SamePropertyValuesAs(T expectedBean,
        +                            java.util.List<java.lang.String> ignoredProperties)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        samePropertyValuesAs

        +
        public static <B> Matcher<B> samePropertyValuesAs(B expectedBean,
        +                                                  java.lang.String... ignoredProperties)
        +
        Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. If any properties are marked as ignored, they will be dropped from + both the expected and actual bean. Note that the ignored properties use JavaBean + display names, for example
        age
        rather than method names such as
        getAge
        . + For example: +
        assertThat(myBean, samePropertyValuesAs(myExpectedBean))
        +
        assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
        +
        +
        Parameters:
        +
        expectedBean - the bean against which examined beans are compared
        +
        ignoredProperties - do not check any of these named properties.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/beans/package-frame.html b/docs/javadoc/2.1/org/hamcrest/beans/package-frame.html new file mode 100644 index 00000000..05a47fe2 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/beans/package-frame.html @@ -0,0 +1,23 @@ + + + + + +org.hamcrest.beans (Hamcrest 2.1 API) + + + + + +

org.hamcrest.beans

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/beans/package-summary.html b/docs/javadoc/2.1/org/hamcrest/beans/package-summary.html new file mode 100644 index 00000000..61addd3f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/beans/package-summary.html @@ -0,0 +1,169 @@ + + + + + +org.hamcrest.beans (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.beans

+
+
Matchers of Java Bean properties and their values.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    HasProperty<T> +
    A Matcher that checks that an object has a JavaBean property + with the specified name.
    +
    HasPropertyWithValue<T> +
    Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher.
    +
    PropertyUtil +
    Utility class for accessing properties on JavaBean objects.
    +
    SamePropertyValuesAs<T> 
    +
  • +
+ + + +

Package org.hamcrest.beans Description

+

Matchers of Java Bean properties and their values.

+
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/beans/package-tree.html b/docs/javadoc/2.1/org/hamcrest/beans/package-tree.html new file mode 100644 index 00000000..0fd46d7f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/beans/package-tree.html @@ -0,0 +1,154 @@ + + + + + +org.hamcrest.beans Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.beans

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/ArrayAsIterableMatcher.html b/docs/javadoc/2.1/org/hamcrest/collection/ArrayAsIterableMatcher.html new file mode 100644 index 00000000..fa643785 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/ArrayAsIterableMatcher.html @@ -0,0 +1,410 @@ + + + + + +ArrayAsIterableMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class ArrayAsIterableMatcher<E>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + + + + + +
        +
      • +

        matchers

        +
        protected final java.util.Collection<Matcher<? super E>> matchers
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ArrayAsIterableMatcher

        +
        public ArrayAsIterableMatcher(TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>> iterableMatcher,
        +                              java.util.Collection<Matcher<? super E>> matchers,
        +                              java.lang.String message)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(E[] item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(E[] item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/ArrayMatching.html b/docs/javadoc/2.1/org/hamcrest/collection/ArrayMatching.html new file mode 100644 index 00000000..d13acda7 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/ArrayMatching.html @@ -0,0 +1,510 @@ + + + + + +ArrayMatching (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class ArrayMatching

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.collection.ArrayMatching
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class ArrayMatching
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ArrayMatching() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <E> Matcher<E[]>arrayContaining(E... items) +
      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.
      +
      static <E> Matcher<E[]>arrayContaining(java.util.List<Matcher<? super E>> 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.
      +
      static <E> Matcher<E[]>arrayContaining(Matcher<? super E>... itemMatchers) +
      Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(E... items) +
      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.
      +
      static <E> Matcher<E[]>arrayContainingInAnyOrder(Matcher<? super E>... 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.
      +
      static <E> java.util.List<Matcher<? super E>>asEqualMatchers(E[] items) 
      static <T> Matcher<T[]>hasItemInArray(Matcher<? super T> elementMatcher) +
      Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher.
      +
      static <T> Matcher<T[]>hasItemInArray(T element) +
      A shortcut to the frequently used hasItemInArray(equalTo(x)).
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ArrayMatching

        +
        public ArrayMatching()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
        +
        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: +
        assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
        +
        +
        Parameters:
        +
        elementMatcher - the matcher to apply to elements in examined arrays
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItemInArray

        +
        public static <T> Matcher<T[]> hasItemInArray(T element)
        +
        A shortcut to the frequently used hasItemInArray(equalTo(x)). + For example: +
        assertThat(hasItemInArray(x))
        + instead of: +
        assertThat(hasItemInArray(equalTo(x)))
        +
        +
        Parameters:
        +
        element - the element that should be present in examined arrays
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> 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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
        +

        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. +

        +

        + For example: +

        +
        assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the entries of an examined array, in any order
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContaining

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContaining(E... items)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items within an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        @SafeVarargs
        +public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
        +
        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: +
        assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items in the examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> 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: +
        assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
        +
        +
      • +
      + + + + + +
        +
      • +

        asEqualMatchers

        +
        public static <E> java.util.List<Matcher<? super E>> asEqualMatchers(E[] items)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/HasItemInArray.html b/docs/javadoc/2.1/org/hamcrest/collection/HasItemInArray.html new file mode 100644 index 00000000..4a218c2d --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/HasItemInArray.html @@ -0,0 +1,358 @@ + + + + + +HasItemInArray (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class HasItemInArray<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T[]>, SelfDescribing
    +
    +
    +
    +
    public class HasItemInArray<T>
    +extends TypeSafeMatcher<T[]>
    +
    Matches if an array contains an item satisfying a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasItemInArray

        +
        public HasItemInArray(Matcher<? super T> elementMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(T[] actual)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(T[] actual,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsArray.html b/docs/javadoc/2.1/org/hamcrest/collection/IsArray.html new file mode 100644 index 00000000..187cd20f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsArray.html @@ -0,0 +1,440 @@ + + + + + +IsArray (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArray<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T[]>, SelfDescribing
    +
    +
    +
    +
    public class IsArray<T>
    +extends TypeSafeMatcher<T[]>
    +
    Matcher for array whose elements satisfy a sequence of matchers. + The array size must equal the number of element matchers.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArray

        +
        public IsArray(Matcher<? super T>[] elementMatchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(T[] array)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(T[] actual,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<T[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        descriptionStart

        +
        protected java.lang.String descriptionStart()
        +
        Returns the string that starts the description. + + Can be overridden in subclasses to customise how the matcher is + described.
        +
      • +
      + + + +
        +
      • +

        descriptionSeparator

        +
        protected java.lang.String descriptionSeparator()
        +
        Returns the string that separates the elements in the description. + + Can be overridden in subclasses to customise how the matcher is + described.
        +
      • +
      + + + +
        +
      • +

        descriptionEnd

        +
        protected java.lang.String descriptionEnd()
        +
        Returns the string that ends the description. + + Can be overridden in subclasses to customise how the matcher is + described.
        +
      • +
      + + + +
        +
      • +

        array

        +
        public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)
        +
        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: +
        assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
        +
        +
        Parameters:
        +
        elementMatchers - the matchers that the elements of examined arrays should satisfy
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsArrayContainingInAnyOrder.html b/docs/javadoc/2.1/org/hamcrest/collection/IsArrayContainingInAnyOrder.html new file mode 100644 index 00000000..5aa413e6 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsArrayContainingInAnyOrder.html @@ -0,0 +1,471 @@ + + + + + +IsArrayContainingInAnyOrder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArrayContainingInAnyOrder<E>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArrayContainingInAnyOrder

        +
        public IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)
        +
        Deprecated. 
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(E[] item)
        +
        Deprecated. 
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(E[] item,
        +                                   Description mismatchDescription)
        +
        Deprecated. 
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Deprecated. 
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
        +
        Deprecated. As of version 2.1, use ArrayMatching.arrayContainingInAnyOrder(Matcher[]).
        +
        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. +

        + For example: +

        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
        +
        Deprecated. As of version 2.1, use ArrayMatching.arrayContainingInAnyOrder(Collection).
        +
        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. +

        + For example: +

        assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContainingInAnyOrder

        +
        public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
        +
        Deprecated. As of version 2.1, use ArrayMatching.arrayContainingInAnyOrder(Object[]).
        +
        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. +

        + For example: +

        assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the entries of an examined array, in any order
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsArrayContainingInOrder.html b/docs/javadoc/2.1/org/hamcrest/collection/IsArrayContainingInOrder.html new file mode 100644 index 00000000..c3de3b6c --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsArrayContainingInOrder.html @@ -0,0 +1,455 @@ + + + + + +IsArrayContainingInOrder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArrayContainingInOrder<E>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArrayContainingInOrder

        +
        public IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers)
        +
        Deprecated. 
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(E[] item)
        +
        Deprecated. 
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(E[] item,
        +                                   Description mismatchDescription)
        +
        Deprecated. 
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<E[]>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Deprecated. 
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(E... items)
        +
        Deprecated. As of version 2.1, use ArrayMatching.arrayContaining(Object[]).
        +
        Creates a matcher for arrays that matcheswhen 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: +

        assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items within an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
        +
        Deprecated. As of version 2.1, use ArrayMatching.arrayContaining(Matcher[]).
        +
        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: +

        assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items in the examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayContaining

        +
        public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Deprecated. As of version 2.1, use ArrayMatching.arrayContaining(List).
        +
        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: +

        assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsArrayWithSize.html b/docs/javadoc/2.1/org/hamcrest/collection/IsArrayWithSize.html new file mode 100644 index 00000000..be0dfaa1 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsArrayWithSize.html @@ -0,0 +1,392 @@ + + + + + +IsArrayWithSize (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsArrayWithSize<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<E[]>, SelfDescribing
    +
    +
    +
    +
    public class IsArrayWithSize<E>
    +extends FeatureMatcher<E[],java.lang.Integer>
    +
    Matches if array size satisfies a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsArrayWithSize

        +
        public IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(E[] actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<E[],java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the length of an examined array
        +
        +
      • +
      + + + +
        +
      • +

        arrayWithSize

        +
        public static <E> Matcher<E[]> arrayWithSize(int size)
        +
        Creates a matcher for arrays that matches when the length of the array + equals the specified size. + For example: +
        assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
        +
        +
        Parameters:
        +
        size - the length that an examined array must have for a positive match
        +
        +
      • +
      + + + +
        +
      • +

        emptyArray

        +
        public static <E> Matcher<E[]> emptyArray()
        +
        Creates a matcher for arrays that matches when the length of the array + is zero. + For example: +
        assertThat(new String[0], emptyArray())
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsCollectionWithSize.html b/docs/javadoc/2.1/org/hamcrest/collection/IsCollectionWithSize.html new file mode 100644 index 00000000..20bf914a --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsCollectionWithSize.html @@ -0,0 +1,370 @@ + + + + + +IsCollectionWithSize (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsCollectionWithSize<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Collection<? extends E>>, SelfDescribing
    +
    +
    +
    +
    public class IsCollectionWithSize<E>
    +extends FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
    +
    Matches if collection size satisfies a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCollectionWithSize

        +
        public IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Collection
        +
        +
      • +
      + + + +
        +
      • +

        hasSize

        +
        public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
        +
        Creates a matcher for Collections that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasSize(2))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Collection
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsEmptyCollection.html b/docs/javadoc/2.1/org/hamcrest/collection/IsEmptyCollection.html new file mode 100644 index 00000000..76cd806f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsEmptyCollection.html @@ -0,0 +1,398 @@ + + + + + +IsEmptyCollection (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsEmptyCollection<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Collection<? extends E>>, SelfDescribing
    +
    +
    +
    +
    public class IsEmptyCollection<E>
    +extends TypeSafeMatcher<java.util.Collection<? extends E>>
    +
    Tests if collection is empty.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEmptyCollection

        +
        public IsEmptyCollection()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.util.Collection<? extends E> item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.util.Collection<? extends E> item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        empty

        +
        public static <E> Matcher<java.util.Collection<? extends E>> empty()
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(empty()))
        +
      • +
      + + + +
        +
      • +

        emptyCollectionOf

        +
        public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Collections matching examined collections whose isEmpty + method returns true. + For example: +
        assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the collection's content
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsEmptyIterable.html b/docs/javadoc/2.1/org/hamcrest/collection/IsEmptyIterable.html new file mode 100644 index 00000000..2506d356 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsEmptyIterable.html @@ -0,0 +1,394 @@ + + + + + +IsEmptyIterable (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsEmptyIterable<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Iterable<? extends E>>, SelfDescribing
    +
    +
    +
    +
    public class IsEmptyIterable<E>
    +extends TypeSafeMatcher<java.lang.Iterable<? extends E>>
    +
    Tests if collection is empty.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEmptyIterable

        +
        public IsEmptyIterable()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Iterable<? extends E> iterable)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Iterable<? extends E> iter,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        emptyIterable

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterable()))
        +
      • +
      + + + +
        +
      • +

        emptyIterableOf

        +
        public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
        +
        Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
        assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
        +
        +
        Parameters:
        +
        unusedToForceReturnType - the type of the iterable's content
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsIn.html b/docs/javadoc/2.1/org/hamcrest/collection/IsIn.html new file mode 100644 index 00000000..df90881e --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsIn.html @@ -0,0 +1,502 @@ + + + + + +IsIn (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIn<T>

+
+
+ +
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      IsIn(java.util.Collection<T> collection) 
      IsIn(T[] elements) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description buffer) +
      Generates a description of the object.
      +
      static <T> Matcher<T>in(java.util.Collection<T> collection) +
      Creates a matcher that matches when the examined object is found within the + specified collection.
      +
      static <T> Matcher<T>in(T[] elements) +
      Creates a matcher that matches when the examined object is found within the + specified array.
      +
      static <T> Matcher<T>isIn(java.util.Collection<T> collection) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isIn(T[] elements) +
      Deprecated.  +
      use is(in(...)) instead
      +
      +
      static <T> Matcher<T>isOneOf(T... elements) +
      Deprecated.  +
      use is(oneOf(...)) instead
      +
      +
      booleanmatches(java.lang.Object o) +
      Evaluates the matcher for argument item.
      +
      static <T> Matcher<T>oneOf(T... elements) +
      Creates a matcher that matches when the examined object is equal to one of the + specified elements.
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIn

        +
        public IsIn(java.util.Collection<T> collection)
        +
      • +
      + + + + + +
        +
      • +

        IsIn

        +
        public IsIn(T[] elements)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description buffer)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        buffer - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        isIn

        +
        @Deprecated
        +public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", isIn(Arrays.asList("bar", "foo")))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(java.util.Collection<T> collection)
        +
        Creates a matcher that matches when the examined object is found within the + specified collection. + For example: +
        assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
        +
        +
        Parameters:
        +
        collection - the collection in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isIn

        +
        @Deprecated
        +public static <T> Matcher<T> isIn(T[] elements)
        +
        Deprecated. use is(in(...)) instead
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", isIn(new String[]{"bar", "foo"}))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        in

        +
        public static <T> Matcher<T> in(T[] elements)
        +
        Creates a matcher that matches when the examined object is found within the + specified array. + For example: +
        assertThat("foo", is(in(new String[]{"bar", "foo"})))
        +
        +
        Parameters:
        +
        elements - the array in which matching items must be found
        +
        +
      • +
      + + + + + +
        +
      • +

        isOneOf

        +
        @SafeVarargs
        + @Deprecated
        +public static <T> Matcher<T> isOneOf(T... elements)
        +
        Deprecated. use is(oneOf(...)) instead
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", isOneOf("bar", "foo"))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      + + + + + +
        +
      • +

        oneOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> oneOf(T... elements)
        +
        Creates a matcher that matches when the examined object is equal to one of the + specified elements. + For example: +
        assertThat("foo", is(oneOf("bar", "foo")))
        +
        +
        Parameters:
        +
        elements - the elements amongst which matching items will be found
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInAnyOrder.html b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInAnyOrder.html new file mode 100644 index 00000000..d99e9671 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInAnyOrder.html @@ -0,0 +1,444 @@ + + + + + +IsIterableContainingInAnyOrder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableContainingInAnyOrder<T>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(Matcher<? super T>... itemMatchers) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers.
      +
      static <T> Matcher<java.lang.Iterable<? extends T>>containsInAnyOrder(T... items) +
      + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? extends T> items, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableContainingInAnyOrder

        +
        public IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? extends T> items,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified matchers. For a positive match, the examined iterable 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInAnyOrder

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each logically equal to one item + anywhere in the specified items. For a positive match, the examined iterable + 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 + iterable. +

        +

        + For example: +

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable in any order
        +
        +
      • +
      + + + +
        +
      • +

        containsInAnyOrder

        +
        public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
        +

        + Creates an order agnostic matcher for Iterables that matches when a single pass over + the examined Iterable yields a series of items, each satisfying one matcher anywhere + in the specified collection of matchers. For a positive match, the examined iterable + 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 iterable. +

        +

        For example:

        +
        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInOrder.html b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInOrder.html new file mode 100644 index 00000000..c1b141ce --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInOrder.html @@ -0,0 +1,443 @@ + + + + + +IsIterableContainingInOrder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableContainingInOrder<E>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>contains(Matcher<? super E> itemMatcher) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableContainingInOrder

        +
        public IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? extends E> iterable,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        contains

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each logically equal to the + corresponding item in the specified items. For a positive match, the examined iterable + must be of the same length as the number of specified items. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
        +
        +
        Parameters:
        +
        items - the items that must equal the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a single item that satisfies the specified matcher. + For a positive match, the examined iterable must only yield one item. + For example: +
        assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified matchers. For a positive match, the examined iterable + must be of the same length as the number of specified matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        contains

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, each satisfying the corresponding + matcher in the specified list of matchers. For a positive match, the examined iterable + must be of the same length as the specified list of matchers. + For example: +
        assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html new file mode 100644 index 00000000..d103639e --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html @@ -0,0 +1,415 @@ + + + + + +IsIterableContainingInRelativeOrder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableContainingInRelativeOrder<E>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(E... items) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example:
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order.
      +
      static <E> Matcher<java.lang.Iterable<? extends E>>containsInRelativeOrder(Matcher<? super E>... itemMatchers) +
      Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableContainingInRelativeOrder

        +
        public IsIterableContainingInRelativeOrder(java.util.List<Matcher<? super E>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? extends E> iterable,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        containsInRelativeOrder

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items logically equal to the + corresponding item in the specified items, in the same relative order + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
        +
        +
        Parameters:
        +
        items - the items that must be contained within items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        @SafeVarargs
        +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that each satisfying the corresponding + matcher in the specified matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order
        +
        +
      • +
      + + + +
        +
      • +

        containsInRelativeOrder

        +
        public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields a series of items, that contains items satisfying the corresponding + matcher in the specified list of matchers, in the same relative order. + For example: +
        assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
        +
        +
        Parameters:
        +
        itemMatchers - a list of matchers, each of which must be satisfied by the items provided by + an examined Iterable in the same relative order
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsIterableWithSize.html b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableWithSize.html new file mode 100644 index 00000000..557c86ee --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsIterableWithSize.html @@ -0,0 +1,373 @@ + + + + + +IsIterableWithSize (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsIterableWithSize<E>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Iterable<E>>, SelfDescribing
    +
    +
    +
    +
    public class IsIterableWithSize<E>
    +extends FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableWithSize

        +
        public IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that satisfies the specified + matcher. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        iterableWithSize

        +
        public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
        +
        Creates a matcher for Iterables that matches when a single pass over the + examined Iterable yields an item count that is equal to the specified + size argument. + For example: +
        assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
        +
        +
        Parameters:
        +
        size - the number of items that should be yielded by an examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsMapContaining.html b/docs/javadoc/2.1/org/hamcrest/collection/IsMapContaining.html new file mode 100644 index 00000000..7893d426 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsMapContaining.html @@ -0,0 +1,515 @@ + + + + + +IsMapContaining (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsMapContaining<K,V>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Map<? extends K,? extends V>>, SelfDescribing
    +
    +
    +
    +
    public class IsMapContaining<K,V>
    +extends TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      IsMapContaining(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeMismatchSafely(java.util.Map<? extends K,? extends V> map, + Description mismatchDescription) +
      Subclasses should override this.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(K key, + V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value.
      +
      static <K,V> Matcher<java.util.Map<? extends K,? extends V>>hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(K key) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key.
      +
      static <K> Matcher<java.util.Map<? extends K,?>>hasKey(Matcher<? super K> keyMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(Matcher<? super V> valueMatcher) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher.
      +
      static <V> Matcher<java.util.Map<?,? extends V>>hasValue(V value) +
      Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value.
      +
      booleanmatchesSafely(java.util.Map<? extends K,? extends V> map) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsMapContaining

        +
        public IsMapContaining(Matcher<? super K> keyMatcher,
        +                       Matcher<? super V> valueMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.util.Map<? extends K,? extends V> map)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
        +                                                                             Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key satisfies the specified keyMatcher and whose + value satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
        +
        +
        Parameters:
        +
        keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry
        +
        valueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry
        +
        +
      • +
      + + + + + +
        +
      • +

        hasEntry

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
        +                                                                             V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one entry whose key equals the specified key and whose value equals the + specified value. + For example: +
        assertThat(myMap, hasEntry("bar", "foo"))
        +
        +
        Parameters:
        +
        key - the key that, in combination with the value, must be describe at least one entry
        +
        value - the value that, in combination with the key, must be describe at least one entry
        +
        +
      • +
      + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that satisfies the specified matcher. + For example: +
        assertThat(myMap, hasKey(equalTo("bar")))
        +
        +
        Parameters:
        +
        keyMatcher - the matcher that must be satisfied by at least one key
        +
        +
      • +
      + + + + + +
        +
      • +

        hasKey

        +
        public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one key that is equal to the specified key. + For example: +
        assertThat(myMap, hasKey("bar"))
        +
        +
        Parameters:
        +
        key - the key that satisfying maps must contain
        +
        +
      • +
      + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that satisfies the specified valueMatcher. + For example: +
        assertThat(myMap, hasValue(equalTo("foo")))
        +
        +
        Parameters:
        +
        valueMatcher - the matcher that must be satisfied by at least one value
        +
        +
      • +
      + + + + + +
        +
      • +

        hasValue

        +
        public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
        +
        Creates a matcher for Maps matching when the examined Map contains + at least one value that is equal to the specified value. + For example: +
        assertThat(myMap, hasValue("foo"))
        +
        +
        Parameters:
        +
        value - the value that satisfying maps must contain
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/IsMapWithSize.html b/docs/javadoc/2.1/org/hamcrest/collection/IsMapWithSize.html new file mode 100644 index 00000000..d09f40f2 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/IsMapWithSize.html @@ -0,0 +1,390 @@ + + + + + +IsMapWithSize (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.collection
+

Class IsMapWithSize<K,V>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.Map<? extends K,? extends V>>, SelfDescribing
    +
    +
    +
    +
    public final class IsMapWithSize<K,V>
    +extends FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>
    +
    Matches if map size satisfies a nested matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsMapWithSize

        +
        public IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(java.util.Map<? extends K,? extends V> actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value that satisfies the specified matcher. + For example: +
        assertThat(myMap, is(aMapWithSize(equalTo(2))))
        +
        +
        Parameters:
        +
        sizeMatcher - a matcher for the size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        aMapWithSize

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)
        +
        Creates a matcher for Maps that matches when the size() method returns + a value equal to the specified size. + For example: +
        assertThat(myMap, is(aMapWithSize(2)))
        +
        +
        Parameters:
        +
        size - the expected size of an examined Map
        +
        +
      • +
      + + + +
        +
      • +

        anEmptyMap

        +
        public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()
        +
        Creates a matcher for Maps that matches when the size() method returns + zero. + For example: +
        assertThat(myMap, is(anEmptyMap()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/package-frame.html b/docs/javadoc/2.1/org/hamcrest/collection/package-frame.html new file mode 100644 index 00000000..8dd61c00 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/package-frame.html @@ -0,0 +1,36 @@ + + + + + +org.hamcrest.collection (Hamcrest 2.1 API) + + + + + +

org.hamcrest.collection

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/package-summary.html b/docs/javadoc/2.1/org/hamcrest/collection/package-summary.html new file mode 100644 index 00000000..58bb8071 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/package-summary.html @@ -0,0 +1,231 @@ + + + + + +org.hamcrest.collection (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.collection

+
+
Matchers of arrays and collections.
+
+

See: Description

+
+
+ + + + +

Package org.hamcrest.collection Description

+

Matchers of arrays and collections.

+
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/collection/package-tree.html b/docs/javadoc/2.1/org/hamcrest/collection/package-tree.html new file mode 100644 index 00000000..fb5b615e --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/collection/package-tree.html @@ -0,0 +1,167 @@ + + + + + +org.hamcrest.collection Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.collection

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/comparator/ComparatorMatcherBuilder.html b/docs/javadoc/2.1/org/hamcrest/comparator/ComparatorMatcherBuilder.html new file mode 100644 index 00000000..f551bf28 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/comparator/ComparatorMatcherBuilder.html @@ -0,0 +1,406 @@ + + + + + +ComparatorMatcherBuilder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.comparator
+

Class ComparatorMatcherBuilder<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.comparator.ComparatorMatcherBuilder<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public final class ComparatorMatcherBuilder<T>
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T> ComparatorMatcherBuilder<T>comparedBy(java.util.Comparator<T> comparator) +
      Creates a matcher factory for matchers of Comparatorss of T.
      +
      Matcher<T>comparesEqualTo(T value) +
      Creates a matcher of T object that matches when the examined object is + equal to the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>greaterThan(T value) +
      Creates a matcher of T object that matches when the examined object is + greater than the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>greaterThanOrEqualTo(T value) +
      Creates a matcher of T object that matches when the examined object is + greater than or equal to the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>lessThan(T value) +
      Creates a matcher of T object that matches when the examined object is + less than the specified value, as reported by the Comparator used to + create this builder.
      +
      Matcher<T>lessThanOrEqualTo(T value) +
      Creates a matcher of T object that matches when the examined object is + less than or equal to the specified value, as reported by the Comparator used to + create this builder.
      +
      static <T extends java.lang.Comparable<T>>
      ComparatorMatcherBuilder<T>
      usingNaturalOrdering() +
      Creates a matcher factory for matchers of Comparables.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        usingNaturalOrdering

        +
        public static <T extends java.lang.Comparable<T>> ComparatorMatcherBuilder<T> usingNaturalOrdering()
        +
        Creates a matcher factory for matchers of Comparables. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
        +
      • +
      + + + +
        +
      • +

        comparedBy

        +
        public static <T> ComparatorMatcherBuilder<T> comparedBy(java.util.Comparator<T> comparator)
        +
        Creates a matcher factory for matchers of Comparatorss of T. + For example: +
        assertThat(5, comparedBy(new Comparator<Integer>() {
        + public int compare(Integer o1, Integer o2) {
        + return -o1.compareTo(o2);
        + }
        + }).lessThan(4))
        +
      • +
      + + + + + +
        +
      • +

        comparesEqualTo

        +
        public Matcher<T> comparesEqualTo(T value)
        +
        Creates a matcher of T object that matches when the examined object is + equal to the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().comparesEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThan

        +
        public Matcher<T> greaterThan(T value)
        +
        Creates a matcher of T object that matches when the examined object is + greater than the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(2, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThan(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return greater + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThanOrEqualTo

        +
        public Matcher<T> greaterThanOrEqualTo(T value)
        +
        Creates a matcher of T object that matches when the examined object is + greater than or equal to the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return greater + than or equal to zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThan

        +
        public Matcher<T> lessThan(T value)
        +
        Creates a matcher of T object that matches when the examined object is + less than the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThan(2))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return less + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThanOrEqualTo

        +
        public Matcher<T> lessThanOrEqualTo(T value)
        +
        Creates a matcher of T object that matches when the examined object is + less than or equal to the specified value, as reported by the Comparator used to + create this builder. + For example: +
        assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the Comparator supplied to this builder, should return less + than or equal to zero
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/comparator/package-frame.html b/docs/javadoc/2.1/org/hamcrest/comparator/package-frame.html new file mode 100644 index 00000000..b23c1bc0 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/comparator/package-frame.html @@ -0,0 +1,20 @@ + + + + + +org.hamcrest.comparator (Hamcrest 2.1 API) + + + + + +

org.hamcrest.comparator

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/2.1/org/hamcrest/comparator/package-summary.html b/docs/javadoc/2.1/org/hamcrest/comparator/package-summary.html new file mode 100644 index 00000000..61dbc6fd --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/comparator/package-summary.html @@ -0,0 +1,140 @@ + + + + + +org.hamcrest.comparator (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.comparator

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/comparator/package-tree.html b/docs/javadoc/2.1/org/hamcrest/comparator/package-tree.html new file mode 100644 index 00000000..0a82c5a9 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/comparator/package-tree.html @@ -0,0 +1,135 @@ + + + + + +org.hamcrest.comparator Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.comparator

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/AllOf.html b/docs/javadoc/2.1/org/hamcrest/core/AllOf.html new file mode 100644 index 00000000..ce900763 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/AllOf.html @@ -0,0 +1,365 @@ + + + + + +AllOf (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class AllOf<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class AllOf<T>
    +extends DiagnosingMatcher<T>
    +
    Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so + subsequent matchers are not called if an earlier matcher returns false.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        AllOf

        +
        public AllOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        allOf

        +
        @SafeVarargs
        +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ALL of the specified matchers. + For example: +
        assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/AnyOf.html b/docs/javadoc/2.1/org/hamcrest/core/AnyOf.html new file mode 100644 index 00000000..05504133 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/AnyOf.html @@ -0,0 +1,398 @@ + + + + + +AnyOf (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class AnyOf<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class AnyOf<T>
    +extends BaseMatcher<T>
    +
    Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so + subsequent matchers are not called if an earlier matcher returns true.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        AnyOf

        +
        public AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Specified by:
        +
        matches in interface Matcher<T>
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Specified by:
        +
        describeTo in interface SelfDescribing
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        anyOf

        +
        @SafeVarargs
        +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
        +
        Creates a matcher that matches if the examined object matches ANY of the specified matchers. + For example: +
        assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
        +
      • +
      + + + +
        +
      • +

        matches

        +
        protected boolean matches(java.lang.Object o,
        +                          boolean shortcut)
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description,
        +                       java.lang.String operator)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html b/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html new file mode 100644 index 00000000..19c1d114 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html @@ -0,0 +1,273 @@ + + + + + +CombinableMatcher.CombinableBothMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class CombinableMatcher.CombinableBothMatcher<X>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<X>
    • +
    +
  • +
+
+
    +
  • +
    +
    Enclosing class:
    +
    CombinableMatcher<T>
    +
    +
    +
    +
    public static final class CombinableMatcher.CombinableBothMatcher<X>
    +extends java.lang.Object
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html b/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html new file mode 100644 index 00000000..5a746a14 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html @@ -0,0 +1,273 @@ + + + + + +CombinableMatcher.CombinableEitherMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class CombinableMatcher.CombinableEitherMatcher<X>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher<X>
    • +
    +
  • +
+
+
    +
  • +
    +
    Enclosing class:
    +
    CombinableMatcher<T>
    +
    +
    +
    +
    public static final class CombinableMatcher.CombinableEitherMatcher<X>
    +extends java.lang.Object
    +
  • +
+
+
+ +
+
+ +
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.html b/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.html new file mode 100644 index 00000000..ced51fa5 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/CombinableMatcher.html @@ -0,0 +1,418 @@ + + + + + +CombinableMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class CombinableMatcher<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CombinableMatcher

        +
        public CombinableMatcher(Matcher<? super T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + + + + + + + +
        +
      • +

        both

        +
        public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when both of the specified matchers match the examined object. + For example: +
        assertThat("fab", both(containsString("a")).and(containsString("b")))
        +
      • +
      + + + +
        +
      • +

        either

        +
        public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
        +
        Creates a matcher that matches when either of the specified matchers match the examined object. + For example: +
        assertThat("fan", either(containsString("a")).or(containsString("b")))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/DescribedAs.html b/docs/javadoc/2.1/org/hamcrest/core/DescribedAs.html new file mode 100644 index 00000000..cdef4bab --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/DescribedAs.html @@ -0,0 +1,391 @@ + + + + + +DescribedAs (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class DescribedAs<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class DescribedAs<T>
    +extends BaseMatcher<T>
    +
    Provides a custom description to another matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        DescribedAs

        +
        public DescribedAs(java.lang.String descriptionTemplate,
        +                   Matcher<T> matcher,
        +                   java.lang.Object[] values)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public void describeMismatch(java.lang.Object item,
        +                             Description description)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        describedAs

        +
        public static <T> Matcher<T> describedAs(java.lang.String description,
        +                                         Matcher<T> matcher,
        +                                         java.lang.Object... values)
        +
        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())
        +
        +
        Parameters:
        +
        description - the new description for the wrapped matcher
        +
        matcher - the matcher to wrap
        +
        values - optional values to insert into the tokenised description
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/Every.html b/docs/javadoc/2.1/org/hamcrest/core/Every.html new file mode 100644 index 00000000..08be7362 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/Every.html @@ -0,0 +1,357 @@ + + + + + +Every (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class Every<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Every

        +
        public Every(Matcher<? super T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Iterable<? extends T> collection,
        +                             Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        everyItem

        +
        public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields items that are all matched by the specified + itemMatcher. + For example: +
        assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to every item provided by the examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/Is.html b/docs/javadoc/2.1/org/hamcrest/core/Is.html new file mode 100644 index 00000000..600f3f20 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/Is.html @@ -0,0 +1,426 @@ + + + + + +Is (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class Is<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class Is<T>
    +extends BaseMatcher<T>
    +
    Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. + + For example: assertThat(cheese, equalTo(smelly)) + vs. assertThat(cheese, is(equalTo(smelly)))
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      Is(Matcher<T> matcher) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeMismatch(java.lang.Object item, + Description mismatchDescription) +
      Generate a description of why the matcher has not accepted the item.
      +
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static <T> Matcher<T>is(Matcher<T> matcher) +
      Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
      +
      static <T> Matcher<T>is(T value) +
      A shortcut to the frequently used is(equalTo(x)).
      +
      static <T> Matcher<T>isA(java.lang.Class<?> type) +
      A shortcut to the frequently used is(instanceOf(SomeClass.class)).
      +
      booleanmatches(java.lang.Object arg) +
      Evaluates the matcher for argument item.
      +
      + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        Is

        +
        public Is(Matcher<T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object arg)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        arg - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatch

        +
        public void describeMismatch(java.lang.Object item,
        +                             Description mismatchDescription)
        +
        Description copied from interface: Matcher
        +
        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 + will not check this.
        +
        +
        Specified by:
        +
        describeMismatch in interface Matcher<T>
        +
        Overrides:
        +
        describeMismatch in class BaseMatcher<T>
        +
        Parameters:
        +
        item - The item that the Matcher has rejected.
        +
        mismatchDescription - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(Matcher<T> matcher)
        +
        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))
        +
      • +
      + + + + + +
        +
      • +

        is

        +
        public static <T> Matcher<T> is(T value)
        +
        A shortcut to the frequently used is(equalTo(x)). + For example: +
        assertThat(cheese, is(smelly))
        + instead of: +
        assertThat(cheese, is(equalTo(smelly)))
        +
      • +
      + + + +
        +
      • +

        isA

        +
        public static <T> Matcher<T> isA(java.lang.Class<?> type)
        +
        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)))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsAnything.html b/docs/javadoc/2.1/org/hamcrest/core/IsAnything.html new file mode 100644 index 00000000..55e5dda0 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsAnything.html @@ -0,0 +1,376 @@ + + + + + +IsAnything (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsAnything<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsAnything<T>
    +extends BaseMatcher<T>
    +
    A matcher that always returns true.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsAnything

        +
        public IsAnything()
        +
      • +
      + + + +
        +
      • +

        IsAnything

        +
        public IsAnything(java.lang.String message)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything()
        +
        Creates a matcher that always matches, regardless of the examined object.
        +
      • +
      + + + +
        +
      • +

        anything

        +
        public static Matcher<java.lang.Object> anything(java.lang.String description)
        +
        Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
        +
        +
        Parameters:
        +
        description - a meaningful String used when describing itself
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsCollectionContaining.html b/docs/javadoc/2.1/org/hamcrest/core/IsCollectionContaining.html new file mode 100644 index 00000000..47f15972 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsCollectionContaining.html @@ -0,0 +1,460 @@ + + + + + +IsCollectionContaining (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsCollectionContaining<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCollectionContaining

        +
        public IsCollectionContaining(Matcher<? super T> elementMatcher)
        +
        Deprecated. 
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? super T> collection,
        +                                Description mismatchDescription)
        +
        Deprecated. 
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Deprecated. 
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
        +
        Deprecated. As of version 2.1, use IsIterableContaining.hasItem(Matcher).
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
        +
        Deprecated. As of version 2.1, use IsIterableContaining.hasItem(Object).
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        +
        +
        Parameters:
        +
        item - the item to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
        +
        Deprecated. As of version 2.1, use IsIterableContaining.hasItems(Matcher[])}.
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
        +
        Deprecated. As of version 2.1, use IsIterableContaining.hasItems(Object[])}.
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        +
        +
        Parameters:
        +
        items - the items to compare against the items provided by the examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsEqual.html b/docs/javadoc/2.1/org/hamcrest/core/IsEqual.html new file mode 100644 index 00000000..c00181ac --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsEqual.html @@ -0,0 +1,385 @@ + + + + + +IsEqual (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsEqual<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsEqual<T>
    +extends BaseMatcher<T>
    +
    Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod?
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      IsEqual(T equalArg) 
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        IsEqual

        +
        public IsEqual(T equalArg)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object actualValue)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        actualValue - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        equalTo

        +
        public static <T> Matcher<T> equalTo(T operand)
        +
        Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) 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.

        + For example: +
        + assertThat("foo", equalTo("foo"));
        + assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
        + 
        +
      • +
      + + + +
        +
      • +

        equalToObject

        +
        public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)
        +
        Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsInstanceOf.html b/docs/javadoc/2.1/org/hamcrest/core/IsInstanceOf.html new file mode 100644 index 00000000..86b91c4f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsInstanceOf.html @@ -0,0 +1,386 @@ + + + + + +IsInstanceOf (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsInstanceOf

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Object>, SelfDescribing
    +
    +
    +
    +
    public class IsInstanceOf
    +extends DiagnosingMatcher<java.lang.Object>
    +
    Tests whether the value is an instance of a class. + Classes of basic types will be converted to the relevant "Object" classes
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      IsInstanceOf(java.lang.Class<?> expectedClass) +
      Creates a new instance of IsInstanceOf
      +
      +
    • +
    + + +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsInstanceOf

        +
        public IsInstanceOf(java.lang.Class<?> expectedClass)
        +
        Creates a new instance of IsInstanceOf
        +
        +
        Parameters:
        +
        expectedClass - The predicate evaluates to true for instances of this class + or one of its subclasses.
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        instanceOf

        +
        public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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.

        + For example: +
        assertThat(new Canoe(), instanceOf(Paddlable.class));
        +
      • +
      + + + +
        +
      • +

        any

        +
        public static <T> Matcher<T> any(java.lang.Class<T> type)
        +
        Creates a matcher that matches when the examined object is an instance of the specified type, + as determined by calling the 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));
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsIterableContaining.html b/docs/javadoc/2.1/org/hamcrest/core/IsIterableContaining.html new file mode 100644 index 00000000..b4376905 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsIterableContaining.html @@ -0,0 +1,445 @@ + + + + + +IsIterableContaining (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsIterableContaining<T>

+
+
+ +
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(Matcher<? super T> itemMatcher) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher.
      +
      static <T> Matcher<java.lang.Iterable<? super T>>hasItem(T item) +
      Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(Matcher<? super T>... itemMatchers) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers.
      +
      static <T> Matcher<java.lang.Iterable<T>>hasItems(T... items) +
      Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items.
      +
      protected booleanmatchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsIterableContaining

        +
        public IsIterableContaining(Matcher<? super T> elementMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.Iterable<? super T> collection,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is matched by the specified + itemMatcher. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
        +
        +
        Parameters:
        +
        itemMatcher - the matcher to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItem

        +
        public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
        +
        Creates a matcher for Iterables that only matches when a single pass over the + examined Iterable yields at least one item that is equal to the specified + item. Whilst matching, the traversal of the examined Iterable + will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        +
        +
        Parameters:
        +
        item - the item to compare against the items provided by the examined Iterable
        +
        +
      • +
      + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is matched by the corresponding + matcher from the specified itemMatchers. Whilst matching, each traversal of + the examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
        +
        +
        Parameters:
        +
        itemMatchers - the matchers to apply to items provided by the examined Iterable
        +
        +
      • +
      + + + + + +
        +
      • +

        hasItems

        +
        @SafeVarargs
        +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
        +
        Creates a matcher for Iterables that matches when consecutive passes over the + examined Iterable yield at least one item that is equal to the corresponding + item from the specified items. Whilst matching, each traversal of the + examined Iterable will stop as soon as a matching item is found. + For example: +
        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        +
        +
        Parameters:
        +
        items - the items to compare against the items provided by the examined Iterable
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsNot.html b/docs/javadoc/2.1/org/hamcrest/core/IsNot.html new file mode 100644 index 00000000..b0e3f0eb --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsNot.html @@ -0,0 +1,376 @@ + + + + + +IsNot (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsNot<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsNot<T>
    +extends BaseMatcher<T>
    +
    Calculates the logical negation of a matcher.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsNot

        +
        public IsNot(Matcher<T> matcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object arg)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        arg - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(Matcher<T> matcher)
        +
        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))))
        +
        +
        Parameters:
        +
        matcher - the matcher whose sense should be inverted
        +
        +
      • +
      + + + + + +
        +
      • +

        not

        +
        public static <T> Matcher<T> not(T value)
        +
        A shortcut to the frequently used not(equalTo(x)). + For example: +
        assertThat(cheese, is(not(smelly)))
        + instead of: +
        assertThat(cheese, is(not(equalTo(smelly))))
        +
        +
        Parameters:
        +
        value - the value that any examined object should not equal
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsNull.html b/docs/javadoc/2.1/org/hamcrest/core/IsNull.html new file mode 100644 index 00000000..f332959d --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsNull.html @@ -0,0 +1,412 @@ + + + + + +IsNull (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsNull<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsNull

        +
        public IsNull()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object o)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        o - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static Matcher<java.lang.Object> nullValue()
        +
        Creates a matcher that matches if examined object is null. + For example: +
        assertThat(cheese, is(nullValue())
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static Matcher<java.lang.Object> notNullValue()
        +
        A shortcut to the frequently used not(nullValue()). + For example: +
        assertThat(cheese, is(notNullValue()))
        + instead of: +
        assertThat(cheese, is(not(nullValue())))
        +
      • +
      + + + +
        +
      • +

        nullValue

        +
        public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
        +
        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))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      + + + +
        +
      • +

        notNullValue

        +
        public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
        +
        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))))
        +
        +
        Parameters:
        +
        type - dummy parameter used to infer the generic type of the returned matcher
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/IsSame.html b/docs/javadoc/2.1/org/hamcrest/core/IsSame.html new file mode 100644 index 00000000..e0d2c3cf --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/IsSame.html @@ -0,0 +1,376 @@ + + + + + +IsSame (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class IsSame<T>

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<T>, SelfDescribing
    +
    +
    +
    +
    public class IsSame<T>
    +extends BaseMatcher<T>
    +
    Is the value the same object as another value?
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        IsSame

        +
        public IsSame(T object)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matches

        +
        public boolean matches(java.lang.Object arg)
        +
        Description copied from interface: Matcher
        +
        Evaluates the matcher for argument item. + + This method matches against Object, instead of the generic type T. This is + because the caller of the Matcher does not know at runtime what the type is + (because of type erasure with Java generics). It is down to the implementations + to check the correct type.
        +
        +
        Parameters:
        +
        arg - the object against which the matcher is evaluated.
        +
        Returns:
        +
        true if item matches, otherwise false.
        +
        See Also:
        +
        BaseMatcher
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + + + +
        +
      • +

        sameInstance

        +
        public static <T> Matcher<T> sameInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      + + + + + +
        +
      • +

        theInstance

        +
        public static <T> Matcher<T> theInstance(T target)
        +
        Creates a matcher that matches only when the examined object is the same instance as + the specified target object.
        +
        +
        Parameters:
        +
        target - the target instance against which others should be assessed
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/StringContains.html b/docs/javadoc/2.1/org/hamcrest/core/StringContains.html new file mode 100644 index 00000000..b82ef677 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/StringContains.html @@ -0,0 +1,379 @@ + + + + + +StringContains (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class StringContains

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class StringContains
    +extends SubstringMatcher
    +
    Tests if the argument is a string that contains a specific substring.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringContains

        +
        public StringContains(boolean ignoringCase,
        +                      java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        containsString

        +
        public static Matcher<java.lang.String> containsString(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere. + For example: +
        assertThat("myStringOfNote", containsString("ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      + + + +
        +
      • +

        containsStringIgnoringCase

        +
        public static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)
        +
        Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case. + For example: +
        assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))
        +
        +
        Parameters:
        +
        substring - the substring that the returned matcher will expect to find within any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/StringEndsWith.html b/docs/javadoc/2.1/org/hamcrest/core/StringEndsWith.html new file mode 100644 index 00000000..f652125c --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/StringEndsWith.html @@ -0,0 +1,379 @@ + + + + + +StringEndsWith (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class StringEndsWith

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class StringEndsWith
    +extends SubstringMatcher
    +
    Tests if the argument is a string that ends with a specific substring.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringEndsWith

        +
        public StringEndsWith(boolean ignoringCase,
        +                      java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        endsWith

        +
        public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String. + For example: +
        assertThat("myStringOfNote", endsWith("Note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        endsWithIgnoringCase

        +
        public static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)
        +
        Creates a matcher that matches if the examined String ends with the specified + String, ignoring case. + For example: +
        assertThat("myStringOfNote", endsWithIgnoringCase("note"))
        +
        +
        Parameters:
        +
        suffix - the substring that the returned matcher will expect at the end of any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/StringRegularExpression.html b/docs/javadoc/2.1/org/hamcrest/core/StringRegularExpression.html new file mode 100644 index 00000000..9b5b6f1f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/StringRegularExpression.html @@ -0,0 +1,385 @@ + + + + + +StringRegularExpression (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class StringRegularExpression

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringRegularExpression

        +
        protected StringRegularExpression(java.util.regex.Pattern pattern)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.String actual,
        +                                Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        matchesRegex

        +
        public static Matcher<java.lang.String> matchesRegex(java.util.regex.Pattern pattern)
        +
        Creates a matcher that checks if the examined string matches a specified Pattern. + +
        + assertThat("abc", matchesRegex(Pattern.compile("ˆ[a-z]$"));
        + 
        +
        +
        Parameters:
        +
        pattern - the pattern to be used.
        +
        Returns:
        +
        The matcher.
        +
        +
      • +
      + + + +
        +
      • +

        matchesRegex

        +
        public static Matcher<java.lang.String> matchesRegex(java.lang.String regex)
        +
        Creates a matcher that checks if the examined string matches a specified regex. + +
        + assertThat("abc", matchesRegex("ˆ[a-z]+$"));
        + 
        +
        +
        Parameters:
        +
        regex - The regex to be used for the validation.
        +
        Returns:
        +
        The matcher.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/StringStartsWith.html b/docs/javadoc/2.1/org/hamcrest/core/StringStartsWith.html new file mode 100644 index 00000000..fd0207c5 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/StringStartsWith.html @@ -0,0 +1,385 @@ + + + + + +StringStartsWith (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class StringStartsWith

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class StringStartsWith
    +extends SubstringMatcher
    +
    Tests if the argument is a string that starts with a specific substring.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringStartsWith

        +
        public StringStartsWith(boolean ignoringCase,
        +                        java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + +
        +
      • +

        startsWith

        +
        public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String. +

        + For example: +
        assertThat("myStringOfNote", startsWith("my"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      + + + +
        +
      • +

        startsWithIgnoringCase

        +
        public static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)
        +

        + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case +

        + For example: +
        assertThat("myStringOfNote", startsWithIgnoringCase("My"))
        +
        +
        Parameters:
        +
        prefix - the substring that the returned matcher will expect at the start of any examined string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/SubstringMatcher.html b/docs/javadoc/2.1/org/hamcrest/core/SubstringMatcher.html new file mode 100644 index 00000000..022ca4cd --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/SubstringMatcher.html @@ -0,0 +1,425 @@ + + + + + +SubstringMatcher (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.core
+

Class SubstringMatcher

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        substring

        +
        protected final java.lang.String substring
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SubstringMatcher

        +
        protected SubstringMatcher(java.lang.String relationship,
        +                           boolean ignoringCase,
        +                           java.lang.String substring)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        converted

        +
        protected java.lang.String converted(java.lang.String arg)
        +
      • +
      + + + +
        +
      • +

        evalSubstringOf

        +
        protected abstract boolean evalSubstringOf(java.lang.String string)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/package-frame.html b/docs/javadoc/2.1/org/hamcrest/core/package-frame.html new file mode 100644 index 00000000..10533720 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/package-frame.html @@ -0,0 +1,40 @@ + + + + + +org.hamcrest.core (Hamcrest 2.1 API) + + + + + +

org.hamcrest.core

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/package-summary.html b/docs/javadoc/2.1/org/hamcrest/core/package-summary.html new file mode 100644 index 00000000..0cecbd40 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/package-summary.html @@ -0,0 +1,259 @@ + + + + + +org.hamcrest.core (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.core

+
+
Fundamental matchers of objects and values, and composite matchers.
+
+

See: Description

+
+
+ + + + +

Package org.hamcrest.core Description

+

Fundamental matchers of objects and values, and composite matchers.

+
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/core/package-tree.html b/docs/javadoc/2.1/org/hamcrest/core/package-tree.html new file mode 100644 index 00000000..84b92375 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/core/package-tree.html @@ -0,0 +1,174 @@ + + + + + +org.hamcrest.core Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.core

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/ArrayIterator.html b/docs/javadoc/2.1/org/hamcrest/internal/ArrayIterator.html new file mode 100644 index 00000000..43839f5d --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/ArrayIterator.html @@ -0,0 +1,319 @@ + + + + + +ArrayIterator (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class ArrayIterator

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.ArrayIterator
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.util.Iterator<java.lang.Object>
    +
    +
    +
    +
    public class ArrayIterator
    +extends java.lang.Object
    +implements java.util.Iterator<java.lang.Object>
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ArrayIterator(java.lang.Object array) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanhasNext() 
      java.lang.Objectnext() 
      voidremove() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Iterator

        +forEachRemaining
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ArrayIterator

        +
        public ArrayIterator(java.lang.Object array)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        hasNext

        +
        public boolean hasNext()
        +
        +
        Specified by:
        +
        hasNext in interface java.util.Iterator<java.lang.Object>
        +
        +
      • +
      + + + +
        +
      • +

        next

        +
        public java.lang.Object next()
        +
        +
        Specified by:
        +
        next in interface java.util.Iterator<java.lang.Object>
        +
        +
      • +
      + + + +
        +
      • +

        remove

        +
        public void remove()
        +
        +
        Specified by:
        +
        remove in interface java.util.Iterator<java.lang.Object>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/NullSafety.html b/docs/javadoc/2.1/org/hamcrest/internal/NullSafety.html new file mode 100644 index 00000000..7a1bd85b --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/NullSafety.html @@ -0,0 +1,269 @@ + + + + + +NullSafety (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class NullSafety

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.NullSafety
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class NullSafety
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      NullSafety() 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <E> java.util.List<Matcher<? super E>>nullSafe(Matcher<? super E>[] itemMatchers) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        NullSafety

        +
        public NullSafety()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        nullSafe

        +
        public static <E> java.util.List<Matcher<? super E>> nullSafe(Matcher<? super E>[] itemMatchers)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/ReflectiveTypeFinder.html b/docs/javadoc/2.1/org/hamcrest/internal/ReflectiveTypeFinder.html new file mode 100644 index 00000000..edfc1bea --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/ReflectiveTypeFinder.html @@ -0,0 +1,273 @@ + + + + + +ReflectiveTypeFinder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class ReflectiveTypeFinder

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.ReflectiveTypeFinder
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class ReflectiveTypeFinder
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      ReflectiveTypeFinder(java.lang.String methodName, + int expectedNumberOfParameters, + int typedParameter) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      java.lang.Class<?>findExpectedType(java.lang.Class<?> fromClass) 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        ReflectiveTypeFinder

        +
        public ReflectiveTypeFinder(java.lang.String methodName,
        +                            int expectedNumberOfParameters,
        +                            int typedParameter)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        findExpectedType

        +
        public java.lang.Class<?> findExpectedType(java.lang.Class<?> fromClass)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/SelfDescribingValue.html b/docs/javadoc/2.1/org/hamcrest/internal/SelfDescribingValue.html new file mode 100644 index 00000000..0e54cc64 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/SelfDescribingValue.html @@ -0,0 +1,288 @@ + + + + + +SelfDescribingValue (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class SelfDescribingValue<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.SelfDescribingValue<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    SelfDescribing
    +
    +
    +
    +
    public class SelfDescribingValue<T>
    +extends java.lang.Object
    +implements SelfDescribing
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      SelfDescribingValue(T value) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        SelfDescribingValue

        +
        public SelfDescribingValue(T value)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Specified by:
        +
        describeTo in interface SelfDescribing
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/SelfDescribingValueIterator.html b/docs/javadoc/2.1/org/hamcrest/internal/SelfDescribingValueIterator.html new file mode 100644 index 00000000..597ebe2c --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/SelfDescribingValueIterator.html @@ -0,0 +1,319 @@ + + + + + +SelfDescribingValueIterator (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.internal
+

Class SelfDescribingValueIterator<T>

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.internal.SelfDescribingValueIterator<T>
    • +
    +
  • +
+
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.util.Iterator<SelfDescribing>
    +
    +
    +
    +
    public class SelfDescribingValueIterator<T>
    +extends java.lang.Object
    +implements java.util.Iterator<SelfDescribing>
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      booleanhasNext() 
      SelfDescribingnext() 
      voidremove() 
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
        +
      • + + +

        Methods inherited from interface java.util.Iterator

        +forEachRemaining
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        SelfDescribingValueIterator

        +
        public SelfDescribingValueIterator(java.util.Iterator<T> values)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        hasNext

        +
        public boolean hasNext()
        +
        +
        Specified by:
        +
        hasNext in interface java.util.Iterator<SelfDescribing>
        +
        +
      • +
      + + + + + + + +
        +
      • +

        remove

        +
        public void remove()
        +
        +
        Specified by:
        +
        remove in interface java.util.Iterator<SelfDescribing>
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/package-frame.html b/docs/javadoc/2.1/org/hamcrest/internal/package-frame.html new file mode 100644 index 00000000..19e4b4bf --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/package-frame.html @@ -0,0 +1,24 @@ + + + + + +org.hamcrest.internal (Hamcrest 2.1 API) + + + + + +

org.hamcrest.internal

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/package-summary.html b/docs/javadoc/2.1/org/hamcrest/internal/package-summary.html new file mode 100644 index 00000000..268b1d43 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/package-summary.html @@ -0,0 +1,156 @@ + + + + + +org.hamcrest.internal (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.internal

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/internal/package-tree.html b/docs/javadoc/2.1/org/hamcrest/internal/package-tree.html new file mode 100644 index 00000000..00cedc32 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/internal/package-tree.html @@ -0,0 +1,139 @@ + + + + + +org.hamcrest.internal Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.internal

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/io/FileMatchers.FileStatus.html b/docs/javadoc/2.1/org/hamcrest/io/FileMatchers.FileStatus.html new file mode 100644 index 00000000..bb31eb70 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/io/FileMatchers.FileStatus.html @@ -0,0 +1,223 @@ + + + + + +FileMatchers.FileStatus (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.io
+

Interface FileMatchers.FileStatus

+
+
+
+
    +
  • +
    +
    Enclosing class:
    +
    FileMatchers
    +
    +
    +
    +
    public static interface FileMatchers.FileStatus
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        check

        +
        boolean check(java.io.File actual)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/io/FileMatchers.html b/docs/javadoc/2.1/org/hamcrest/io/FileMatchers.html new file mode 100644 index 00000000..71c7ba19 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/io/FileMatchers.html @@ -0,0 +1,493 @@ + + + + + +FileMatchers (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.io
+

Class FileMatchers

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.io.FileMatchers
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public final class FileMatchers
    +extends java.lang.Object
    +
  • +
+
+
+ +
+
+
    +
  • + + + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        FileMatchers

        +
        public FileMatchers()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        anExistingDirectory

        +
        public static Matcher<java.io.File> anExistingDirectory()
        +
      • +
      + + + +
        +
      • +

        anExistingFileOrDirectory

        +
        public static Matcher<java.io.File> anExistingFileOrDirectory()
        +
      • +
      + + + +
        +
      • +

        anExistingFile

        +
        public static Matcher<java.io.File> anExistingFile()
        +
      • +
      + + + +
        +
      • +

        aReadableFile

        +
        public static Matcher<java.io.File> aReadableFile()
        +
      • +
      + + + +
        +
      • +

        aWritableFile

        +
        public static Matcher<java.io.File> aWritableFile()
        +
      • +
      + + + +
        +
      • +

        aFileWithSize

        +
        public static Matcher<java.io.File> aFileWithSize(long size)
        +
      • +
      + + + +
        +
      • +

        aFileWithSize

        +
        public static Matcher<java.io.File> aFileWithSize(Matcher<java.lang.Long> expected)
        +
      • +
      + + + +
        +
      • +

        aFileNamed

        +
        public static Matcher<java.io.File> aFileNamed(Matcher<java.lang.String> expected)
        +
      • +
      + + + +
        +
      • +

        aFileWithCanonicalPath

        +
        public static Matcher<java.io.File> aFileWithCanonicalPath(Matcher<java.lang.String> expected)
        +
      • +
      + + + +
        +
      • +

        aFileWithAbsolutePath

        +
        public static Matcher<java.io.File> aFileWithAbsolutePath(Matcher<java.lang.String> expected)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/io/package-frame.html b/docs/javadoc/2.1/org/hamcrest/io/package-frame.html new file mode 100644 index 00000000..a2504313 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/io/package-frame.html @@ -0,0 +1,24 @@ + + + + + +org.hamcrest.io (Hamcrest 2.1 API) + + + + + +

org.hamcrest.io

+
+

Interfaces

+ +

Classes

+ +
+ + diff --git a/docs/javadoc/2.1/org/hamcrest/io/package-summary.html b/docs/javadoc/2.1/org/hamcrest/io/package-summary.html new file mode 100644 index 00000000..aff3ef38 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/io/package-summary.html @@ -0,0 +1,155 @@ + + + + + +org.hamcrest.io (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.io

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/io/package-tree.html b/docs/javadoc/2.1/org/hamcrest/io/package-tree.html new file mode 100644 index 00000000..c83081a6 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/io/package-tree.html @@ -0,0 +1,139 @@ + + + + + +org.hamcrest.io Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.io

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Interface Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/number/BigDecimalCloseTo.html b/docs/javadoc/2.1/org/hamcrest/number/BigDecimalCloseTo.html new file mode 100644 index 00000000..148fbca7 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/number/BigDecimalCloseTo.html @@ -0,0 +1,383 @@ + + + + + +BigDecimalCloseTo (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class BigDecimalCloseTo

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        BigDecimalCloseTo

        +
        public BigDecimalCloseTo(java.math.BigDecimal value,
        +                         java.math.BigDecimal error)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.math.BigDecimal item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.math.BigDecimal>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.math.BigDecimal item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.math.BigDecimal>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand,
        +                                                    java.math.BigDecimal error)
        +
        Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal + to the specified operand, within a range of +/- error. The comparison for equality + is done by BigDecimals BigDecimal.compareTo(java.math.BigDecimal) method. + For example: +
        assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
        +
        +
        Parameters:
        +
        operand - the expected value of matching BigDecimals
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/number/IsCloseTo.html b/docs/javadoc/2.1/org/hamcrest/number/IsCloseTo.html new file mode 100644 index 00000000..d7191406 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/number/IsCloseTo.html @@ -0,0 +1,384 @@ + + + + + +IsCloseTo (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class IsCloseTo

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Double>, SelfDescribing
    +
    +
    +
    +
    public class IsCloseTo
    +extends TypeSafeMatcher<java.lang.Double>
    +
    Is the value a number equal to a value within some range of + acceptable error?
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCloseTo

        +
        public IsCloseTo(double value,
        +                 double error)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Double item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Double item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        closeTo

        +
        public static Matcher<java.lang.Double> closeTo(double operand,
        +                                                double error)
        +
        Creates a matcher of Doubles that matches when an examined double is equal + to the specified operand, within a range of +/- error. + For example: +
        assertThat(1.03, is(closeTo(1.0, 0.03)))
        +
        +
        Parameters:
        +
        operand - the expected value of matching doubles
        +
        error - the delta (+/-) within which matches will be allowed
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/number/IsNaN.html b/docs/javadoc/2.1/org/hamcrest/number/IsNaN.html new file mode 100644 index 00000000..c564e379 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/number/IsNaN.html @@ -0,0 +1,338 @@ + + + + + +IsNaN (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class IsNaN

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.Double>, SelfDescribing
    +
    +
    +
    +
    public final class IsNaN
    +extends TypeSafeMatcher<java.lang.Double>
    +
    Is the value a number actually not a number (NaN)?
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Double item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Double item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Double>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        notANumber

        +
        public static Matcher<java.lang.Double> notANumber()
        +
        Creates a matcher of Doubles that matches when an examined double is not a number. + For example: +
        assertThat(Double.NaN, is(notANumber()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/number/OrderingComparison.html b/docs/javadoc/2.1/org/hamcrest/number/OrderingComparison.html new file mode 100644 index 00000000..b8077df2 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/number/OrderingComparison.html @@ -0,0 +1,366 @@ + + + + + +OrderingComparison (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.number
+

Class OrderingComparison

+
+
+
    +
  • java.lang.Object
  • +
  • +
      +
    • org.hamcrest.number.OrderingComparison
    • +
    +
  • +
+
+
    +
  • +
    +
    +
    public class OrderingComparison
    +extends java.lang.Object
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethod and Description
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      comparesEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      greaterThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThan(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object.
      +
      static <T extends java.lang.Comparable<T>>
      Matcher<T>
      lessThanOrEqualTo(T value) +
      Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        comparesEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + equal to the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, comparesEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(2, greaterThan(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        greaterThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + greater than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, greaterThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThan

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than the specified value, as reported by the compareTo method of the + examined object. + For example: +
        assertThat(1, lessThan(2))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
        +
        +
      • +
      + + + + + +
        +
      • +

        lessThanOrEqualTo

        +
        public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
        +
        Creates a matcher of Comparable object that matches when the examined object is + less than or equal to the specified value, as reported by the compareTo method + of the examined object. + For example: +
        assertThat(1, lessThanOrEqualTo(1))
        +
        +
        Parameters:
        +
        value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/number/package-frame.html b/docs/javadoc/2.1/org/hamcrest/number/package-frame.html new file mode 100644 index 00000000..a9a66340 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/number/package-frame.html @@ -0,0 +1,23 @@ + + + + + +org.hamcrest.number (Hamcrest 2.1 API) + + + + + +

org.hamcrest.number

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/number/package-summary.html b/docs/javadoc/2.1/org/hamcrest/number/package-summary.html new file mode 100644 index 00000000..48d8ca04 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/number/package-summary.html @@ -0,0 +1,166 @@ + + + + + +org.hamcrest.number (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.number

+
+
Matchers that perform numeric comparisons.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    BigDecimalCloseTo 
    IsCloseTo +
    Is the value a number equal to a value within some range of + acceptable error?
    +
    IsNaN +
    Is the value a number actually not a number (NaN)?
    +
    OrderingComparison 
    +
  • +
+ + + +

Package org.hamcrest.number Description

+

Matchers that perform numeric comparisons.

+
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/number/package-tree.html b/docs/javadoc/2.1/org/hamcrest/number/package-tree.html new file mode 100644 index 00000000..ef89e979 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/number/package-tree.html @@ -0,0 +1,146 @@ + + + + + +org.hamcrest.number Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.number

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/object/HasEqualValues.html b/docs/javadoc/2.1/org/hamcrest/object/HasEqualValues.html new file mode 100644 index 00000000..5d2f8931 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/object/HasEqualValues.html @@ -0,0 +1,335 @@ + + + + + +HasEqualValues (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.object
+

Class HasEqualValues<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + + + +
        +
      • +

        HasEqualValues

        +
        public HasEqualValues(T expectedObject)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + + + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/object/HasToString.html b/docs/javadoc/2.1/org/hamcrest/object/HasToString.html new file mode 100644 index 00000000..e51e5fa9 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/object/HasToString.html @@ -0,0 +1,371 @@ + + + + + +HasToString (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.object
+

Class HasToString<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasToString

        +
        public HasToString(Matcher<? super java.lang.String> toStringMatcher)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.String featureValueOf(T actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<T,java.lang.String>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher. + For example: +
        assertThat(true, hasToString(equalTo("TRUE")))
        +
        +
        Parameters:
        +
        toStringMatcher - the matcher used to verify the toString result
        +
        +
      • +
      + + + +
        +
      • +

        hasToString

        +
        public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
        +
        Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string. + For example: +
        assertThat(true, hasToString("TRUE"))
        +
        +
        Parameters:
        +
        expectedToString - the expected toString result
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/object/IsCompatibleType.html b/docs/javadoc/2.1/org/hamcrest/object/IsCompatibleType.html new file mode 100644 index 00000000..7ded8d84 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/object/IsCompatibleType.html @@ -0,0 +1,377 @@ + + + + + +IsCompatibleType (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.object
+

Class IsCompatibleType<T>

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsCompatibleType

        +
        public IsCompatibleType(java.lang.Class<T> type)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.Class<?> cls)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.Class<?>>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.Class<?> cls,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.Class<?>>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        typeCompatibleWith

        +
        public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
        +
        Creates a matcher of Class that matches when the specified baseType is + assignable from the examined class. + For example: +
        assertThat(Integer.class, typeCompatibleWith(Number.class))
        +
        +
        Parameters:
        +
        baseType - the base class to examine classes against
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/object/IsEventFrom.html b/docs/javadoc/2.1/org/hamcrest/object/IsEventFrom.html new file mode 100644 index 00000000..4e6b36d5 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/object/IsEventFrom.html @@ -0,0 +1,385 @@ + + + + + +IsEventFrom (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.object
+

Class IsEventFrom

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.util.EventObject>, SelfDescribing
    +
    +
    +
    +
    public class IsEventFrom
    +extends TypeSafeDiagnosingMatcher<java.util.EventObject>
    +
    Tests if the value is an event announced by a specific object.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEventFrom

        +
        public IsEventFrom(java.lang.Class<?> eventClass,
        +                   java.lang.Object source)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.util.EventObject item,
        +                             Description mismatchDescription)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<java.util.EventObject>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
        +                                                       java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any object + derived from eventClass announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
        +
        +
        Parameters:
        +
        eventClass - the class of the event to match on
        +
        source - the source of the event
        +
        +
      • +
      + + + +
        +
      • +

        eventFrom

        +
        public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
        +
        Creates a matcher of EventObject that matches any EventObject + announced by source. + For example: +
        assertThat(myEvent, is(eventFrom(myBean)))
        +
        +
        Parameters:
        +
        source - the source of the event
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/object/package-frame.html b/docs/javadoc/2.1/org/hamcrest/object/package-frame.html new file mode 100644 index 00000000..523ee94f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/object/package-frame.html @@ -0,0 +1,23 @@ + + + + + +org.hamcrest.object (Hamcrest 2.1 API) + + + + + +

org.hamcrest.object

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/object/package-summary.html b/docs/javadoc/2.1/org/hamcrest/object/package-summary.html new file mode 100644 index 00000000..af28ff1a --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/object/package-summary.html @@ -0,0 +1,163 @@ + + + + + +org.hamcrest.object (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.object

+
+
Matchers that inspect objects and classes.
+
+

See: Description

+
+
+ + + + +

Package org.hamcrest.object Description

+

Matchers that inspect objects and classes.

+
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/object/package-tree.html b/docs/javadoc/2.1/org/hamcrest/object/package-tree.html new file mode 100644 index 00000000..6eb55665 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/object/package-tree.html @@ -0,0 +1,154 @@ + + + + + +org.hamcrest.object Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.object

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/package-frame.html b/docs/javadoc/2.1/org/hamcrest/package-frame.html new file mode 100644 index 00000000..9dd2400f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/package-frame.html @@ -0,0 +1,40 @@ + + + + + +org.hamcrest (Hamcrest 2.1 API) + + + + + +

org.hamcrest

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/package-summary.html b/docs/javadoc/2.1/org/hamcrest/package-summary.html new file mode 100644 index 00000000..e530297c --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/package-summary.html @@ -0,0 +1,247 @@ + + + + + +org.hamcrest (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest

+
+
+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/package-tree.html b/docs/javadoc/2.1/org/hamcrest/package-tree.html new file mode 100644 index 00000000..f79b22a0 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/package-tree.html @@ -0,0 +1,170 @@ + + + + + +org.hamcrest Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +

Interface Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/CharSequenceLength.html b/docs/javadoc/2.1/org/hamcrest/text/CharSequenceLength.html new file mode 100644 index 00000000..32731cea --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/CharSequenceLength.html @@ -0,0 +1,377 @@ + + + + + +CharSequenceLength (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class CharSequenceLength

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.CharSequence>, SelfDescribing
    +
    +
    +
    +
    public class CharSequenceLength
    +extends FeatureMatcher<java.lang.CharSequence,java.lang.Integer>
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        CharSequenceLength

        +
        public CharSequenceLength(Matcher<? super java.lang.Integer> lengthMatcher)
        +
        +
        Parameters:
        +
        lengthMatcher - The matcher to apply to the feature
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        featureValueOf

        +
        protected java.lang.Integer featureValueOf(java.lang.CharSequence actual)
        +
        Description copied from class: FeatureMatcher
        +
        Implement this to extract the interesting feature.
        +
        +
        Specified by:
        +
        featureValueOf in class FeatureMatcher<java.lang.CharSequence,java.lang.Integer>
        +
        Parameters:
        +
        actual - the target object
        +
        Returns:
        +
        the feature to be matched
        +
        +
      • +
      + + + +
        +
      • +

        hasLength

        +
        public static Matcher<java.lang.CharSequence> hasLength(int length)
        +
        Creates a matcher of CharSequence that matches when a char sequence has the given length + For example: + +
        + assertThat("text", hasLength(4))
        + 
        +
        +
        Parameters:
        +
        length - the expected length of the string
        +
        +
      • +
      + + + +
        +
      • +

        hasLength

        +
        public static Matcher<java.lang.CharSequence> hasLength(Matcher<? super java.lang.Integer> lengthMatcher)
        +
        Creates a matcher of CharSequence that matches when a char sequence has the given length + For example: + +
        + assertThat("text", hasLength(lessThan(4)))
        + 
        +
        +
        Parameters:
        +
        lengthMatcher - the expected length of the string
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/IsBlankString.html b/docs/javadoc/2.1/org/hamcrest/text/IsBlankString.html new file mode 100644 index 00000000..216197bc --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/IsBlankString.html @@ -0,0 +1,336 @@ + + + + + +IsBlankString (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsBlankString

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public final class IsBlankString
    +extends TypeSafeMatcher<java.lang.String>
    +
    Matches blank Strings (and null).
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        blankString

        +
        public static Matcher<java.lang.String> blankString()
        +
        Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else. + For example: +
        assertThat("  ", is(blankString()))
        +
      • +
      + + + +
        +
      • +

        blankOrNullString

        +
        public static Matcher<java.lang.String> blankOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + contains zero or more whitespace characters and nothing else. + For example: +
        assertThat(((String)null), is(blankOrNullString()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/IsEmptyString.html b/docs/javadoc/2.1/org/hamcrest/text/IsEmptyString.html new file mode 100644 index 00000000..d809bd49 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/IsEmptyString.html @@ -0,0 +1,379 @@ + + + + + +IsEmptyString (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsEmptyString

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public final class IsEmptyString
    +extends TypeSafeMatcher<java.lang.String>
    +
    Matches empty Strings (and null).
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        isEmptyString

        +
        @Deprecated
        +public static Matcher<java.lang.String> isEmptyString()
        +
        Deprecated. use is(emptyString()) instead
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", isEmptyString())
        +
      • +
      + + + +
        +
      • +

        emptyString

        +
        public static Matcher<java.lang.String> emptyString()
        +
        Creates a matcher of String that matches when the examined string has zero length. + For example: +
        assertThat("", is(emptyString()))
        +
      • +
      + + + +
        +
      • +

        isEmptyOrNullString

        +
        @Deprecated
        +public static Matcher<java.lang.String> isEmptyOrNullString()
        +
        Deprecated. use is(emptyOrNullString()) instead
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), isEmptyOrNullString())
        +
      • +
      + + + +
        +
      • +

        emptyOrNullString

        +
        public static Matcher<java.lang.String> emptyOrNullString()
        +
        Creates a matcher of String that matches when the examined string is null, or + has zero length. + For example: +
        assertThat(((String)null), is(emptyOrNullString()))
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/IsEqualCompressingWhiteSpace.html b/docs/javadoc/2.1/org/hamcrest/text/IsEqualCompressingWhiteSpace.html new file mode 100644 index 00000000..af17d82f --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/IsEqualCompressingWhiteSpace.html @@ -0,0 +1,418 @@ + + + + + +IsEqualCompressingWhiteSpace (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsEqualCompressingWhiteSpace

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class IsEqualCompressingWhiteSpace
    +extends TypeSafeMatcher<java.lang.String>
    +
    Tests if a string is equal to another string, compressing any changes in whitespace.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEqualCompressingWhiteSpace

        +
        public IsEqualCompressingWhiteSpace(java.lang.String string)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        stripSpaces

        +
        public java.lang.String stripSpaces(java.lang.String toBeStripped)
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringWhiteSpace

        +
        public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
        + +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      + + + +
        +
      • +

        equalToCompressingWhiteSpace

        +
        public static Matcher<java.lang.String> equalToCompressingWhiteSpace(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, when whitespace differences are (mostly) ignored. To be + exact, the following whitespace rules are applied: +
          +
        • all leading and trailing whitespace of both the expectedString and the examined string are ignored
        • +
        • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
        • +
        + For example: +
        assertThat("   my\tfoo  bar ", equalToCompressingWhiteSpace(" my  foo bar"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/IsEqualIgnoringCase.html b/docs/javadoc/2.1/org/hamcrest/text/IsEqualIgnoringCase.html new file mode 100644 index 00000000..89fcb922 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/IsEqualIgnoringCase.html @@ -0,0 +1,378 @@ + + + + + +IsEqualIgnoringCase (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class IsEqualIgnoringCase

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<java.lang.String>, SelfDescribing
    +
    +
    +
    +
    public class IsEqualIgnoringCase
    +extends TypeSafeMatcher<java.lang.String>
    +
    Tests if a string is equal to another string, regardless of the case.
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        IsEqualIgnoringCase

        +
        public IsEqualIgnoringCase(java.lang.String string)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        equalToIgnoringCase

        +
        public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)
        +
        Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case. + For example: +
        assertThat("Foo", equalToIgnoringCase("FOO"))
        +
        +
        Parameters:
        +
        expectedString - the expected value of matched strings
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/MatchesPattern.html b/docs/javadoc/2.1/org/hamcrest/text/MatchesPattern.html new file mode 100644 index 00000000..783163fe --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/MatchesPattern.html @@ -0,0 +1,365 @@ + + + + + +MatchesPattern (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class MatchesPattern

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        MatchesPattern

        +
        public MatchesPattern(java.util.regex.Pattern pattern)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        protected boolean matchesSafely(java.lang.String item)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
        +
      • +
      + + + +
        +
      • +

        matchesPattern

        +
        public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)
        +
        Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/StringContainsInOrder.html b/docs/javadoc/2.1/org/hamcrest/text/StringContainsInOrder.html new file mode 100644 index 00000000..af1d298e --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/StringContainsInOrder.html @@ -0,0 +1,403 @@ + + + + + +StringContainsInOrder (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.text
+

Class StringContainsInOrder

+
+
+ +
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        StringContainsInOrder

        +
        public StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(java.lang.String s)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should implement this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeMismatchSafely

        +
        public void describeMismatchSafely(java.lang.String item,
        +                                   Description mismatchDescription)
        +
        Description copied from class: TypeSafeMatcher
        +
        Subclasses should override this. The item will already have been checked for + the specific type and will never be null.
        +
        +
        Overrides:
        +
        describeMismatchSafely in class TypeSafeMatcher<java.lang.String>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      + + + +
        +
      • +

        stringContainsInOrder

        +
        public static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)
        +
        Creates a matcher of String that matches when the examined string contains all of + the specified substrings, considering the order of their appearance. + For example: +
        assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
        + fails as "foo" occurs before "bar" in the string "myfoobarbaz"
        +
        +
        Parameters:
        +
        substrings - the substrings that must be contained within matching strings
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/package-frame.html b/docs/javadoc/2.1/org/hamcrest/text/package-frame.html new file mode 100644 index 00000000..e31627a3 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/package-frame.html @@ -0,0 +1,26 @@ + + + + + +org.hamcrest.text (Hamcrest 2.1 API) + + + + + +

org.hamcrest.text

+ + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/package-summary.html b/docs/javadoc/2.1/org/hamcrest/text/package-summary.html new file mode 100644 index 00000000..9e7ebbda --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/package-summary.html @@ -0,0 +1,181 @@ + + + + + +org.hamcrest.text (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.text

+
+
Matchers that perform text comparisons.
+
+

See: Description

+
+
+ + + + +

Package org.hamcrest.text Description

+

Matchers that perform text comparisons.

+
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/text/package-tree.html b/docs/javadoc/2.1/org/hamcrest/text/package-tree.html new file mode 100644 index 00000000..8b6ef8b1 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/text/package-tree.html @@ -0,0 +1,157 @@ + + + + + +org.hamcrest.text Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.text

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/xml/HasXPath.html b/docs/javadoc/2.1/org/hamcrest/xml/HasXPath.html new file mode 100644 index 00000000..4897d416 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/xml/HasXPath.html @@ -0,0 +1,509 @@ + + + + + +HasXPath (Hamcrest 2.1 API) + + + + + + + + + + + + +
+
org.hamcrest.xml
+

Class HasXPath

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    Matcher<org.w3c.dom.Node>, SelfDescribing
    +
    +
    +
    +
    public class HasXPath
    +extends TypeSafeDiagnosingMatcher<org.w3c.dom.Node>
    +
    Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static javax.xml.namespace.NamespaceContextNO_NAMESPACE_CONTEXT 
      +
    • +
    + +
      +
    • + + +

      Constructor Summary

      + + + + + + + + + + + +
      Constructors 
      Constructor and Description
      HasXPath(java.lang.String xPathExpression, + Matcher<java.lang.String> valueMatcher) 
      HasXPath(java.lang.String xPathExpression, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) 
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voiddescribeTo(Description description) +
      Generates a description of the object.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext) +
      Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content.
      +
      static Matcher<org.w3c.dom.Node>hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher) +
      Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher.
      +
      booleanmatchesSafely(org.w3c.dom.Node item, + Description mismatch) +
      Subclasses should implement this.
      +
      + + +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        NO_NAMESPACE_CONTEXT

        +
        public static final javax.xml.namespace.NamespaceContext NO_NAMESPACE_CONTEXT
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HasXPath

        +
        public HasXPath(java.lang.String xPathExpression,
        +                Matcher<java.lang.String> valueMatcher)
        +
        +
        Parameters:
        +
        xPathExpression - XPath expression.
        +
        valueMatcher - Matcher to use at given XPath. + May be null to specify that the XPath must exist but the value is irrelevant.
        +
        +
      • +
      + + + +
        +
      • +

        HasXPath

        +
        public HasXPath(java.lang.String xPathExpression,
        +                javax.xml.namespace.NamespaceContext namespaceContext,
        +                Matcher<java.lang.String> valueMatcher)
        +
        +
        Parameters:
        +
        xPathExpression - XPath expression.
        +
        namespaceContext - Resolves XML namespace prefixes in the XPath expression
        +
        valueMatcher - Matcher to use at given XPath. + May be null to specify that the XPath must exist but the value is irrelevant.
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        matchesSafely

        +
        public boolean matchesSafely(org.w3c.dom.Node item,
        +                             Description mismatch)
        +
        Description copied from class: TypeSafeDiagnosingMatcher
        +
        Subclasses should implement this. The item will already have been checked + for the specific type and will never be null.
        +
        +
        Specified by:
        +
        matchesSafely in class TypeSafeDiagnosingMatcher<org.w3c.dom.Node>
        +
        +
      • +
      + + + +
        +
      • +

        describeTo

        +
        public void describeTo(Description description)
        +
        Description copied from interface: SelfDescribing
        +
        Generates a description of the object. The description may be part of a + a description of a larger object of which this is just a component, so it + should be worded appropriately.
        +
        +
        Parameters:
        +
        description - The description to be built or appended to.
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath that satisfies the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext,
        +                                                 Matcher<java.lang.String> valueMatcher)
        +
        Creates a matcher of Nodes that matches when the examined node has a value at the + specified xPath, within the specified namespaceContext, that satisfies + the specified valueMatcher. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        valueMatcher - matcher for the value at the specified xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese"))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        +
      • +
      + + + +
        +
      • +

        hasXPath

        +
        public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
        +                                                 javax.xml.namespace.NamespaceContext namespaceContext)
        +
        Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath within the specified namespace context, with any content. + For example: +
        assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
        +
        +
        Parameters:
        +
        xPath - the target xpath
        +
        namespaceContext - the namespace for matching nodes
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/xml/package-frame.html b/docs/javadoc/2.1/org/hamcrest/xml/package-frame.html new file mode 100644 index 00000000..d558d8ae --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/xml/package-frame.html @@ -0,0 +1,20 @@ + + + + + +org.hamcrest.xml (Hamcrest 2.1 API) + + + + + +

org.hamcrest.xml

+
+

Classes

+ +
+ + diff --git a/docs/javadoc/2.1/org/hamcrest/xml/package-summary.html b/docs/javadoc/2.1/org/hamcrest/xml/package-summary.html new file mode 100644 index 00000000..a68fd9d6 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/xml/package-summary.html @@ -0,0 +1,151 @@ + + + + + +org.hamcrest.xml (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Package org.hamcrest.xml

+
+
Matchers of XML documents.
+
+

See: Description

+
+
+
    +
  • + + + + + + + + + + + + +
    Class Summary 
    ClassDescription
    HasXPath +
    Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
    +
    +
  • +
+ + + +

Package org.hamcrest.xml Description

+

Matchers of XML documents.

+
+ + + + + + diff --git a/docs/javadoc/2.1/org/hamcrest/xml/package-tree.html b/docs/javadoc/2.1/org/hamcrest/xml/package-tree.html new file mode 100644 index 00000000..f0eba081 --- /dev/null +++ b/docs/javadoc/2.1/org/hamcrest/xml/package-tree.html @@ -0,0 +1,143 @@ + + + + + +org.hamcrest.xml Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + + + + +
+

Hierarchy For Package org.hamcrest.xml

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+ + + + + + diff --git a/docs/javadoc/2.1/overview-frame.html b/docs/javadoc/2.1/overview-frame.html new file mode 100644 index 00000000..9cbe8e61 --- /dev/null +++ b/docs/javadoc/2.1/overview-frame.html @@ -0,0 +1,31 @@ + + + + + +Overview List (Hamcrest 2.1 API) + + + + + + + +

 

+ + diff --git a/docs/javadoc/2.1/overview-summary.html b/docs/javadoc/2.1/overview-summary.html new file mode 100644 index 00000000..ce4b1d80 --- /dev/null +++ b/docs/javadoc/2.1/overview-summary.html @@ -0,0 +1,190 @@ + + + + + +Overview (Hamcrest 2.1 API) + + + + + + + + +
+ + + + + + + +
+ + +
+

Hamcrest 2.1 API

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Packages 
PackageDescription
org.hamcrest 
org.hamcrest.beans +
Matchers of Java Bean properties and their values.
+
org.hamcrest.collection +
Matchers of arrays and collections.
+
org.hamcrest.comparator 
org.hamcrest.core +
Fundamental matchers of objects and values, and composite matchers.
+
org.hamcrest.internal 
org.hamcrest.io 
org.hamcrest.number +
Matchers that perform numeric comparisons.
+
org.hamcrest.object +
Matchers that inspect objects and classes.
+
org.hamcrest.text +
Matchers that perform text comparisons.
+
org.hamcrest.xml +
Matchers of XML documents.
+
+
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.1/overview-tree.html b/docs/javadoc/2.1/overview-tree.html new file mode 100644 index 00000000..04614203 --- /dev/null +++ b/docs/javadoc/2.1/overview-tree.html @@ -0,0 +1,255 @@ + + + + + +Class Hierarchy (Hamcrest 2.1 API) + + + + + + + + +
+ + + + + + + +
+ + + +
+

Class Hierarchy

+ +

Interface Hierarchy

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/docs/javadoc/2.1/package-list b/docs/javadoc/2.1/package-list new file mode 100644 index 00000000..37d7af53 --- /dev/null +++ b/docs/javadoc/2.1/package-list @@ -0,0 +1,11 @@ +org.hamcrest +org.hamcrest.beans +org.hamcrest.collection +org.hamcrest.comparator +org.hamcrest.core +org.hamcrest.internal +org.hamcrest.io +org.hamcrest.number +org.hamcrest.object +org.hamcrest.text +org.hamcrest.xml diff --git a/docs/javadoc/2.1/script.js b/docs/javadoc/2.1/script.js new file mode 100644 index 00000000..b3463569 --- /dev/null +++ b/docs/javadoc/2.1/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/docs/javadoc/2.1/stylesheet.css b/docs/javadoc/2.1/stylesheet.css new file mode 100644 index 00000000..98055b22 --- /dev/null +++ b/docs/javadoc/2.1/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/docs/javadoc/index.html b/docs/javadoc/index.html new file mode 100644 index 00000000..51bac4d0 --- /dev/null +++ b/docs/javadoc/index.html @@ -0,0 +1,88 @@ + + + + + + + + + + Java Hamcrest + + + + +
+

Java Hamcrest

+

Matchers that can be combined to create flexible expressions of intent

+

API Reference Documentation (JavaDoc)

+

Lastest Version

+ +

Previous Versions

+ + +
+ Fork me on GitHub + + + diff --git a/docs/related.md b/docs/related.md new file mode 100644 index 00000000..c1437801 --- /dev/null +++ b/docs/related.md @@ -0,0 +1,30 @@ +--- +title: Hamcrest Related Projects +layout: default +--- +[Java Hamcrest Home](index) + +# Related Projects + +Here are some projects that provide additional features and matchers + +* [Awaitility](https://github.com/jayway/awaitility) (a DSL that allows you to express expectations of an asynchronous system in a concise and easy to read manner) +* [EZ Testing](https://github.com/EZGames/ez-testing) (contains base classes for defining chainable matchers that have a similar style to AssertJ) +* [Hamcrest 1.3 Utility Matchers](https://github.com/NitorCreations/matchers) (Java matchers like CollectionMatchers, MapMatchers, FieldMatcher, SerializableMatcher etc) +* [Hamcrest avro](https://github.com/Byhiras/avro-utils) +* [Hamcrest Composites](https://github.com/Cornutum/hamcrest-composites) (for comparing complex Java objects with better testability) +* [Hamcrest Date](https://github.com/modularit/hamcrest-date) (for comparing dates) +* [Hamcrest HAR](https://github.com/roydekleijn/har-assert) (for HTTP archive files) +* [Hamcrest Java Extras](https://github.com/sf105/hamcrest-java-extras) (currently only a couple of Json matchers) +* [Hamcrest JSON](https://github.com/hertzsprung/hamcrest-json) (for comparing entire JSON documents) +* [Hamcrest Path](https://github.com/seinesoftware/hamcrest-path) (for testing path existence and permissions) +* [Hamcrest Querydsl](https://github.com/beloglazov/hamcrest-querydsl) (for checking query results: hasResultSize, hasColumnRange, hasColumnMax, hasColumnMin, hasColumnContainingAll, hasColumnContainingAny) +* [Hamcrest Text Patterns](http://code.google.com/p/hamcrest-text-patterns/) +* [hamcrest-pojo-matcher-generator](https://github.com/yandex-qatools/hamcrest-pojo-matcher-generator) (Annotation processor to generate feature-matchers based on your POJOs) +* [http-matchers](https://github.com/valid4j/http-matchers) (Matchers to test your web service via the standard Java API for RESTful Services (JAX-RS)) +* [json-path-matchers](https://github.com/jayway/JsonPath/tree/master/json-path-assert) (for evaluating JSON path expressions) +* [JsonUnit](https://github.com/lukas-krecan/JsonUnit) (for comparing JSON structures jsonEquals, jsonPartEquals) +* [Proboscis](https://github.com/sf105/proboscis) (a tiny java library for polling for a result, originally intended for tested asynchronous systems) +* [Shazamcrest](https://github.com/shazam/shazamcrest) (Matchers for beans with custom field matching and nice failure messages) +* [Spotify's hamcrest matchers](https://github.com/spotify/java-hamcrest) (Matchers for POJOs, JSON, and some of the types introduced in Java 8) +* [valid4j](https://github.com/valid4j/valid4j) (assertion and validation library, i.e supporting design-by-contract style and/or recoverable input validation) diff --git a/docs/tutorial.md b/docs/tutorial.md new file mode 100644 index 00000000..f9e956c9 --- /dev/null +++ b/docs/tutorial.md @@ -0,0 +1,175 @@ +--- +title: Hamcrest Tutorial +layout: default +--- +[Java Hamcrest Home](index) + +# Hamcrest Tutorial + +## Introduction +Hamcrest is a framework for writing matcher objects allowing 'match' rules to be defined declaratively. There are a number of situations where matchers are invaluble, such as UI validation, or data filtering, but it is in the area of writing flexible tests that matchers are most commonly used. This tutorial shows you how to use Hamcrest for unit testing. + +When writing tests it is sometimes difficult to get the balance right between overspecifying the test (and making it brittle to changes), and not specifying enough (making the test less valuable since it continues to pass even when the thing being tested is broken). Having a tool that allows you to pick out precisely the aspect under test and describe the values it should have, to a controlled level of precision, helps greatly in writing tests that are "just right". Such tests fail when the behaviour of the aspect under test deviates from the expected behaviour, yet continue to pass when minor, unrelated changes to the behaviour are made. + +### My first Hamcrest test +We'll start by writing a very simple JUnit 5 test, but instead of using JUnit's `assertEquals` methods, we use Hamcrest's `assertThat` construct and the standard set of matchers, both of which we statically import: + +```java +import org.junit.jupiter.api.Test; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; + +public class BiscuitTest { + @Test + public void testEquals() { + Biscuit theBiscuit = new Biscuit("Ginger"); + Biscuit myBiscuit = new Biscuit("Ginger"); + assertThat(theBiscuit, equalTo(myBiscuit)); + } +} +``` + +The `assertThat` method is a stylized sentence for making a test assertion. In this example, the subject of the assertion is the object biscuit that is the first method parameter. The second method parameter is a matcher for Biscuit objects, here a matcher that checks one object is equal to another using the Object equals method. The test passes since the Biscuit class defines an equals method. + +If you have more than one assertion in your test you can include an identifier for the tested value in the assertion: + +```java +assertThat("chocolate chips", theBiscuit.getChocolateChipCount(), equalTo(10)); + +assertThat("hazelnuts", theBiscuit.getHazelnutCount(), equalTo(3)); +``` + +### Other test frameworks +Hamcrest has been designed from the outset to integrate with different unit testing frameworks. For example, Hamcrest can be used with JUnit (all versions) and TestNG. (For details have a look at the examples that come with the full Hamcrest distribution.) It is easy enough to migrate to using Hamcrest-style assertions in an existing test suite, since other assertion styles can co-exist with Hamcrest's. + +Hamcrest can also be used with mock objects frameworks by using adaptors to bridge from the mock objects framework's concept of a matcher to a Hamcrest matcher. For example, JMock 1's constraints are Hamcrest's matchers. Hamcrest provides a JMock 1 adaptor to allow you to use Hamcrest matchers in your JMock 1 tests. JMock 2 doesn't need such an adaptor layer since it is designed to use Hamcrest as its matching library. Hamcrest also provides adaptors for EasyMock 2. Again, see the Hamcrest examples for more details. + +### A tour of common matchers +Hamcrest comes with a library of useful matchers. Here are some of the most important ones. + +#### Core +`anything` - always matches, useful if you don't care what the object under test is + +`describedAs` - decorator to adding custom failure description + +`is` - decorator to improve readability - see "Sugar", below + +#### Logical +`allOf` - matches if all matchers match, short circuits (like Java &&) + +`anyOf` - matches if any matchers match, short circuits (like Java \|\|) + +`not` - matches if the wrapped matcher doesn't match and vice versa + +#### Object +`equalTo` - test object equality using Object.equals + +`hasToString` - test Object.toString + +`instanceOf`, `isCompatibleType` - test type + +`notNullValue`, `nullValue` - test for null + +`sameInstance` - test object identity + +#### Beans +`hasProperty` - test JavaBeans properties + +#### Collections +`array` - test an array's elements against an array of matchers + +`hasEntry`, `hasKey`, `hasValue` - test a map contains an entry, key or value + +`hasItem`, `hasItems` - test a collection contains elements + +`hasItemInArray` - test an array contains an element + +#### Number +`closeTo` - test floating point values are close to a given value + +`greaterThan`, `greaterThanOrEqualTo`, `lessThan`, `lessThanOrEqualTo` - test ordering + +#### Text +`equalToIgnoringCase` - test string equality ignoring case + +`equalToIgnoringWhiteSpace` - test string equality ignoring differences in runs of whitespace + +`containsString`, `endsWith`, `startsWith` - test string matching + +#### Sugar +Hamcrest strives to make your tests as readable as possible. For example, the is matcher is a wrapper that doesn't add any extra behavior to the underlying matcher. The following assertions are all equivalent: + +```java +assertThat(theBiscuit, equalTo(myBiscuit)); +assertThat(theBiscuit, is(equalTo(myBiscuit))); +assertThat(theBiscuit, is(myBiscuit)); +``` + +The last form is allowed since is(T value) is overloaded to return `is(equalTo(value))`. + +### Writing custom matchers +Hamcrest comes bundled with lots of useful matchers, but you'll probably find that you need to create your own from time to time to fit your testing needs. This commonly occurs when you find a fragment of code that tests the same set of properties over and over again (and in different tests), and you want to bundle the fragment into a single assertion. By writing your own matcher you'll eliminate code duplication and make your tests more readable! + +Let's write our own matcher for testing if a double value has the value NaN (not a number). This is the test we want to write: + +```java +@Test +public void testSquareRootOfMinusOneIsNotANumber() { + assertThat(Math.sqrt(-1), is(notANumber())); +} +``` + +And here's the implementation: + +```java +package org.hamcrest.examples.tutorial; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +public class IsNotANumber extends TypeSafeMatcher { + + @Override + public boolean matchesSafely(Double number) { + return number.isNaN(); + } + + public void describeTo(Description description) { + description.appendText("not a number"); + } + + public static Matcher notANumber() { + return new IsNotANumber(); + } + +} +``` + +The `assertThat` method is a generic method which takes a Matcher parameterized by the type of the subject of the assertion. We are asserting things about Double values, so we know that we need a `Matcher`. For our Matcher implementation it is most convenient to subclass `TypeSafeMatcher`, which does the cast to a Double for us. We need only implement the `matchesSafely` method - which simply checks to see if the Double is NaN - and the `describeTo` method - which is used to produce a failure message when a test fails. Here's an example of how the failure message looks: + +```java +assertThat(1.0, is(notANumber())); + +// fails with the message + +java.lang.AssertionError: Expected: is not a number got : <1.0> + +``` +The third method in our matcher is a convenience factory method. We statically import this method to use the matcher in our test: + +```java +import org.junit.jupiter.api.Test; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.examples.tutorial.IsNotANumber.notANumber; + +public class NumberTest { + @Test + public void testSquareRootOfMinusOneIsNotANumber() { + assertThat(Math.sqrt(-1), is(notANumber())); + } +} +``` + +Even though the `notANumber` method creates a new matcher each time it is called, you should not assume this is the only usage pattern for your matcher. Therefore you should make sure your matcher is stateless, so a single instance can be reused between matches. diff --git a/googlecode_upload.py b/googlecode_upload.py deleted file mode 100755 index 1cd142cf..00000000 --- a/googlecode_upload.py +++ /dev/null @@ -1,247 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006, 2007 Google Inc. All Rights Reserved. -# Author: danderson@google.com (David Anderson) -# -# Script for uploading files to a Google Code project. -# -# This is intended to be both a useful script for people who want to -# streamline project uploads and a reference implementation for -# uploading files to Google Code projects. -# -# To upload a file to Google Code, you need to provide a path to the -# file on your local machine, a small summary of what the file is, a -# project name, and a valid account that is a member or owner of that -# project. You can optionally provide a list of labels that apply to -# the file. The file will be uploaded under the same name that it has -# in your local filesystem (that is, the "basename" or last path -# component). Run the script with '--help' to get the exact syntax -# and available options. -# -# Note that the upload script requests that you enter your -# googlecode.com password. This is NOT your Gmail account password! -# This is the password you use on googlecode.com for committing to -# Subversion and uploading files. You can find your password by going -# to http://code.google.com/hosting/settings when logged in with your -# Gmail account. If you have already committed to your project's -# Subversion repository, the script will automatically retrieve your -# credentials from there (unless disabled, see the output of '--help' -# for details). -# -# If you are looking at this script as a reference for implementing -# your own Google Code file uploader, then you should take a look at -# the upload() function, which is the meat of the uploader. You -# basically need to build a multipart/form-data POST request with the -# right fields and send it to https://PROJECT.googlecode.com/files . -# Authenticate the request using HTTP Basic authentication, as is -# shown below. -# -# Licensed under the terms of the Apache Software License 2.0: -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Questions, comments, feature requests and patches are most welcome. -# Please direct all of these to the Google Code users group: -# http://groups.google.com/group/google-code-hosting - -"""Google Code file uploader script. -""" - -__author__ = 'danderson@google.com (David Anderson)' - -import httplib -import os.path -import optparse -import getpass -import base64 -import sys - - -def upload(file, project_name, user_name, password, summary, labels=None): - """Upload a file to a Google Code project's file server. - - Args: - file: The local path to the file. - project_name: The name of your project on Google Code. - user_name: Your Google account name. - password: The googlecode.com password for your account. - Note that this is NOT your global Google Account password! - summary: A small description for the file. - labels: an optional list of label strings with which to tag the file. - - Returns: a tuple: - http_status: 201 if the upload succeeded, something else if an - error occured. - http_reason: The human-readable string associated with http_status - file_url: If the upload succeeded, the URL of the file on Google - Code, None otherwise. - """ - # The login is the user part of user@gmail.com. If the login provided - # is in the full user@domain form, strip it down. - if user_name.endswith('@gmail.com'): - user_name = user_name[:user_name.index('@gmail.com')] - - form_fields = [('summary', summary)] - if labels is not None: - form_fields.extend([('label', l.strip()) for l in labels]) - - content_type, body = encode_upload_request(form_fields, file) - - upload_host = '%s.googlecode.com' % project_name - upload_uri = '/files' - auth_token = base64.b64encode('%s:%s'% (user_name, password)) - headers = { - 'Authorization': 'Basic %s' % auth_token, - 'User-Agent': 'Googlecode.com uploader v0.9.4', - 'Content-Type': content_type, - } - - server = httplib.HTTPSConnection(upload_host) - server.request('POST', upload_uri, body, headers) - resp = server.getresponse() - server.close() - - if resp.status == 201: - location = resp.getheader('Location', None) - else: - location = None - return resp.status, resp.reason, location - - -def encode_upload_request(fields, file_path): - """Encode the given fields and file into a multipart form body. - - fields is a sequence of (name, value) pairs. file is the path of - the file to upload. The file will be uploaded to Google Code with - the same file name. - - Returns: (content_type, body) ready for httplib.HTTP instance - """ - BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla' - CRLF = '\r\n' - - body = [] - - # Add the metadata about the upload first - for key, value in fields: - body.extend( - ['--' + BOUNDARY, - 'Content-Disposition: form-data; name="%s"' % key, - '', - value, - ]) - - # Now add the file itself - file_name = os.path.basename(file_path) - f = open(file_path, 'rb') - file_content = f.read() - f.close() - - body.extend( - ['--' + BOUNDARY, - 'Content-Disposition: form-data; name="filename"; filename="%s"' - % file_name, - # The upload server determines the mime-type, no need to set it. - 'Content-Type: application/octet-stream', - '', - file_content, - ]) - - # Finalize the form body - body.extend(['--' + BOUNDARY + '--', '']) - - return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body) - - -def upload_find_auth(file_path, project_name, summary, labels=None, - user_name=None, password=None, tries=3): - """Find credentials and upload a file to a Google Code project's file server. - - file_path, project_name, summary, and labels are passed as-is to upload. - - Args: - file_path: The local path to the file. - project_name: The name of your project on Google Code. - summary: A small description for the file. - labels: an optional list of label strings with which to tag the file. - config_dir: Path to Subversion configuration directory, 'none', or None. - user_name: Your Google account name. - tries: How many attempts to make. - """ - - while tries > 0: - if user_name is None: - # Read username if not specified or loaded from svn config, or on - # subsequent tries. - sys.stdout.write('Please enter your googlecode.com username: ') - sys.stdout.flush() - user_name = sys.stdin.readline().rstrip() - if password is None: - # Read password if not loaded from svn config, or on subsequent tries. - print 'Please enter your googlecode.com password.' - print '** Note that this is NOT your Gmail account password! **' - print 'It is the password you use to access Subversion repositories,' - print 'and can be found here: http://code.google.com/hosting/settings' - password = getpass.getpass() - - status, reason, url = upload(file_path, project_name, user_name, password, - summary, labels) - # Returns 403 Forbidden instead of 401 Unauthorized for bad - # credentials as of 2007-07-17. - if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]: - # Rest for another try. - user_name = password = None - tries = tries - 1 - else: - # We're done. - break - - return status, reason, url - - -def main(): - parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY ' - '-p PROJECT [options] FILE') - parser.add_option('-s', '--summary', dest='summary', - help='Short description of the file') - parser.add_option('-p', '--project', dest='project', - help='Google Code project name') - parser.add_option('-u', '--user', dest='user', - help='Your Google Code username') - parser.add_option('-w', '--password', dest='password', - help='Your Google Code password') - parser.add_option('-l', '--labels', dest='labels', - help='An optional list of labels to attach to the file') - - options, args = parser.parse_args() - - if not options.summary: - parser.error('File summary is missing.') - elif not options.project: - parser.error('Project name is missing.') - elif len(args) < 1: - parser.error('File to upload not provided.') - elif len(args) > 1: - parser.error('Only one file may be specified.') - - file_path = args[0] - - if options.labels: - labels = options.labels.split(',') - else: - labels = None - - status, reason, url = upload_find_auth(file_path, options.project, - options.summary, labels, - options.user, options.password) - if url: - print 'The file was uploaded successfully.' - print 'URL: %s' % url - return 0 - else: - print 'An error occurred. Your file was not uploaded.' - print 'Google Code upload server said: %s (%s)' % (reason, status) - return 1 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..29953ea1 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..e0b3fb8d --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +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 diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/hamcrest-core/hamcrest-core.gradle b/hamcrest-core/hamcrest-core.gradle new file mode 100644 index 00000000..d2a91f8e --- /dev/null +++ b/hamcrest-core/hamcrest-core.gradle @@ -0,0 +1,18 @@ +dependencies { + api project(':hamcrest') +} + +jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Vendor': 'hamcrest.org', + 'Implementation-Version': version, + 'Automatic-Module-Name': 'org.hamcrest.core.deprecated' + } +} + +javadoc { + title = "Hamcrest Core $version API" + options.showFromPackage() + options.showFromPrivate() +} diff --git a/hamcrest-core/src/main/hamcrest-core.iml b/hamcrest-core/src/main/hamcrest-core.iml deleted file mode 100644 index 798e7aa9..00000000 --- a/hamcrest-core/src/main/hamcrest-core.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/hamcrest-core/src/main/java/org/hamcrest/Factory.java b/hamcrest-core/src/main/java/org/hamcrest/Factory.java deleted file mode 100644 index a8bf5f92..00000000 --- a/hamcrest-core/src/main/java/org/hamcrest/Factory.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.hamcrest; - -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - * Marks a Hamcrest static factory method so tools recognise them. - * A factory method is an equivalent to a named constructor. - * - * @author Joe Walnes - */ -@Retention(RUNTIME) -@Target({METHOD}) -public @interface Factory { -} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java b/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java deleted file mode 100644 index a5daf943..00000000 --- a/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.hamcrest.core; - -import org.hamcrest.Description; -import org.hamcrest.DiagnosingMatcher; -import org.hamcrest.Factory; -import org.hamcrest.Matcher; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so - * subsequent matchers are not called if an earlier matcher returns false. - */ -public class AllOf extends DiagnosingMatcher { - - private final Iterable> matchers; - - public AllOf(Iterable> matchers) { - this.matchers = matchers; - } - - @Override - public boolean matches(Object o, Description mismatch) { - for (Matcher matcher : matchers) { - if (!matcher.matches(o)) { - mismatch.appendDescriptionOf(matcher).appendText(" "); - matcher.describeMismatch(o, mismatch); - return false; - } - } - return true; - } - - @Override - public void describeTo(Description description) { - description.appendList("(", " " + "and" + " ", ")", matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

- * For example: - *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */ - @Factory - public static Matcher allOf(Iterable> matchers) { - return new AllOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

- * For example: - *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */ - @Factory - public static Matcher allOf(Matcher... matchers) { - return allOf(Arrays.asList(matchers)); - } - - /** - * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

- * For example: - *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */ - @Factory - public static Matcher allOf(Matcher first, Matcher second) { - List> matchers = new ArrayList>(2); - matchers.add(first); - matchers.add(second); - return allOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

- * For example: - *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */ - @Factory - public static Matcher allOf(Matcher first, Matcher second, Matcher third) { - List> matchers = new ArrayList>(3); - matchers.add(first); - matchers.add(second); - matchers.add(third); - return allOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

- * For example: - *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */ - @Factory - public static Matcher allOf(Matcher first, Matcher second, Matcher third, Matcher fourth) { - List> matchers = new ArrayList>(4); - matchers.add(first); - matchers.add(second); - matchers.add(third); - matchers.add(fourth); - return allOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

- * For example: - *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */ - @Factory - public static Matcher allOf(Matcher first, Matcher second, Matcher third, Matcher fourth, Matcher fifth) { - List> matchers = new ArrayList>(5); - matchers.add(first); - matchers.add(second); - matchers.add(third); - matchers.add(fourth); - matchers.add(fifth); - return allOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

- * For example: - *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */ - @Factory - public static Matcher allOf(Matcher first, Matcher second, Matcher third, Matcher fourth, Matcher fifth, Matcher sixth) { - List> matchers = new ArrayList>(6); - matchers.add(first); - matchers.add(second); - matchers.add(third); - matchers.add(fourth); - matchers.add(fifth); - matchers.add(sixth); - return allOf(matchers); - } -} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java deleted file mode 100644 index de006776..00000000 --- a/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.hamcrest.core; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.hamcrest.Description; -import org.hamcrest.Factory; -import org.hamcrest.Matcher; - -/** - * Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so - * subsequent matchers are not called if an earlier matcher returns true. - */ -public class AnyOf extends ShortcutCombination { - - public AnyOf(Iterable> matchers) { - super(matchers); - } - - @Override - public boolean matches(Object o) { - return matches(o, true); - } - - @Override - public void describeTo(Description description) { - describeTo(description, "or"); - } - - /** - * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

- * For example: - *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */ - @Factory - public static AnyOf anyOf(Iterable> matchers) { - return new AnyOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

- * For example: - *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */ - @Factory - public static AnyOf anyOf(Matcher... matchers) { - return anyOf(Arrays.asList(matchers)); - } - - /** - * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

- * For example: - *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */ - @Factory - public static AnyOf anyOf(Matcher first, Matcher second) { - List> matchers = new ArrayList>(); - matchers.add(first); - matchers.add(second); - return anyOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

- * For example: - *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */ - @Factory - public static AnyOf anyOf(Matcher first, Matcher second, Matcher third) { - List> matchers = new ArrayList>(); - matchers.add(first); - matchers.add(second); - matchers.add(third); - return anyOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

- * For example: - *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */ - @Factory - public static AnyOf anyOf(Matcher first, Matcher second, Matcher third, Matcher fourth) { - List> matchers = new ArrayList>(); - matchers.add(first); - matchers.add(second); - matchers.add(third); - matchers.add(fourth); - return anyOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

- * For example: - *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */ - @Factory - public static AnyOf anyOf(Matcher first, Matcher second, Matcher third, Matcher fourth, Matcher fifth) { - List> matchers = new ArrayList>(); - matchers.add(first); - matchers.add(second); - matchers.add(third); - matchers.add(fourth); - matchers.add(fifth); - return anyOf(matchers); - } - - /** - * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

- * For example: - *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */ - @Factory - public static AnyOf anyOf(Matcher first, Matcher second, Matcher third, Matcher fourth, Matcher fifth, Matcher sixth) { - List> matchers = new ArrayList>(); - matchers.add(first); - matchers.add(second); - matchers.add(third); - matchers.add(fourth); - matchers.add(fifth); - matchers.add(sixth); - return anyOf(matchers); - } -} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/StringContains.java b/hamcrest-core/src/main/java/org/hamcrest/core/StringContains.java deleted file mode 100644 index 606bb03f..00000000 --- a/hamcrest-core/src/main/java/org/hamcrest/core/StringContains.java +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.Factory; -import org.hamcrest.Matcher; - -/** - * Tests if the argument is a string that contains a substring. - */ -public class StringContains extends SubstringMatcher { - public StringContains(String substring) { - super(substring); - } - - @Override - protected boolean evalSubstringOf(String s) { - return s.indexOf(substring) >= 0; - } - - @Override - protected String relationship() { - return "containing"; - } - - /** - * Creates a matcher that matches if the examined {@link String} contains the specified - * {@link String} anywhere. - *

- * For example: - *

assertThat("myStringOfNote", containsString("ring"))
- * - * @param substring - * the substring that the returned matcher will expect to find within any examined string - * - */ - @Factory - public static Matcher containsString(String substring) { - return new StringContains(substring); - } - -} \ No newline at end of file diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/StringEndsWith.java b/hamcrest-core/src/main/java/org/hamcrest/core/StringEndsWith.java deleted file mode 100644 index 8772f739..00000000 --- a/hamcrest-core/src/main/java/org/hamcrest/core/StringEndsWith.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.Factory; -import org.hamcrest.Matcher; - -/** - * Tests if the argument is a string that contains a substring. - */ -public class StringEndsWith extends SubstringMatcher { - public StringEndsWith(String substring) { - super(substring); - } - - @Override - protected boolean evalSubstringOf(String s) { - return s.endsWith(substring); - } - - @Override - protected String relationship() { - return "ending with"; - } - - /** - * 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 - */ - @Factory - public static Matcher endsWith(String suffix) { - return new StringEndsWith(suffix); - } - -} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/StringStartsWith.java b/hamcrest-core/src/main/java/org/hamcrest/core/StringStartsWith.java deleted file mode 100644 index bad03ed3..00000000 --- a/hamcrest-core/src/main/java/org/hamcrest/core/StringStartsWith.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.Factory; -import org.hamcrest.Matcher; - -/** - * Tests if the argument is a string that contains a substring. - */ -public class StringStartsWith extends SubstringMatcher { - public StringStartsWith(String substring) { - super(substring); - } - - @Override - protected boolean evalSubstringOf(String s) { - return s.startsWith(substring); - } - - @Override - protected String relationship() { - return "starting with"; - } - - /** - * 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 - */ - @Factory - public static Matcher startsWith(String prefix) { - return new StringStartsWith(prefix); - } - -} \ No newline at end of file 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 new file mode 100644 index 00000000..19482c3d --- /dev/null +++ b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/HamcrestCoreIsDeprecated.java @@ -0,0 +1,9 @@ +package org.hamcrest.core.deprecated; + +/** + * All the classes in hamcrest-core.jar have moved to + * hamcrest.jar. Please use that dependency instead. + */ +@Deprecated +class HamcrestCoreIsDeprecated { +} 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 new file mode 100644 index 00000000..394ab821 --- /dev/null +++ b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java @@ -0,0 +1,5 @@ +/** + * All classes in hamcrest-core.jar have been migrated to + * hamcrest.jar. Please use that dependency instead. + */ +package org.hamcrest.core.deprecated; \ No newline at end of file diff --git a/hamcrest-core/src/main/java/org/hamcrest/package.html b/hamcrest-core/src/main/java/org/hamcrest/package.html deleted file mode 100644 index 143c704d..00000000 --- a/hamcrest-core/src/main/java/org/hamcrest/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - -

The stable API defining Matcher and its associated interfaces and classes. - Hamcrest sub-projects define their convenience classes in the org.hamcrest package. -

- - diff --git a/hamcrest-core/src/main/resources/hamcrest-core-is-deprecated.txt b/hamcrest-core/src/main/resources/hamcrest-core-is-deprecated.txt new file mode 100644 index 00000000..4c860f0c --- /dev/null +++ b/hamcrest-core/src/main/resources/hamcrest-core-is-deprecated.txt @@ -0,0 +1,5 @@ +Hamcrest Core +============= + +All the classes in hamcrest-core.jar and hamcrest-library.jar has moved +into hamcrest.jar. Please update your dependencies. \ No newline at end of file diff --git a/hamcrest-examples/src/main/hamcrest-examples.iml b/hamcrest-examples/src/main/hamcrest-examples.iml deleted file mode 100644 index 6b02a9d1..00000000 --- a/hamcrest-examples/src/main/hamcrest-examples.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithAssertThat.java b/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithAssertThat.java deleted file mode 100644 index aa572576..00000000 --- a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithAssertThat.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.hamcrest.examples.junit3; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import junit.framework.TestCase; - -/** - * Demonstrates how Hamcrest matchers can be used with assertThat() - * using JUnit 3.8.x. - * - * @author Joe Walnes - */ -public class ExampleWithAssertThat extends TestCase { - - public void testUsingAssertThat() { - assertThat("xx", is("xx")); - assertThat("yy", is(not("xx"))); - assertThat("i like cheese", containsString("cheese")); - } - -} diff --git a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithEasyMock2.java b/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithEasyMock2.java deleted file mode 100644 index 8e3b99a7..00000000 --- a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithEasyMock2.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.hamcrest.examples.junit3; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.hamcrest.EasyMock2Matchers.equalTo; -import junit.framework.TestCase; - -/** - * Demonstrates how HamCrest matchers can be used from EasyMock with - * JUnit 3.x. - * - * @author Joe Walnes - */ -public class ExampleWithEasyMock2 extends TestCase { - - /* EasyMock (2) specific notes: - * - * Important terminology: - * What EasyMock2 calls 'IArgumentMatcher', Hamcrest calls 'Matchers'. - * - * This functionality is available for EasyMock 2.x but NOT EasyMock 1.x. - * - * The class extends the standard JUnit TestCase. - * - * The additional Hamcrest Matchers can be used by using a static import: - * import static org.hamcrest.EasyMockMatchers.*; - * - * This provides the Hamcrest library of Matchers through an interface - * that will provide an adapter to EasyMock IArgumentMatchers and report - * them to EasyMock as it needs to keep track of them. - */ - - - /** - * A sample interface that will be mocked. - */ - public static interface AnInterface { - void doStuff(String string); - } - - private AnInterface mock = createMock(AnInterface.class); - - /** - * This examples shows using a mock with a standard EasyMock2 matcher. - * Hamcrest is not used here. - */ - public void testUsingAnEasyMockMatcher() { - mock.doStuff(eq("i like cheese and stuff")); - replay(mock); - mock.doStuff("i like cheese and stuff"); - verify(mock); - } - - /** - * This examples shows using a mock with a Hamcrest matcher, adapted - * to jMock. - */ - public void testUsingAHamcrestMatcher() { - mock.doStuff(equalTo("xx")); - replay(mock); - mock.doStuff("xx"); - verify(mock); - } - - /** - * This examples shows using the standard jMock assertThat() method - * with both jMock Constraints and Hamcrest Matchers. - */ - public void testUsingAssertThat() { - // TODO(joe): This is a bit tricker with EasyMock. - //assertThat("xx", equal("xx")); - //assertThat("yy", not(equal("xx"))); - //assertThat("i like cheese", startsWith("i like")); - } - -} diff --git a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithJMock1.java b/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithJMock1.java deleted file mode 100644 index 041c8e0c..00000000 --- a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit3/ExampleWithJMock1.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.hamcrest.examples.junit3; - -import static org.hamcrest.JMock1Matchers.equalTo; - -import org.jmock.Mock; -import org.jmock.MockObjectTestCase; - -/** - * Demonstrates how HamCrest matchers can be used from jMock with JUnit 3.8.x. - * - * @author Joe Walnes - */ -public class ExampleWithJMock1 extends MockObjectTestCase { - - /* jMock specific notes: - * - * Important terminology: - * What jMock calls 'Constraints', Hamcrest calls 'Matchers'. - * - * Note: This is only valid for jMock1. jMock2 supports Hamcrest out - * of the box. - * - * The class extends org.jmock.MockObjectTestCase as usual. - * This provides: - * - The mock() methods and syntactic sugar for setting up mocks. - * - Auto verification of mocks. - * - jMock's implementation of assertThat(). - * - jMock's standard Constraints. - * - * The additional Hamcrest Matchers can be used by using a static import: - * import static org.hamcrest.JMockMatchers.*; - * - * This provides the Hamcrest library of Matchers through an interface - * that will provide an adapter to JMock Constraints. - */ - - /** - * A sample interface to be mocked. - */ - public static interface AnInterface { - void doStuff(String string); - } - - private Mock mock = mock(AnInterface.class); - private AnInterface anInterface = (AnInterface) mock.proxy(); - - /** - * This examples shows using a mock with a standard jMock constraint. - * Hamcrest is not used here. - */ - public void testUsingAJMockConstraint() { - mock.expects(atLeastOnce()).method("doStuff") - .with(stringContains("cheese")); - - anInterface.doStuff("i like cheese and stuff"); - } - - /** - * This examples shows using a mock with a Hamcrest matcher, adapted - * to jMock. - */ - public void testUsingAHamcrestMatcher() { - mock.expects(atLeastOnce()).method("doStuff") - .with(equalTo("xx")); - - anInterface.doStuff("xx"); - } - - /** - * This examples shows using the standard jMock assertThat() method - * with both jMock Constraints and Hamcrest Matchers. - */ - public void testUsingAssertThat() { - assertThat("i like cheese", stringContains("cheese")); // jMock Constraint. - assertThat("xx", equalTo("xx")); // Hamcrest Matcher. - assertThat("yy", not(equalTo("xx"))); // Mixture of both. - } - -} diff --git a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit4/ExampleWithAssertThat.java b/hamcrest-examples/src/main/java/org/hamcrest/examples/junit4/ExampleWithAssertThat.java deleted file mode 100644 index 9b335d52..00000000 --- a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit4/ExampleWithAssertThat.java +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (c) 2000-2010 hamcrest.org - */ -package org.hamcrest.examples.junit4; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; - -import org.hamcrest.Description; -import org.hamcrest.Matcher; -import org.hamcrest.TypeSafeMatcher; -import org.junit.Test; - -/** - * Demonstrates how HamCrest matchers can be used with assertThat() - * using JUnit 4.x. - * - * @author Joe Walnes - */ -public class ExampleWithAssertThat { - - @Test - public void usingAssertThat() { - assertThat("xx", is("xx")); - assertThat("yy", is(not("xx"))); - assertThat("i like cheese", containsString("cheese")); - } - - /** - * Allow JUnit 4 test to be run under JUnit 3. - */ - public static junit.framework.Test suite() { - return new junit.framework.JUnit4TestAdapter(ExampleWithAssertThat.class); - } - - public static class ComplicatedClass { - private int firstNumber = 23; - private int secondNumber = 45; - private String someText = "This is useful text"; - - public String whichOne(boolean first) { - return someText + (first ? firstNumber : secondNumber); - } - } - - @Test - public void showMismatch() { - ComplicatedClass complicated = new ComplicatedClass(); - - assertThat(complicated, shouldBe("the wrong thing")); - } - - private static Matcher shouldBe(final String string) { - return new TypeSafeMatcher() { - @Override - public void describeTo(Description description) { } // no op - @Override - public boolean matchesSafely(ComplicatedClass item) { return false; } - @Override - public void describeMismatchSafely(ComplicatedClass item, Description mismatchDescription) { - mismatchDescription.appendText(string); - } - }; - } - -} diff --git a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit4/ExampleWithEasyMock2.java b/hamcrest-examples/src/main/java/org/hamcrest/examples/junit4/ExampleWithEasyMock2.java deleted file mode 100644 index fd63a5a0..00000000 --- a/hamcrest-examples/src/main/java/org/hamcrest/examples/junit4/ExampleWithEasyMock2.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.hamcrest.examples.junit4; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.hamcrest.EasyMock2Matchers.equalTo; - -import org.junit.Test; - -/** - * Demonstrates how HamCrest matchers can be used from EasyMock with - * JUnit 4.x. - * - * @author Joe Walnes - */ -public class ExampleWithEasyMock2 { - - /* EasyMock (2) specific notes: - * - * Important terminology: - * What EasyMock2 calls 'IArgumentMatcher', Hamcrest calls 'Matchers'. - * - * This functionality is available for EasyMock 2.x but NOT EasyMock 1.x. - * - * The class does not need to extend anything. - * - * The additional Hamcrest Matchers can be used by using a static import: - * import static org.hamcrest.EasyMockMatchers.*; - * - * This provides the Hamcrest library of Matchers through an interface - * that will provide an adapter to EasyMock IArgumentMatchers and report - * them to EasyMock as it needs to keep track of them. - */ - - - /** - * A sample interface that will be mocked. - */ - public static interface AnInterface { - void doStuff(String string); - } - - private AnInterface mock = createMock(AnInterface.class); - - /** - * This examples shows using a mock with a standard EasyMock2 matcher. - * Hamcrest is not used here. - */ - @Test - public void usingAnEasyMockMatcher() { - mock.doStuff(eq("i like cheese and stuff")); - replay(mock); - mock.doStuff("i like cheese and stuff"); - verify(mock); - } - - /** - * This examples shows using a mock with a Hamcrest matcher, adapted - * to jMock. - */ - @Test - public void usingAHamcrestMatcher() { - mock.doStuff(equalTo("xx")); - replay(mock); - mock.doStuff("xx"); - verify(mock); - } - - /** - * This examples shows using the standard jMock assertThat() method - * with both jMock Constraints and Hamcrest Matchers. - */ - @Test - public void usingAssertThat() { - // TODO(joe): This is a bit tricker with EasyMock. - //assertThat("xx", isTwoXs()); - //assertThat("yy", not(isTwoXs())); - //assertThat("i like cheese", startsWith("i like")); - } - - /** - * Allow JUnit 4 test to be run under JUnit 3. - */ - public static junit.framework.Test suite() { - return new junit.framework.JUnit4TestAdapter(ExampleWithEasyMock2.class); - } -} diff --git a/hamcrest-examples/src/main/java/org/hamcrest/examples/testng/ExampleWithAssertThat.java b/hamcrest-examples/src/main/java/org/hamcrest/examples/testng/ExampleWithAssertThat.java deleted file mode 100644 index 59e09da2..00000000 --- a/hamcrest-examples/src/main/java/org/hamcrest/examples/testng/ExampleWithAssertThat.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.hamcrest.examples.testng; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; - -import org.testng.annotations.Test; - -/** - * Demonstrates how Hamcrest matchers can be used with assertThat() - * using TestNG. - * - * @author Joe Walnes - */ -@Test -public class ExampleWithAssertThat { - - @Test - public void usingAssertThat() { - assertThat("xx", is("xx")); - assertThat("yy", is(not("xx"))); - assertThat("i like cheese", containsString("cheese")); - } - -} diff --git a/hamcrest-examples/src/main/java/org/hamcrest/examples/testng/ExampleWithEasyMock2.java b/hamcrest-examples/src/main/java/org/hamcrest/examples/testng/ExampleWithEasyMock2.java deleted file mode 100644 index eb66ccd6..00000000 --- a/hamcrest-examples/src/main/java/org/hamcrest/examples/testng/ExampleWithEasyMock2.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.hamcrest.examples.testng; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.hamcrest.EasyMock2Matchers.equalTo; - -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** - * Demonstrates how Hamcrest matchers can be used from EasyMock with - * TestNG. - * - * @author Joe Walnes - */ -@Test -public class ExampleWithEasyMock2 { - - /* EasyMock (2) specific notes: - * - * Important terminology: - * What EasyMock2 calls 'IArgumentMatcher', Hamcrest calls 'Matchers'. - * - * This functionality is available for EasyMock 2.x but NOT EasyMock 1.x. - * - * The class does not need to extend anything. - * - * The additional Hamcrest Matchers can be used by using a static import: - * import static org.hamcrest.EasyMockMatchers.*; - * - * This provides the Hamcrest library of Matchers through an interface - * that will provide an adapter to EasyMock IArgumentMatchers and report - * them to EasyMock as it needs to keep track of them. - */ - - - /** - * A sample interface that will be mocked. - */ - public static interface AnInterface { - void doStuff(String string); - } - - private AnInterface mock; - - @BeforeMethod - public void setUpMock() { - mock = createMock(AnInterface.class); - } - - /** - * This examples shows using a mock with a standard EasyMock2 matcher. - * Hamcrest is not used here. - */ - @Test - public void usingAnEasyMockMatcher() { - mock.doStuff(eq("i like cheese and stuff")); - replay(mock); - mock.doStuff("i like cheese and stuff"); - verify(mock); - } - - /** - * This examples shows using a mock with a Hamcrest matcher, adapted - * to jMock. - */ - @Test - public void usingAHamcrestMatcher() { - mock.doStuff(equalTo("xx")); - replay(mock); - mock.doStuff("xx"); - verify(mock); - } - - /** - * This examples shows using the standard jMock assertThat() method - * with both jMock Constraints and Hamcrest Matchers. - */ - @Test - public void usingAssertThat() { - // TODO(joe): This is a bit tricker with EasyMock. - //assertThat("xx", isTwoXs()); - //assertThat("yy", not(isTwoXs())); - //assertThat("i like cheese", startsWith("i like")); - } - -} diff --git a/hamcrest-generator/src/main/hamcrest-generator.iml b/hamcrest-generator/src/main/hamcrest-generator.iml deleted file mode 100644 index 1a291dc0..00000000 --- a/hamcrest-generator/src/main/hamcrest-generator.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/EasyMock2FactoryWriter.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/EasyMock2FactoryWriter.java deleted file mode 100644 index 125437f8..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/EasyMock2FactoryWriter.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.hamcrest.generator; - -import java.io.PrintWriter; -import java.io.Writer; -import java.io.IOException; - -/** - * {@link FactoryWriter} that outputs Java code which simply delegates all - * factory methods to factory methods elsewhere. This is useful for grouping - * lots of matcher classes into one class, so you know where to look to find - * matchers. - * - * @author Joe Walnes - * @see FactoryWriter - */ -public class EasyMock2FactoryWriter implements FactoryWriter { - - private final PrintWriter output; - private final String javaPackageName; - private final String javaClassName; - - private String indentationString = " "; - private String newLine = "\n"; - - private int indentation = 1; - - public EasyMock2FactoryWriter(Writer output, String javaPackageName, String javaClassName) { - this.javaPackageName = javaPackageName; - this.javaClassName = javaClassName; - this.output = new PrintWriter(output); - } - - @Override - public void writeHeader() throws IOException { - output.append("package ").append(javaPackageName).append(';').append(newLine).append(newLine); - output.append("public class ").append(javaClassName).append(" {").append(newLine).append(newLine); - } - - @Override - public void writeFooter() throws IOException { - output.append('}').append(newLine); - } - - @Override - public void close() throws IOException { - output.close(); - } - - @Override - public void flush() throws IOException { - output.flush(); - } - - @Override - public void writeMethod(String generatedMethodName, FactoryMethod factoryMethodToDelegateTo) - throws IOException { - writeJavaDoc(factoryMethodToDelegateTo); - indent(); - output.append("public static "); - //writeGenericTypeParameters(factoryMethodToDelegateTo); - String returnType = factoryMethodToDelegateTo.getGenerifiedType(); - if (returnType == null) { - returnType = "java.lang.Object"; - } - output.append(returnType); - output.append(' ').append(generatedMethodName); - writeParameters(factoryMethodToDelegateTo); - writeExceptions(factoryMethodToDelegateTo); - output.append(" {").append(newLine); - indentation++; - writeMethodBody(factoryMethodToDelegateTo); - indentation--; - indent(); - output.append('}').append(newLine).append(newLine); - } - - private void writeMethodBody(FactoryMethod factoryMethod) { - indent(); - output.append("org.hamcrest.integration.EasyMockAdapter.adapt(").append(newLine); - indentation++; - indent(); - output.append(factoryMethod.getMatcherClass()); - output.append('.').append(factoryMethod.getName()); - output.append('('); - boolean seenFirst = false; - for (FactoryMethod.Parameter parameter : factoryMethod.getParameters()) { - if (seenFirst) { - output.append(", "); - } else { - seenFirst = true; - } - output.append(parameter.getName()); - } - output.append("));").append(newLine); - indentation--; - indent(); - output.append("return null;").append(newLine); - } - - private void writeExceptions(FactoryMethod factoryMethod) { - boolean seenFirst = false; - for (String exception : factoryMethod.getExceptions()) { - if (seenFirst) { - output.append(", "); - } else { - output.append(" throws "); - seenFirst = true; - } - output.append(exception); - } - } - - private void writeParameters(FactoryMethod factoryMethod) { - output.append('('); - boolean seenFirst = false; - for (FactoryMethod.Parameter parameter : factoryMethod.getParameters()) { - if (seenFirst) { - output.append(", "); - } else { - seenFirst = true; - } - output.append(parameter.getType()).append(' ').append(parameter.getName()); - } - output.append(')'); - } - - private void writeJavaDoc(FactoryMethod factoryMethod) { - if (factoryMethod.getJavaDoc() != null) { - String[] lines = factoryMethod.getJavaDoc().split("\n"); - if (lines.length > 0) { - indent(); - output.append("/**").append(newLine); - for (String line : lines) { - indent(); - output.append(" * ").append(line).append(newLine); - } - indent(); - output.append(" */").append(newLine); - } - } - } - - private void indent() { - for (int i = 0; i < indentation; i++) { - output.append(indentationString); - } - } -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryMethod.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryMethod.java deleted file mode 100644 index d7dbf92a..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryMethod.java +++ /dev/null @@ -1,246 +0,0 @@ -package org.hamcrest.generator; - -import java.util.ArrayList; -import static java.util.Collections.unmodifiableList; -import java.util.List; - -/** - * Represents a Matcher Factory method. - *

- *

This class uses Strings to represent things instead of java.lang.reflect equivalents, - * allowing methods to be defined from sources other than reflection of classes in the - * classpath. - * - * @author Joe Walnes - * @see SugarGenerator - */ -public class FactoryMethod { - - private final String matcherClass; - private final String factoryMethod; - private final String returnType; - - private String generifiedType; - private List parameters = new ArrayList(); - private List exceptions = new ArrayList(); - private List genericTypeParameters = new ArrayList(); - private String javaDoc; - - public FactoryMethod(String matcherClass, String factoryMethod, String returnType) { - this.matcherClass = matcherClass; - this.factoryMethod = factoryMethod; - this.returnType = returnType; - } - - /** - * Original class this factory method came from. - */ - public String getMatcherClass() { - return matcherClass; - } - - /** - * @return The fully qualified name of the type returned by the method. This should be a - * subclass of org.hamcrest.Matcher. - */ - public String getReturnType() { - return returnType; - } - - /** - * Original name of factory method. - */ - public String getName() { - return factoryMethod; - } - - public void setGenerifiedType(String generifiedType) { - this.generifiedType = generifiedType; - } - - /** - * Generified type of matcher. - * ie. 'public Matcher<THISBIT> blah(...)' - */ - public String getGenerifiedType() { - return generifiedType; - } - - public void addParameter(String type, String name) { - parameters.add(new Parameter(type, name)); - } - - /** - * List of Parameters passed to factory method. - * ie. 'public Matcher<...&ht;> blah(THIS, AND, THAT)' - */ - public List getParameters() { - return unmodifiableList(parameters); - } - - public void addException(String exception) { - exceptions.add(exception); - } - - /** - * List of exceptions thrown by factory method. - * ie. 'public Matcher<...> blah(...) throws THIS, THAT' - */ - public List getExceptions() { - return unmodifiableList(exceptions); - } - - public void addGenericTypeParameter(String genericTypeParameter) { - genericTypeParameters.add(genericTypeParameter); - } - - /** - * List of generic type parameters for factory method definition. - * ie. 'public <THIS,THAT> Matcher<...> blah(...)' - */ - public List getGenericTypeParameters() { - return unmodifiableList(genericTypeParameters); - } - - public void setJavaDoc(String javaDoc) { - this.javaDoc = javaDoc; - } - - /** - * JavaDoc definition of factory method. - * Excludes surrounding comment markers. - * Note that using standard Java reflection it is not possible to obtain this, - * however source code parsers can read this. - */ - public String getJavaDoc() { - return javaDoc; - } - - // Generated in Eclipse... - // n.b. Doesn't include returnType - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - FactoryMethod other = (FactoryMethod) obj; - if (exceptions == null) { - if (other.exceptions != null) return false; - } else if (!exceptions.equals(other.exceptions)) return false; - if (factoryMethod == null) { - if (other.factoryMethod != null) return false; - } else if (!factoryMethod.equals(other.factoryMethod)) return false; - if (genericTypeParameters == null) { - if (other.genericTypeParameters != null) return false; - } else if (!genericTypeParameters.equals(other.genericTypeParameters)) return false; - if (generifiedType == null) { - if (other.generifiedType != null) return false; - } else if (!generifiedType.equals(other.generifiedType)) return false; - if (javaDoc == null) { - if (other.javaDoc != null) return false; - } else if (!javaDoc.equals(other.javaDoc)) return false; - if (matcherClass == null) { - if (other.matcherClass != null) return false; - } else if (!matcherClass.equals(other.matcherClass)) return false; - if (parameters == null) { - if (other.parameters != null) return false; - } else if (!parameters.equals(other.parameters)) return false; - return true; - } - - // Generated in Eclipse... - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((exceptions == null) ? 0 : exceptions.hashCode()); - result = prime * result + ((factoryMethod == null) ? 0 : factoryMethod.hashCode()); - result = prime * result + ((genericTypeParameters == null) ? 0 : genericTypeParameters.hashCode()); - result = prime * result + ((generifiedType == null) ? 0 : generifiedType.hashCode()); - result = prime * result + ((javaDoc == null) ? 0 : javaDoc.hashCode()); - result = prime * result + ((matcherClass == null) ? 0 : matcherClass.hashCode()); - result = prime * result + ((parameters == null) ? 0 : parameters.hashCode()); - return result; - } - - @Override - public String toString() { - return "{FactoryMethod: \n" + - " matcherClass = " + matcherClass + "\n" + - " factoryMethod = " + factoryMethod + "\n" + - " generifiedType = " + generifiedType + "\n" + - " parameters = " + parameters + "\n" + - " exceptions = " + exceptions + "\n" + - " genericTypeParameters = " + genericTypeParameters + "\n" + - " javaDoc = " + javaDoc + "\n" + - "}"; - } - - /** - * Represents a parameter passed to a factory method. - * - * @see FactoryMethod - */ - public static class Parameter { - - private final String type; - private String name; - - public Parameter(String type, String name) { - this.type = type; - this.name = name; - } - - /** - * Type of parameter, including any generic declarations. - */ - public String getType() { - return type; - } - - /** - * Name of parameter, if it can be obtained. If it cannot - * be obtained, a sensible default will returned instead. - */ - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return type + " " + name; - } - - // Generated in Eclipse... - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; - } - - // Generated in Eclipse... - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Parameter other = (Parameter) obj; - if (name == null) { - if (other.name != null) return false; - } else if (!name.equals(other.name)) return false; - if (type == null) { - if (other.type != null) return false; - } else if (!type.equals(other.type)) return false; - return true; - } - - } - -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryWriter.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryWriter.java deleted file mode 100644 index d181288d..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryWriter.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.hamcrest.generator; - -import java.io.Closeable; -import java.io.Flushable; -import java.io.IOException; - -/** - * Writes syntactic sugar code for factories. - *

Implementations of this could include vanilla factory methods for - * Hamcrest matchers, wrapped factories for other libraries or factories - * in other languages (jython, jruby, groovy, etc). - *

Usage:

- *
- * writer.writeHeader(...);
- * 

- * writer.writeMethod(...); - * writer.writeMethod(...); - * writer.writeMethod(...); - * ... - * writer.writeFooter(...); - * writer.close(); - *

- * - * @author Joe Walnes - * @see FactoryMethod - * @see SugarGenerator - * @see HamcrestFactoryWriter - */ -public interface FactoryWriter extends Closeable, Flushable { - - /** - * Write the code header. - */ - void writeHeader() throws IOException; - - /** - * Writes code that delegates to a method. - * - * @param generatedMethodName - * @param factoryMethodToDelegateTo - */ - void writeMethod(String generatedMethodName, FactoryMethod factoryMethodToDelegateTo) throws IOException; - - /** - * Write any necessary code to finish the output. - */ - void writeFooter() throws IOException; - -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/HamcrestFactoryWriter.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/HamcrestFactoryWriter.java deleted file mode 100644 index 48406766..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/HamcrestFactoryWriter.java +++ /dev/null @@ -1,183 +0,0 @@ -package org.hamcrest.generator; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.util.StringTokenizer; - -/** - * {@link FactoryWriter} that outputs Java code which simply delegates all - * Hamcrest factory methods to factory methods elsewhere. This is useful for - * grouping lots of matcher classes into one class, so you only have to look - * in one place for matchers. - * - * @author Joe Walnes - * @see FactoryWriter - */ -public class HamcrestFactoryWriter implements FactoryWriter { - - private final PrintWriter output; - private final String javaPackageName; - private final String javaClassName; - - private String indentationString = " "; - private String newLine = "\n"; - - private int indentation = 1; - - public HamcrestFactoryWriter(String javaPackageName, String javaClassName, Writer output) { - this.javaPackageName = javaPackageName; - this.javaClassName = javaClassName; - this.output = new PrintWriter(output); - } - - @Override - public void writeHeader() throws IOException { - output.append("// Generated source.").append(newLine) - .append("package ").append(javaPackageName).append(';').append(newLine).append(newLine); - output.append("public class ").append(javaClassName).append(" {").append(newLine).append(newLine); - } - - @Override - public void writeFooter() throws IOException { - output.append('}').append(newLine); - } - - @Override - public void close() throws IOException { - output.close(); - } - - @Override - public void flush() throws IOException { - output.flush(); - } - - @Override - public void writeMethod(String generatedMethodName, FactoryMethod factoryMethodToDelegateTo) - throws IOException { - writeJavaDoc(factoryMethodToDelegateTo); - indent(); - output.append("public static "); - writeGenericTypeParameters(factoryMethodToDelegateTo); - output.append(factoryMethodToDelegateTo.getReturnType()); - if (factoryMethodToDelegateTo.getGenerifiedType() != null) { - output.append('<').append(factoryMethodToDelegateTo.getGenerifiedType()).append('>'); - } - output.append(' ').append(generatedMethodName); - writeParameters(factoryMethodToDelegateTo); - writeExceptions(factoryMethodToDelegateTo); - output.append(" {").append(newLine); - indentation++; - writeMethodBody(factoryMethodToDelegateTo); - indentation--; - indent(); - output.append('}').append(newLine).append(newLine); - } - - private void writeGenericTypeParameters(FactoryMethod factoryMethod) { - if (!factoryMethod.getGenericTypeParameters().isEmpty()) { - output.append('<'); - boolean seenFirst = false; - for (String type : factoryMethod.getGenericTypeParameters()) { - if (seenFirst) { - output.append(", "); - } else { - seenFirst = true; - } - output.append(type); - } - output.append("> "); - } - } - - private void writeMethodBody(FactoryMethod factoryMethod) { - indent(); - output.append("return ").append(factoryMethod.getMatcherClass()); - output.append('.'); - - // lets write the generic types - if (!factoryMethod.getGenericTypeParameters().isEmpty()) { - output.append('<'); - boolean seenFirst = false; - for (String type : factoryMethod.getGenericTypeParameters()) { - if (seenFirst) { - output.append(","); - } else { - seenFirst = true; - } - // lets only print the first word of the type - // so if its 'T extends Cheese' we just print T - //output.append(type); - - StringTokenizer iter = new StringTokenizer(type); - iter.hasMoreElements(); - output.append(iter.nextToken()); - } - output.append(">"); - } - - output.append(factoryMethod.getName()); - output.append('('); - boolean seenFirst = false; - for (FactoryMethod.Parameter parameter : factoryMethod.getParameters()) { - if (seenFirst) { - output.append(", "); - } else { - seenFirst = true; - } - output.append(parameter.getName()); - } - output.append(')'); - output.append(';').append(newLine); - } - - private void writeExceptions(FactoryMethod factoryMethod) { - boolean seenFirst = false; - for (String exception : factoryMethod.getExceptions()) { - if (seenFirst) { - output.append(", "); - } else { - output.append(" throws "); - seenFirst = true; - } - output.append(exception); - } - } - - private void writeParameters(FactoryMethod factoryMethod) { - output.append('('); - boolean seenFirst = false; - for (FactoryMethod.Parameter parameter : factoryMethod.getParameters()) { - if (seenFirst) { - output.append(", "); - } else { - seenFirst = true; - } - output.append(parameter.getType()).append(' ').append(parameter.getName()); - } - output.append(')'); - } - - private void writeJavaDoc(FactoryMethod factoryMethod) { - if (factoryMethod.getJavaDoc() != null) { - String[] lines = factoryMethod.getJavaDoc().split("\n"); - if (lines.length > 0) { - indent(); - output.append("/**").append(newLine); - for (String line : lines) { - indent(); - output.append(" * ").append(line).append(newLine); - } - indent(); - output.append(" */").append(newLine); - } - } - } - - private void indent() { - for (int i = 0; i < indentation; i++) { - output.append(indentationString); - } - } -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java deleted file mode 100644 index c1798f21..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.hamcrest.generator; - -import com.thoughtworks.qdox.JavaDocBuilder; -import com.thoughtworks.qdox.model.JavaClass; - -import java.io.File; -import java.io.Reader; - -/** - * Wraps QDox library. This is because to ease distribution, QDox is bundled into - * hamcrest-generator.jar and has its package renamed to ensure there is no conflict - * (using Jar Jar Links). This wrapper class removes all traces of QDox from Hamcrest's - * public API, so there aren't any compatibility problems. - * - * @author Joe Walnes - */ -public class QDox { - - private final JavaDocBuilder javaDocBuilder = new JavaDocBuilder(); - - public void addSourceTree(File sourceDir) { - javaDocBuilder.addSourceTree(sourceDir); - } - - public void addSource(Reader reader) { - javaDocBuilder.addSource(reader); - } - - JavaClass getClassByName(String className) { - return javaDocBuilder.getClassByName(className); - } -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java deleted file mode 100644 index 7883a6f2..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.hamcrest.generator; - -import com.thoughtworks.qdox.model.DocletTag; -import com.thoughtworks.qdox.model.JavaClass; -import com.thoughtworks.qdox.model.JavaMethod; -import com.thoughtworks.qdox.model.JavaParameter; -import com.thoughtworks.qdox.model.Type; - -import java.util.Iterator; -import java.util.List; -import java.util.regex.Pattern; - -/** - * Wraps an existing sequence of FactoryMethods, and attempts to pull in - * parameter names and JavaDoc (which aren't available using reflection) using - * QDox. - * - * @see QDox - * @author Joe Walnes - */ -public class QDoxFactoryReader implements Iterable { - - private final Iterable wrapped; - private final JavaClass classSource; - - private static final Pattern GENERIC_REGEX = Pattern.compile("<.*>"); - private static final Pattern VARARGS_REGEX = Pattern.compile("...", Pattern.LITERAL); - - public QDoxFactoryReader(Iterable wrapped, QDox qdox, String className) { - this.wrapped = wrapped; - this.classSource = qdox.getClassByName(className); - } - - @Override - public Iterator iterator() { - final Iterator iterator = wrapped.iterator(); - return new Iterator() { - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public FactoryMethod next() { - return enhance(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - }; - } - - private FactoryMethod enhance(FactoryMethod factoryMethod) { - JavaMethod methodSource = findMethodInSource(factoryMethod); - if (methodSource != null) { - factoryMethod.setJavaDoc(createJavaDocComment(methodSource)); - JavaParameter[] parametersFromSource - = methodSource.getParameters(); - List parametersFromReflection - = factoryMethod.getParameters(); - - if (parametersFromReflection.size() == parametersFromSource.length) { - for (int i = 0; i < parametersFromSource.length; i++) { - parametersFromReflection.get(i).setName( - parametersFromSource[i].getName()); - } - } - } - return factoryMethod; - } - - /** - * Attempts to locate the source code for a specific method, by cross-referencing - * the signature returned by reflection with the list of methods parsed by QDox. - */ - private JavaMethod findMethodInSource(FactoryMethod factoryMethod) { - // Note, this doesn't always work - it struggles with some kinds of generics. - // This seems to cover most cases though. - List params = factoryMethod.getParameters(); - Type[] types = new Type[params.size()]; - boolean varArgs = false; - for (int i = 0; i < types.length; i++) { - String type = params.get(i).getType(); - varArgs = VARARGS_REGEX.matcher(type).find(); - // QDox ignores varargs and generics, so we strip them out to help QDox. - type = GENERIC_REGEX.matcher(type).replaceAll(""); - type = VARARGS_REGEX.matcher(type).replaceAll(""); - types[i] = new Type(type); - } - JavaMethod[] methods = classSource.getMethodsBySignature(factoryMethod.getName(), types, false, varArgs); - return methods.length == 1 ? methods[0] : null; - } - - /** - * Reconstructs the JavaDoc as a string for a particular method. - */ - private static String createJavaDocComment(JavaMethod methodSource) { - String comment = methodSource.getComment(); - DocletTag[] tags = methodSource.getTags(); - if ((comment == null || comment.trim().length() == 0) && tags.length == 0) { - return null; - } - StringBuilder result = new StringBuilder(); - result.append(comment); - result.append("\n\n"); - for (DocletTag tag : tags) { - result.append('@').append(tag.getName()) - .append(' ').append(tag.getValue()) - .append('\n'); - } - return result.toString(); - } - -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QuickReferenceWriter.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QuickReferenceWriter.java deleted file mode 100644 index e80c2300..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QuickReferenceWriter.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.hamcrest.generator; - -import java.io.IOException; -import java.io.PrintStream; - -/** - * Dumps a quick list of factory methods. Designed to be read by users, as a cheatsheet. - * - * @author Joe Walnes - */ -public class QuickReferenceWriter implements FactoryWriter { - - private final PrintStream out; - private int columnPosition = 14; - - public QuickReferenceWriter(PrintStream out) { - this.out = out; - } - - public QuickReferenceWriter() { - this(System.out); - } - - public void setColumnPosition(int columnPosition) { - this.columnPosition = columnPosition; - } - - @Override - public void writeHeader() throws IOException { - } - - @Override - public void writeMethod(String generatedMethodName, FactoryMethod factoryMethod) throws IOException { - String actsOn = removePackageNames(factoryMethod.getGenerifiedType()); - for (int i = actsOn.length(); i < columnPosition; i++) { - out.append(' '); - } - out.append('[').append(actsOn).append("] "); - out.append(generatedMethodName); - out.append('('); - boolean seenFirst = false; - for (FactoryMethod.Parameter parameter : factoryMethod.getParameters()) { - if (seenFirst) { - out.append(", "); - } else { - seenFirst = true; - } - out.append(removePackageNames(parameter.getType())); - out.append(' '); - out.append(parameter.getName()); - } - out.append(')'); - out.println(); - } - - private static String removePackageNames(String in) { - // Simplify fully qualified names (allowing for trailing '...'). - return in == null ? "" : in.replaceAll("[^<>]*\\.([^\\.])", "$1"); - } - - @Override - public void writeFooter() throws IOException { - } - - @Override - public void close() throws IOException { - } - - @Override - public void flush() throws IOException { - } -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java deleted file mode 100644 index f51e659c..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.hamcrest.generator; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import static java.lang.reflect.Modifier.isPublic; -import static java.lang.reflect.Modifier.isStatic; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.util.Iterator; - -/** - * Reads a list of Hamcrest factory methods from a class, using standard Java reflection. - *

Usage

- *
- * for (FactoryMethod method : new ReflectiveFactoryReader(MyMatchers.class)) {
- *   ...
- * }
- * 
- *

All methods matching signature '@Factory public static Matcher blah(blah)' will be - * treated as factory methods. To change this behavior, override {@link #isFactoryMethod(Method)}. - *

Caveat: Reflection is hassle-free, but unfortunately cannot expose method parameter names or JavaDoc - * comments, making the sugar slightly more obscure. - * - * @author Joe Walnes - * @see SugarGenerator - * @see FactoryMethod - */ -public class ReflectiveFactoryReader implements Iterable { - - private final Class cls; - - private final ClassLoader classLoader; - - public ReflectiveFactoryReader(Class cls) { - this.cls = cls; - this.classLoader = cls.getClassLoader(); - } - - @Override - public Iterator iterator() { - return new Iterator() { - - private int currentMethod = -1; - private Method[] allMethods = cls.getMethods(); - - @Override - public boolean hasNext() { - while (true) { - currentMethod++; - if (currentMethod >= allMethods.length) { - return false; - } else if (isFactoryMethod(allMethods[currentMethod])) { - return true; - } // else carry on looping and try the next one. - } - } - - @Override - public FactoryMethod next() { - if (outsideArrayBounds()) { - throw new IllegalStateException("next() called without hasNext() check."); - } - return buildFactoryMethod(allMethods[currentMethod]); - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - private boolean outsideArrayBounds() { - return currentMethod < 0 || allMethods.length <= currentMethod; - } - }; - } - - /** - * Determine whether a particular method is classified as a matcher factory method. - *

- *

The rules for determining this are: - * 1. The method must be public static. - * 2. It must have a return type of org.hamcrest.Matcher (or something that extends this). - * 3. It must be marked with the org.hamcrest.Factory annotation. - *

- *

To use another set of rules, override this method. - */ - protected boolean isFactoryMethod(Method javaMethod) { - return isStatic(javaMethod.getModifiers()) - && isPublic(javaMethod.getModifiers()) - && hasFactoryAnnotation(javaMethod) - && !Void.TYPE.equals(javaMethod.getReturnType()); - } - - @SuppressWarnings("unchecked") - private boolean hasFactoryAnnotation(Method javaMethod) { - // We dynamically load the Factory class, to avoid a compile time - // dependency on org.hamcrest.Factory. This gets around - // a circular bootstrap issue (because generator is required to - // compile core). - try { - final Class factoryClass = classLoader.loadClass("org.hamcrest.Factory"); - if (!Annotation.class.isAssignableFrom(factoryClass)) { - throw new RuntimeException("Not an annotation class: " + factoryClass.getCanonicalName()); - } - return javaMethod.getAnnotation((Class)factoryClass) != null; - } catch (ClassNotFoundException e) { - throw new RuntimeException("Cannot load hamcrest core", e); - } - } - - private static FactoryMethod buildFactoryMethod(Method javaMethod) { - FactoryMethod result = new FactoryMethod( - classToString(javaMethod.getDeclaringClass()), - javaMethod.getName(), - classToString(javaMethod.getReturnType())); - - for (TypeVariable typeVariable : javaMethod.getTypeParameters()) { - boolean hasBound = false; - StringBuilder s = new StringBuilder(typeVariable.getName()); - for (Type bound : typeVariable.getBounds()) { - if (bound != Object.class) { - if (hasBound) { - s.append(" & "); - } else { - s.append(" extends "); - hasBound = true; - } - s.append(typeToString(bound)); - } - } - result.addGenericTypeParameter(s.toString()); - } - Type returnType = javaMethod.getGenericReturnType(); - if (returnType instanceof ParameterizedType) { - ParameterizedType parameterizedType = (ParameterizedType) returnType; - Type generifiedType = parameterizedType.getActualTypeArguments()[0]; - result.setGenerifiedType(typeToString(generifiedType)); - } - - int paramNumber = 0; - for (Type paramType : javaMethod.getGenericParameterTypes()) { - String type = typeToString(paramType); - // Special case for var args methods.... String[] -> String... - if (javaMethod.isVarArgs() - && paramNumber == javaMethod.getParameterTypes().length - 1) { - type = type.replaceFirst("\\[\\]$", "..."); - } - result.addParameter(type, "param" + (++paramNumber)); - } - - for (Class exception : javaMethod.getExceptionTypes()) { - result.addException(typeToString(exception)); - } - - return result; - } - - /* - * Get String representation of Type (e.g. java.lang.String or Map<Stuff,? extends Cheese>). - *

- * Annoyingly this method wouldn't be needed if java.lang.reflect.Type.toString() behaved consistently - * across implementations. Rock on Liskov. - */ - private static String typeToString(Type type) { - return type instanceof Class ? classToString((Class) type): type.toString(); - } - - private static String classToString(Class cls) { - final String name = cls.isArray() ? cls.getComponentType().getName() + "[]" : cls.getName(); - return name.replace('$', '.'); - } - -} \ No newline at end of file diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarConfiguration.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarConfiguration.java deleted file mode 100644 index 1282d372..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarConfiguration.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.hamcrest.generator; - -public interface SugarConfiguration { - void addWriter(FactoryWriter factoryWriter); - - void addFactoryMethod(FactoryMethod method); - - void addFactoryMethods(Iterable methods); -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarGenerator.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarGenerator.java deleted file mode 100644 index 46cf8e49..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarGenerator.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.hamcrest.generator; - -import java.io.Closeable; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * API for syntactic sugar and wrapper code generation framework. - *

Generally, Matcher factory methods are defined all over the place, which makes it - * really hard to remember which methods need to be imported and doesn't allow you - * to easily browse a list of all of them. - *

This generates one uber matcher factory that delegates to all the respective classes. - *

Additionally, this allows the uber-classes to do things like wrap matchers in adapters - * (e.g. to make them EasyMock friendly) or even generate wrappers in other languages - * (such as JRuby or Jython). - *

You need to add at least one writer and at least one factory method for this to be - * any help. - *

Usage

- *
- * SugarGenerator sugarGenerator = new SugarGenerator();
- * try {
- *   // Write out sugar as standard Hamcrest factories.
- *   sugarGenerator.addWriter(
- *     new HamcrestFactoryWriter("com.some.package", "MyMatcherClass", new FileWriter(...)));
- *   // Also write out sugar as EasyMock compatible factories.
- *   sugarGenerator.addWriter(
- *     new EasyMockFactoryWriter("com.some.package", "MyEasyMatcherClass", new FileWriter(...)));
- *   // Add a load of Matcher factories to the generated sugar. The factory methods
- *   // are read via reflection.
- *   sugarGenerator.addFactoryMethods(new ReflectiveFactoryReader(IsIn.class));
- *   sugarGenerator.addFactoryMethods(new ReflectiveFactoryReader(IsSame.class));
- *   sugarGenerator.addFactoryMethods(new ReflectiveFactoryReader(IsNot.class));
- *   // Generate everything!
- *   sugarGenerator.generate();
- * } finally {
- *   // Clean up... close all streams.
- *   sugarGenerator.close();
- * }
- * - * @author Joe Walnes - * @see FactoryWriter - * @see HamcrestFactoryWriter - * @see ReflectiveFactoryReader - */ -public class SugarGenerator implements Closeable, SugarConfiguration { - - private final List factoryWriters = new ArrayList(); - private final List factoryMethods = new ArrayList(); - - /** - * Add a writer of factories. - */ - @Override - public void addWriter(FactoryWriter factoryWriter) { - factoryWriters.add(factoryWriter); - } - - /** - * Add a FactoryMethod that will be generated in the sugar. - * - * @see ReflectiveFactoryReader - * @see FactoryMethod - */ - @Override - public void addFactoryMethod(FactoryMethod method) { - factoryMethods.add(method); - } - - /** - * Convient way to add multiple FactoryMethods. - * - * @see #addFactoryMethod(FactoryMethod) - */ - @Override - public void addFactoryMethods(Iterable methods) { - for (FactoryMethod method : methods) { - addFactoryMethod(method); - } - } - - /** - * Generate all the factory methods using all the writers. - * - * This should always happen AFTER adding factory methods and writers. - */ - public void generate() throws IOException { - for (FactoryWriter factoryWriter : factoryWriters) { - factoryWriter.writeHeader(); - for (FactoryMethod factoryMethod : factoryMethods) { - factoryWriter.writeMethod(factoryMethod.getName(), factoryMethod); - } - factoryWriter.writeFooter(); - factoryWriter.flush(); - } - } - - /** - * Close all underlying streams. Calling this means you don't have to explicitly - * keep track of all the File streams and close them. - */ - @Override - public void close() throws IOException { - for (FactoryWriter factoryWriter : factoryWriters) { - factoryWriter.close(); - } - } - -} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/config/XmlConfigurator.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/config/XmlConfigurator.java deleted file mode 100644 index 42306b63..00000000 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/config/XmlConfigurator.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.hamcrest.generator.config; - -import org.hamcrest.generator.HamcrestFactoryWriter; -import org.hamcrest.generator.QDoxFactoryReader; -import org.hamcrest.generator.QuickReferenceWriter; -import org.hamcrest.generator.ReflectiveFactoryReader; -import org.hamcrest.generator.SugarConfiguration; -import org.hamcrest.generator.SugarGenerator; -import org.hamcrest.generator.QDox; -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -public class XmlConfigurator { - - private final SugarConfiguration sugarConfiguration; - private final ClassLoader classLoader; - private final SAXParserFactory saxParserFactory; - private final QDox qdox; - - public XmlConfigurator(SugarConfiguration sugarConfiguration, ClassLoader classLoader) { - this.sugarConfiguration = sugarConfiguration; - this.classLoader = classLoader; - saxParserFactory = SAXParserFactory.newInstance(); - saxParserFactory.setNamespaceAware(true); - qdox = new QDox(); - } - - public void addSourceDir(File sourceDir) { - qdox.addSourceTree(sourceDir); - } - - public void load(InputSource inputSource) - throws ParserConfigurationException, SAXException, IOException { - SAXParser saxParser = saxParserFactory.newSAXParser(); - saxParser.parse(inputSource, new DefaultHandler() { - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - if (localName.equals("factory")) { - String className = attributes.getValue("class"); - try { - addClass(className); - } catch (ClassNotFoundException e) { - throw new SAXException("Cannot find Matcher class : " + className); - } - } - } - }); - } - - private void addClass(String className) throws ClassNotFoundException { - Class cls = classLoader.loadClass(className); - sugarConfiguration.addFactoryMethods( - new QDoxFactoryReader(new ReflectiveFactoryReader(cls), qdox, className)); - } - - - public static void main(String[] args) throws Exception { - - if (args.length != 4) { - System.err.println("Args: config-file source-dir generated-class output-dir"); - System.err.println(""); - System.err.println(" config-file : Path to config file listing matchers to generate sugar for."); - System.err.println(" e.g. path/to/matchers.xml"); - System.err.println(""); - System.err.println(" source-dir : Path to Java source containing matchers to generate sugar for."); - System.err.println(" May contain multiple paths, separated by commas."); - System.err.println(" e.g. src/java,src/more-java"); - System.err.println(""); - System.err.println("generated-class : Full name of class to generate."); - System.err.println(" e.g. org.myproject.MyMatchers"); - System.err.println(""); - System.err.println(" output-dir : Where to output generated code (package subdirs will be"); - System.err.println(" automatically created)."); - System.err.println(" e.g. build/generated-code"); - System.exit(-1); - } - - String configFile = args[0]; - String srcDirs = args[1]; - String fullClassName = args[2]; - File outputDir = new File(args[3]); - - String fileName = fullClassName.replace('.', File.separatorChar) + ".java"; - int dotIndex = fullClassName.lastIndexOf("."); - String packageName = dotIndex == -1 ? "" : fullClassName.substring(0, dotIndex); - String shortClassName = fullClassName.substring(dotIndex + 1); - - if (!outputDir.isDirectory()) { - System.err.println("Output directory not found : " + outputDir.getAbsolutePath()); - System.exit(-1); - } - - File outputFile = new File(outputDir, fileName); - outputFile.getParentFile().mkdirs(); - - SugarGenerator sugarGenerator = new SugarGenerator(); - try { - sugarGenerator.addWriter(new HamcrestFactoryWriter( - packageName, shortClassName, new FileWriter(outputFile))); - sugarGenerator.addWriter(new QuickReferenceWriter(System.out)); - - XmlConfigurator xmlConfigurator - = new XmlConfigurator(sugarGenerator, XmlConfigurator.class.getClassLoader()); - - if (srcDirs.trim().length() > 0) { - for (String srcDir : srcDirs.split(",")) { - xmlConfigurator.addSourceDir(new File(srcDir)); - } - } - xmlConfigurator.load(new InputSource(configFile)); - - System.out.println("Generating " + fullClassName); - sugarGenerator.generate(); - } finally { - sugarGenerator.close(); - } - } -} diff --git a/hamcrest-integration/hamcrest-integration.gradle b/hamcrest-integration/hamcrest-integration.gradle new file mode 100644 index 00000000..c327791b --- /dev/null +++ b/hamcrest-integration/hamcrest-integration.gradle @@ -0,0 +1,15 @@ +version = '1.3.1-SNAPSHOT' + +dependencies { + api 'org.hamcrest:hamcrest-library:1.3' + api 'org.easymock:easymock:2.2' + api('jmock:jmock:1.1.0') { + transitive = false + } + + testImplementation(group: 'junit', name: 'junit', version: '4.12') { + transitive = false + } +} + +javadoc.title = "Hamcrest Integration $version API" diff --git a/hamcrest-integration/src/main/hamcrest-integration.iml b/hamcrest-integration/src/main/hamcrest-integration.iml deleted file mode 100644 index 62cfcd32..00000000 --- a/hamcrest-integration/src/main/hamcrest-integration.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java b/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java index 0fd5c5a8..936aa7d5 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java @@ -1,17 +1,17 @@ -package org.hamcrest; - -import org.hamcrest.integration.EasyMock2Adapter; -import org.hamcrest.core.IsEqual; - -/** - * - * @author Joe Walnes - */ -public class EasyMock2Matchers { - - public static String equalTo(String string) { - EasyMock2Adapter.adapt(IsEqual.equalTo(string)); - return null; - } - -} +package org.hamcrest; + +import org.hamcrest.integration.EasyMock2Adapter; +import org.hamcrest.core.IsEqual; + +/** + * + * @author Joe Walnes + */ +public class EasyMock2Matchers { + + public static String equalTo(String string) { + EasyMock2Adapter.adapt(IsEqual.equalTo(string)); + return null; + } + +} diff --git a/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java b/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java index 17ef59d0..6aac6f87 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java @@ -1,12 +1,12 @@ -package org.hamcrest; - -import org.hamcrest.integration.JMock1Adapter; -import org.hamcrest.core.IsEqual; -import org.jmock.core.Constraint; - -public class JMock1Matchers { - - public static Constraint equalTo(String string) { - return JMock1Adapter.adapt(IsEqual.equalTo(string)); - } -} +package org.hamcrest; + +import org.hamcrest.integration.JMock1Adapter; +import org.hamcrest.core.IsEqual; +import org.jmock.core.Constraint; + +public class JMock1Matchers { + + public static Constraint equalTo(String string) { + return JMock1Adapter.adapt(IsEqual.equalTo(string)); + } +} diff --git a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java index d114d71f..6cc97e81 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java @@ -1,18 +1,18 @@ -package org.hamcrest; - -/** - * Integration method for use with Java's assert keyword. - * Example: - *
- * assert that("Foo", startsWith("f"));
- * 
- * - * @author Neil Dunn - */ -public class JavaLangMatcherAssert { - private JavaLangMatcherAssert() {}; - - public static boolean that(T argument, Matcher matcher) { - return matcher.matches(argument); - } -} +package org.hamcrest; + +/** + * Integration method for use with Java's assert keyword. + * Example: + *
+ * assert that("Foo", startsWith("f"));
+ * 
+ * + * @author Neil Dunn + */ +public class JavaLangMatcherAssert { + private JavaLangMatcherAssert() {}; + + public static boolean that(T argument, Matcher matcher) { + return matcher.matches(argument); + } +} 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 4aee6958..09ab0f7d 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java @@ -1,43 +1,43 @@ -package org.hamcrest.integration; - -import org.easymock.IArgumentMatcher; -import org.easymock.EasyMock; -import org.hamcrest.Matcher; -import org.hamcrest.StringDescription; - -/** - * An adapter allowing a Hamcrest {@link org.hamcrest.Matcher} - * to act as an EasyMock {@link org.easymock.IArgumentMatcher}. - * - * @author Joe Walnes - */ -public class EasyMock2Adapter implements IArgumentMatcher { - - /** - * Convenience factory method that will adapt a - * 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. - */ - public static IArgumentMatcher adapt(Matcher matcher) { - EasyMock2Adapter easyMock2Matcher = new EasyMock2Adapter(matcher); - EasyMock.reportMatcher(easyMock2Matcher); - return easyMock2Matcher; - } - - private final Matcher hamcrestMatcher; - - public EasyMock2Adapter(Matcher matcher) { - this.hamcrestMatcher = matcher; - } - - @Override - public boolean matches(Object argument) { - return hamcrestMatcher.matches(argument); - } - - @Override - public void appendTo(StringBuffer buffer) { - hamcrestMatcher.describeTo(new StringDescription(buffer)); - } -} +package org.hamcrest.integration; + +import org.easymock.IArgumentMatcher; +import org.easymock.EasyMock; +import org.hamcrest.Matcher; +import org.hamcrest.StringDescription; + +/** + * An adapter allowing a Hamcrest {@link org.hamcrest.Matcher} + * to act as an EasyMock {@link org.easymock.IArgumentMatcher}. + * + * @author Joe Walnes + */ +public class EasyMock2Adapter implements IArgumentMatcher { + + /** + * Convenience factory method that will adapt a + * 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. + */ + public static IArgumentMatcher adapt(Matcher matcher) { + EasyMock2Adapter easyMock2Matcher = new EasyMock2Adapter(matcher); + EasyMock.reportMatcher(easyMock2Matcher); + return easyMock2Matcher; + } + + private final Matcher hamcrestMatcher; + + public EasyMock2Adapter(Matcher matcher) { + this.hamcrestMatcher = matcher; + } + + @Override + public boolean matches(Object argument) { + return hamcrestMatcher.matches(argument); + } + + @Override + public void appendTo(StringBuffer buffer) { + hamcrestMatcher.describeTo(new StringDescription(buffer)); + } +} 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 364ad8de..fa2021ce 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java @@ -1,42 +1,42 @@ -package org.hamcrest.integration; - -import org.jmock.core.Constraint; -import org.hamcrest.Matcher; -import org.hamcrest.StringDescription; - -/** - * An adapter allowing a Hamcrest {@link org.hamcrest.Matcher} - * to act as an jMock1 {@link org.jmock.core.Constraint}. - * Note, this is not necessary for jMock2 as it supports Hamcrest - * out of the box. - * - * @author Joe Walnes - */ -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}. - */ - public static Constraint adapt(Matcher matcher) { - return new JMock1Adapter(matcher); - } - - private final Matcher hamcrestMatcher; - - public JMock1Adapter(Matcher matcher) { - this.hamcrestMatcher = matcher; - } - - @Override - public boolean eval(Object o) { - return hamcrestMatcher.matches(o); - } - - @Override - public StringBuffer describeTo(StringBuffer buffer) { - hamcrestMatcher.describeTo(new StringDescription(buffer)); - return buffer; - } -} +package org.hamcrest.integration; + +import org.jmock.core.Constraint; +import org.hamcrest.Matcher; +import org.hamcrest.StringDescription; + +/** + * An adapter allowing a Hamcrest {@link org.hamcrest.Matcher} + * to act as an jMock1 {@link org.jmock.core.Constraint}. + * Note, this is not necessary for jMock2 as it supports Hamcrest + * out of the box. + * + * @author Joe Walnes + */ +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}. + */ + public static Constraint adapt(Matcher matcher) { + return new JMock1Adapter(matcher); + } + + private final Matcher hamcrestMatcher; + + public JMock1Adapter(Matcher matcher) { + this.hamcrestMatcher = matcher; + } + + @Override + public boolean eval(Object o) { + return hamcrestMatcher.matches(o); + } + + @Override + public StringBuffer describeTo(StringBuffer buffer) { + hamcrestMatcher.describeTo(new StringDescription(buffer)); + return buffer; + } +} diff --git a/hamcrest-library/hamcrest-library.gradle b/hamcrest-library/hamcrest-library.gradle new file mode 100644 index 00000000..fd8d19d1 --- /dev/null +++ b/hamcrest-library/hamcrest-library.gradle @@ -0,0 +1,17 @@ +dependencies { + api project(':hamcrest-core') +} + +jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Vendor': 'hamcrest.org', + 'Implementation-Version': version, + 'Automatic-Module-Name': 'org.hamcrest.library.deprecated' + } +} + +javadoc { + title = "Hamcrest Library $version API" + options.showFromPackage() +} diff --git a/hamcrest-library/src/main/hamcrest-library.iml b/hamcrest-library/src/main/hamcrest-library.iml deleted file mode 100644 index 2bfd545c..00000000 --- a/hamcrest-library/src/main/hamcrest-library.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContaining.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContaining.java deleted file mode 100644 index ee17b410..00000000 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContaining.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.hamcrest.collection; - -import java.util.Arrays; - -import org.hamcrest.Description; -import org.hamcrest.Matcher; -import org.hamcrest.Factory; -import org.hamcrest.TypeSafeMatcher; -import static org.hamcrest.core.IsEqual.equalTo; - -/** - * Matches if an array contains an item satisfying a nested matcher. - */ -public class IsArrayContaining extends TypeSafeMatcher { - private final Matcher elementMatcher; - - public IsArrayContaining(Matcher elementMatcher) { - this.elementMatcher = elementMatcher; - } - - @Override - public boolean matchesSafely(T[] array) { - for (T item : array) { - if (elementMatcher.matches(item)) { - return true; - } - } - return false; - } - - @Override - public void describeMismatchSafely(T[] item, Description mismatchDescription) { - super.describeMismatch(Arrays.asList(item), mismatchDescription); - }; - - @Override - public void describeTo(Description description) { - description - .appendText("an array containing ") - .appendDescriptionOf(elementMatcher); - } - - /** - * 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: - *

assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
- * - * @param elementMatcher - * the matcher to apply to elements in examined arrays - */ - @Factory - public static Matcher hasItemInArray(Matcher elementMatcher) { - return new IsArrayContaining(elementMatcher); - } - - /** - * A shortcut to the frequently used hasItemInArray(equalTo(x)). - *

- * For example: - *

assertThat(hasItemInArray(x))
- * instead of: - *
assertThat(hasItemInArray(equalTo(x)))
- * - * @param element - * the element that should be present in examined arrays - */ - @Factory - public static Matcher hasItemInArray(T element) { - Matcher matcher = equalTo(element); - return IsArrayContaining.hasItemInArray(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 new file mode 100644 index 00000000..b7ec20c3 --- /dev/null +++ b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/HamcrestLibraryIsDeprecated.java @@ -0,0 +1,9 @@ +package org.hamcrest.library.deprecated; + +/** + * All the classes in hamcrest-library.jar have moved to + * hamcrest.jar. Please use that dependency instead. + */ +@Deprecated +class HamcrestLibraryIsDeprecated { +} 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 new file mode 100644 index 00000000..c98f5aff --- /dev/null +++ b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java @@ -0,0 +1,5 @@ +/** + * All classes in hamcrest-library.jar have been migrated to + * hamcrest.jar. Please use that dependency instead. + */ +package org.hamcrest.library.deprecated; \ No newline at end of file diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java b/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java deleted file mode 100644 index 9e7294d3..00000000 --- a/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright (c) 2000-2009 hamcrest.org - */ -package org.hamcrest.number; - -import org.hamcrest.Description; -import org.hamcrest.Factory; -import org.hamcrest.Matcher; -import org.hamcrest.TypeSafeMatcher; - -import static java.lang.Integer.signum; - -public class OrderingComparison> extends TypeSafeMatcher { - private static final int LESS_THAN = -1; - private static final int GREATER_THAN = 1; - private static final int EQUAL = 0; - private final T expected; - private final int minCompare, maxCompare; - - private static final String[] comparisonDescriptions = { - "less than", - "equal to", - "greater than" - }; - - private OrderingComparison(T expected, int minCompare, int maxCompare) { - this.expected = expected; - this.minCompare = minCompare; - this.maxCompare = maxCompare; - } - - @Override - public boolean matchesSafely(T actual) { - int compare = signum(actual.compareTo(expected)); - return minCompare <= compare && compare <= maxCompare; - } - - @Override - public void describeMismatchSafely(T actual, Description mismatchDescription) { - mismatchDescription.appendValue(actual).appendText(" was ") - .appendText(asText(actual.compareTo(expected))) - .appendText(" ").appendValue(expected); - } - - @Override - public void describeTo(Description description) { - description.appendText("a value ").appendText(asText(minCompare)); - if (minCompare != maxCompare) { - description.appendText(" or ").appendText(asText(maxCompare)); - } - description.appendText(" ").appendValue(expected); - } - - private static String asText(int comparison) { - return comparisonDescriptions[signum(comparison) + 1]; - } - - /** - * Creates a matcher of {@link Comparable} object that matches when the examined object is - * equal to the specified value, as reported by the compareTo method of the - * examined object. - *

- * For example: - *

assertThat(1, comparesEqualTo(1))
- * - * @param value - * the value which, when passed to the compareTo method of the examined object, should return zero - * - */ - @Factory - public static > Matcher comparesEqualTo(T value) { - return new OrderingComparison(value, EQUAL, EQUAL); - } - - /** - * Creates a matcher of {@link Comparable} object that matches when the examined object is - * greater than the specified value, as reported by the compareTo method of the - * examined object. - *

- * For example: - *

assertThat(2, greaterThan(1))
- * - * @param value - * the value which, when passed to the compareTo method of the examined object, should return greater - * than zero - * - */ - @Factory - public static > Matcher greaterThan(T value) { - return new OrderingComparison(value, GREATER_THAN, GREATER_THAN); - } - - /** - * Creates a matcher of {@link Comparable} object that matches when the examined object is - * greater than or equal to the specified value, as reported by the compareTo method - * of the examined object. - *

- * For example: - *

assertThat(1, greaterThanOrEqualTo(1))
- * - * @param value - * the value which, when passed to the compareTo method of the examined object, should return greater - * than or equal to zero - * - */ - @Factory - public static > Matcher greaterThanOrEqualTo(T value) { - return new OrderingComparison(value, EQUAL, GREATER_THAN); - } - - /** - * Creates a matcher of {@link Comparable} object that matches when the examined object is - * less than the specified value, as reported by the compareTo method of the - * examined object. - *

- * For example: - *

assertThat(1, lessThan(2))
- * - * @param value - * the value which, when passed to the compareTo method of the examined object, should return less - * than zero - * - */ - @Factory - public static > Matcher lessThan(T value) { - return new OrderingComparison(value, LESS_THAN, LESS_THAN); - } - - /** - * Creates a matcher of {@link Comparable} object that matches when the examined object is - * less than or equal to the specified value, as reported by the compareTo method - * of the examined object. - *

- * For example: - *

assertThat(1, lessThanOrEqualTo(1))
- * - * @param value - * the value which, when passed to the compareTo method of the examined object, should return less - * than or equal to zero - * - */ - @Factory - public static > Matcher lessThanOrEqualTo(T value) { - return new OrderingComparison(value, LESS_THAN, EQUAL); - } -} diff --git a/hamcrest-library/src/main/resources/hamcrest-library-is-deprecated.txt b/hamcrest-library/src/main/resources/hamcrest-library-is-deprecated.txt new file mode 100644 index 00000000..038467d2 --- /dev/null +++ b/hamcrest-library/src/main/resources/hamcrest-library-is-deprecated.txt @@ -0,0 +1,5 @@ +Hamcrest Library +================ + +All the classes in hamcrest-core.jar and hamcrest-library.jar has moved +into hamcrest.jar. Please update your dependencies. \ No newline at end of file diff --git a/hamcrest-unit-test/src/main/hamcrest-unit-tests.iml b/hamcrest-unit-test/src/main/hamcrest-unit-tests.iml deleted file mode 100644 index 50fcbd6f..00000000 --- a/hamcrest-unit-test/src/main/hamcrest-unit-tests.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/AbstractMatcherTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/AbstractMatcherTest.java deleted file mode 100644 index 0032d821..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/AbstractMatcherTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest; - -import junit.framework.TestCase; -import org.junit.Assert; - -public abstract class AbstractMatcherTest extends TestCase { - - /** - * Create an instance of the Matcher so some generic safety-net tests can be run on it. - */ - protected abstract Matcher createMatcher(); - - public static void assertMatches(String message, Matcher c, T arg) { - Assert.assertTrue(message, c.matches(arg)); - } - - public static void assertDoesNotMatch(String message, Matcher c, T arg) { - Assert.assertFalse(message, c.matches(arg)); - } - - public static void assertDescription(String expected, Matcher matcher) { - Description description = new StringDescription(); - description.appendDescriptionOf(matcher); - Assert.assertEquals("Expected description", expected, description.toString().trim()); - } - - public static void assertMismatchDescription(String expected, Matcher matcher, T arg) { - Assert.assertFalse("Precondtion: Matcher should not match item.", matcher.matches(arg)); - Description description = new StringDescription(); - matcher.describeMismatch(arg, description); - Assert.assertEquals("Expected mismatch description", expected, description.toString().trim()); - } - - public void testIsNullSafe() { - // should not throw a NullPointerException - createMatcher().matches(null); - } - - public void testCopesWithUnknownTypes() { - // should not throw ClassCastException - createMatcher().matches(new UnknownType()); - } - - public static class UnknownType { - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/BaseDescriptionTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/BaseDescriptionTest.java deleted file mode 100644 index b3a809bd..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/BaseDescriptionTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.hamcrest; - -import junit.framework.TestCase; - -public class BaseDescriptionTest extends TestCase { - - private final StringBuilder result = new StringBuilder(); - - private final BaseDescription baseDescription = new BaseDescription() { - @Override protected void append(char c) { - result.append(c); - } - }; - - public void testDescribesAppendedNullValue() { - baseDescription.appendValue(null); - assertEquals("null", result.toString()); - } - - public void testQuotesAppendedStringValue() { - baseDescription.appendValue("foo"); - assertEquals("\"foo\"", result.toString()); - } - - public void testQuotesAppendedCharacterValue() { - baseDescription.appendValue('f'); - assertEquals("\"f\"", result.toString()); - } - - public void testBracketsAppendedShortValue() { - baseDescription.appendValue(Short.valueOf("2")); - assertEquals("<2s>", result.toString()); - } - - public void testBracketsAppendedLongValue() { - baseDescription.appendValue(Long.valueOf("2")); - assertEquals("<2L>", result.toString()); - } - - public void testBracketsAppendedFloatValue() { - baseDescription.appendValue(Float.valueOf("1.2")); - assertEquals("<1.2F>", result.toString()); - } - - public void testDescribesAppendedArrayValue() { - baseDescription.appendValue(new String[] {"2", "3"}); - assertEquals("[\"2\", \"3\"]", result.toString()); - } - - public void testBracketsAppendedObjectValue() { - final Object value = new Object(); - baseDescription.appendValue(value); - assertEquals("<" + value.toString() + ">", result.toString()); - } - - public void testSafelyDescribesAppendedValueOfObjectWhoseToStringThrowsAnException() { - final Object value = new Object() { - @Override public String toString() { - throw new UnsupportedOperationException(); - } - }; - - final String expected = value.getClass().getName() + "@" + Integer.toHexString(value.hashCode()); - baseDescription.appendValue(value); - assertEquals("<" + expected + ">", result.toString()); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/CustomTypeSafeMatcherTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/CustomTypeSafeMatcherTest.java deleted file mode 100644 index bdeb3c4e..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/CustomTypeSafeMatcherTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.hamcrest; - -public class CustomTypeSafeMatcherTest extends AbstractMatcherTest { - private static final String STATIC_DESCRIPTION = "I match non empty strings"; - private Matcher customMatcher; - - @Override - protected void setUp() throws Exception { - customMatcher = new CustomTypeSafeMatcher(STATIC_DESCRIPTION) { - @Override - public boolean matchesSafely(String item) { - return false; - } - - @Override - public void describeMismatchSafely(String item, Description mismatchDescription) { - mismatchDescription.appendText("an " + item); - } - }; - } - - public void testUsesStaticDescription() throws Exception { - assertDescription(STATIC_DESCRIPTION, customMatcher); - } - - public void testReportsMismatch() { - assertMismatchDescription("an item", customMatcher, "item"); - } - - @Override - protected Matcher createMatcher() { - return customMatcher; - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/FeatureMatcherTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/FeatureMatcherTest.java deleted file mode 100644 index 794f22a4..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/FeatureMatcherTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.hamcrest; - -import static org.hamcrest.AbstractMatcherTest.assertDescription; -import static org.hamcrest.AbstractMatcherTest.assertMatches; -import static org.hamcrest.AbstractMatcherTest.assertMismatchDescription; -import junit.framework.TestCase; - -import org.hamcrest.core.IsEqual; - -public class FeatureMatcherTest extends TestCase { - private final FeatureMatcher resultMatcher = resultMatcher(); - - public void testMatchesPartOfAnObject() { - assertMatches("feature", resultMatcher, new Thingy("bar")); - assertDescription("Thingy with result \"bar\"", resultMatcher); - } - - public void testMismatchesPartOfAnObject() { - assertMismatchDescription("result mismatch-description", resultMatcher, new Thingy("foo")); - } - - public void testDoesNotThrowNullPointerException() { - assertMismatchDescription("was null", resultMatcher, null); - } - - public void testDoesNotThrowClassCastException() { - resultMatcher.matches(new ShouldNotMatch()); - StringDescription mismatchDescription = new StringDescription(); - resultMatcher.describeMismatch(new ShouldNotMatch(), mismatchDescription); - assertEquals("was ", mismatchDescription.toString()); - } - - - public static class Match extends IsEqual { - public Match(String equalArg) { super(equalArg); } - @Override public void describeMismatch(Object item, Description description) { - description.appendText("mismatch-description"); - } - } - public static class Thingy { - private final String result; - - public Thingy(String result) { - this.result = result; - } - - public String getResult() { - return result; - } - } - - public static class ShouldNotMatch { - @Override public String toString() { return "ShouldNotMatch"; } - } - - private static FeatureMatcher resultMatcher() { - return new FeatureMatcher(new Match("bar"), "Thingy with result", "result") { - @Override - public String featureValueOf(Thingy actual) { - return actual.getResult(); - } - }; - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/JavaLangMatcherAssertTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/JavaLangMatcherAssertTest.java deleted file mode 100644 index dd5e65f9..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/JavaLangMatcherAssertTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.hamcrest; - -import static org.hamcrest.JavaLangMatcherAssert.that; -import static org.hamcrest.core.StringStartsWith.startsWith; -import junit.framework.TestCase; - -public class JavaLangMatcherAssertTest extends TestCase { - public void testWouldCauseFailingAssertion() throws Exception { - assertEquals(false, that("Foo", startsWith("Bar"))); - } - - public void testWouldCausePassingAssertion() throws Exception { - assertEquals(true, that("Foo", startsWith("F"))); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/MatcherAssertTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/MatcherAssertTest.java deleted file mode 100644 index 35c59098..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/MatcherAssertTest.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.hamcrest; - -import junit.framework.TestCase; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsEqual.equalTo; - -public class MatcherAssertTest extends TestCase { - - public void testIncludesDescriptionOfTestedValueInErrorMessage() { - String expected = "expected"; - String actual = "actual"; - - String expectedMessage = "identifier\nExpected: \"expected\"\n but: was \"actual\""; - - try { - assertThat("identifier", actual, equalTo(expected)); - } - catch (AssertionError e) { - assertTrue(e.getMessage().startsWith(expectedMessage)); - return; - } - - fail("should have failed"); - } - - public void testDescriptionCanBeElided() { - String expected = "expected"; - String actual = "actual"; - - String expectedMessage = "\nExpected: \"expected\"\n but: was \"actual\""; - - try { - assertThat(actual, equalTo(expected)); - } - catch (AssertionError e) { - assertTrue(e.getMessage().startsWith(expectedMessage)); - return; - } - - fail("should have failed"); - } - - public void testCanTestBooleanDirectly() { - assertThat("success reason message", true); - - try { - assertThat("failing reason message", false); - } - catch (AssertionError e) { - assertEquals("failing reason message", e.getMessage()); - return; - } - - fail("should have failed"); - } - - public void testIncludesMismatchDescription() { - Matcher matcherWithCustomMismatchDescription = new BaseMatcher() { - @Override - public boolean matches(Object item) { - return false; - } - - @Override - public void describeTo(Description description) { - description.appendText("Something cool"); - } - - @Override - public void describeMismatch(Object item, Description mismatchDescription) { - mismatchDescription.appendText("Not cool"); - } - }; - - String expectedMessage = "\nExpected: Something cool\n but: Not cool"; - - try { - assertThat("Value", matcherWithCustomMismatchDescription); - fail("should have failed"); - } - catch (AssertionError e) { - assertEquals(expectedMessage, e.getMessage()); - } - } - - - public void testCanAssertSubtypes() { - Integer aSub = new Integer(1); - Number aSuper = aSub; - - assertThat(aSub, equalTo(aSuper)); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/beans/HasPropertyTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/beans/HasPropertyTest.java deleted file mode 100644 index 937f82ba..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/beans/HasPropertyTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.beans; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.beans.HasProperty.hasProperty; -import static org.hamcrest.core.IsNot.not; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -/** - * @author Iain McGinniss - * @author Nat Pryce - * @author Steve Freeman - * @since 1.1.0 - */ -public class HasPropertyTest extends AbstractMatcherTest { - - private final HasPropertyWithValueTest.BeanWithoutInfo bean - = new HasPropertyWithValueTest.BeanWithoutInfo("a bean"); - - @Override - protected Matcher createMatcher() { - return hasProperty("irrelevant"); - } - - public void testReturnsTrueIfPropertyExists() { - assertThat(bean, hasProperty("writeOnlyProperty")); - } - - public void testReturnsFalseIfPropertyDoesNotExist() { - final Matcher hasProperty = hasProperty("aNonExistentProp"); - assertThat(bean, not(hasProperty)); - assertMismatchDescription("no \"aNonExistentProp\" in <[Person: a bean]>", hasProperty, bean); - } - - public void testDescribeTo() { - assertDescription("hasProperty(\"property\")", hasProperty("property")); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/AllOfTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/AllOfTest.java deleted file mode 100644 index 03ce7787..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/AllOfTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (c) 2000-2010 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.AllOf.allOf; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.hamcrest.core.StringStartsWith.startsWith; - -public class AllOfTest extends AbstractMatcherTest { - - @Override - @SuppressWarnings("unchecked") - protected Matcher createMatcher() { - return allOf(IsEqual.equalTo("irrelevant")); - } - - public void testEvaluatesToTheTheLogicalConjunctionOfTwoOtherMatchers() { - assertThat("good", allOf(equalTo("good"), startsWith("good"))); - - assertThat("good", not(allOf(equalTo("bad"), equalTo("good")))); - assertThat("good", not(allOf(equalTo("good"), equalTo("bad")))); - assertThat("good", not(allOf(equalTo("bad"), equalTo("bad")))); - } - - public void testEvaluatesToTheTheLogicalConjunctionOfManyOtherMatchers() { - assertThat("good", allOf(equalTo("good"), equalTo("good"), equalTo("good"), equalTo("good"), equalTo("good"))); - assertThat("good", not(allOf(equalTo("good"), equalTo("good"), equalTo("bad"), equalTo("good"), equalTo("good")))); - } - - public void testSupportsMixedTypes() { - final Matcher all = allOf( - equalTo(new SampleBaseClass("bad")), - is(notNullValue()), - equalTo(new SampleBaseClass("good")), - equalTo(new SampleSubClass("ugly"))); - final Matcher negated = not(all); - - assertThat(new SampleSubClass("good"), negated); - } - - public void testHasAReadableDescription() { - assertDescription("(\"good\" and \"bad\" and \"ugly\")", - allOf(equalTo("good"), equalTo("bad"), equalTo("ugly"))); - } - - public void testMismatchDescriptionDescribesFirstFailingMatch() { - assertMismatchDescription("\"good\" was \"bad\"", allOf(equalTo("bad"), equalTo("good")), "bad"); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/AnyOfTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/AnyOfTest.java deleted file mode 100644 index 63311ea7..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/AnyOfTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2000-2010 hamcrest.org - */ -package org.hamcrest.core; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.AnyOf.anyOf; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -public class AnyOfTest extends AbstractMatcherTest { - - @Override - @SuppressWarnings("unchecked") - protected Matcher createMatcher() { - return anyOf(IsEqual.equalTo("irrelevant")); - } - - public void testEvaluatesToTheTheLogicalDisjunctionOfTwoOtherMatchers() { - assertThat("good", anyOf(equalTo("bad"), equalTo("good"))); - assertThat("good", anyOf(equalTo("good"), equalTo("good"))); - assertThat("good", anyOf(equalTo("good"), equalTo("bad"))); - - assertThat("good", not(anyOf(equalTo("bad"), equalTo("bad")))); - } - - public void testEvaluatesToTheTheLogicalDisjunctionOfManyOtherMatchers() { - assertThat("good", anyOf(equalTo("bad"), equalTo("good"), equalTo("bad"), equalTo("bad"), equalTo("bad"))); - assertThat("good", not(anyOf(equalTo("bad"), equalTo("bad"), equalTo("bad"), equalTo("bad"), equalTo("bad")))); - } - - @SuppressWarnings("unchecked") - public void testSupportsMixedTypes() { - final Matcher combined = anyOf( - equalTo(new SampleBaseClass("bad")), - equalTo(new SampleBaseClass("good")), - equalTo(new SampleSubClass("ugly")) - ); - - assertThat(new SampleSubClass("good"), combined); - } - - public void testHasAReadableDescription() { - assertDescription("(\"good\" or \"bad\" or \"ugly\")", - anyOf(equalTo("good"), equalTo("bad"), equalTo("ugly"))); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/CombinableTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/CombinableTest.java deleted file mode 100644 index 2bcdd474..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/CombinableTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.hamcrest.core; - -import org.junit.Assert; -import org.junit.Test; - -import static org.hamcrest.AbstractMatcherTest.assertMismatchDescription; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.CombinableMatcher.both; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.hamcrest.number.OrderingComparison.greaterThan; -import static org.junit.Assert.assertEquals; - -public class CombinableTest { - private static final CombinableMatcher EITHER_3_OR_4 = CombinableMatcher.either(equalTo(3)).or(equalTo(4)); - private static final CombinableMatcher NOT_3_AND_NOT_4 = CombinableMatcher.both(not(equalTo(3))).and(not(equalTo(4))); - - @Test - public void bothAcceptsAndRejects() { - assertThat(2, NOT_3_AND_NOT_4); - assertThat(3, not(NOT_3_AND_NOT_4)); - } - - @Test - public void acceptsAndRejectsThreeAnds() { - CombinableMatcher tripleAnd = NOT_3_AND_NOT_4.and(equalTo(2)); - assertThat(2, tripleAnd); - assertThat(3, not(tripleAnd)); - } - - - @Test - public void bothDescribesItself() { - assertEquals("(not <3> and not <4>)", NOT_3_AND_NOT_4.toString()); - assertMismatchDescription("not <3> was <3>", NOT_3_AND_NOT_4, 3); - } - - @Test - public void eitherAcceptsAndRejects() { - assertThat(3, EITHER_3_OR_4); - assertThat(6, not(EITHER_3_OR_4)); - } - - @Test - public void acceptsAndRejectsThreeOrs() { - final CombinableMatcher orTriple = EITHER_3_OR_4.or(greaterThan(10)); - assertThat(11, orTriple); - assertThat(9, not(orTriple)); - } - - @Test - public void eitherDescribesItself() { - Assert.assertEquals("(<3> or <4>)", EITHER_3_OR_4.toString()); - assertMismatchDescription("was <6>", EITHER_3_OR_4, 6); - } - - @Test - public void picksUpTypeFromLeftHandSideOfExpression() { - assertThat("yellow", both(equalTo("yellow")).and(notNullValue())); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/DescribedAsTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/DescribedAsTest.java deleted file mode 100644 index 7a2fcf79..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/DescribedAsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import org.hamcrest.StringDescription; - -import static org.hamcrest.core.DescribedAs.describedAs; -import static org.hamcrest.core.IsAnything.anything; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; - -public class DescribedAsTest extends AbstractMatcherTest { - @Override - protected Matcher createMatcher() { - return describedAs("irrelevant", anything()); - } - - public void testOverridesDescriptionOfOtherMatcherWithThatPassedToConstructor() { - Matcher m1 = describedAs("m1 description", anything()); - Matcher m2 = describedAs("m2 description", not(anything())); - - assertDescription("m1 description", m1); - assertDescription("m2 description", m2); - } - - public void testAppendsValuesToDescription() { - Matcher m = describedAs("value 1 = %0, value 2 = %1", - anything(), 33, 97); - - assertDescription("value 1 = <33>, value 2 = <97>", m); - } - - public void testDelegatesMatchingToAnotherMatcher() { - Matcher m1 = describedAs("irrelevant", anything()); - Matcher m2 = describedAs("irrelevant", not(anything())); - - assertTrue(m1.matches(new Object())); - assertFalse(m2.matches("hi")); - } - - public void testDelegatesMismatchDescriptionToAnotherMatcher() { - Matcher m1 = describedAs("irrelevant", equalTo(2)); - - StringDescription description = new StringDescription(); - m1.describeMismatch(1, description); - - assertEquals("was <1>", description.toString()); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/EveryTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/EveryTest.java deleted file mode 100644 index 28e91a32..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/EveryTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.hamcrest.core; - -import org.hamcrest.StringDescription; -import org.junit.Test; - -import java.util.ArrayList; - -import static java.util.Arrays.asList; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.assertEquals; - -public class EveryTest { - @Test public void isTrueWhenEveryValueMatches() { - assertThat(asList("AaA", "BaB", "CaC"), Every.everyItem(containsString("a"))); - assertThat(asList("AbA", "BbB", "CbC"), not(Every.everyItem(containsString("a")))); - } - - @Test public void isAlwaysTrueForEmptyLists() { - assertThat(new ArrayList(), Every.everyItem(containsString("a"))); - } - - @Test public void describesItself() { - final Every each= new Every(containsString("a")); - assertEquals("every item is a string containing \"a\"", each.toString()); - - StringDescription description = new StringDescription(); - each.matchesSafely(asList("BbB"), description); - assertEquals("an item was \"BbB\"", description.toString()); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsAnythingTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsAnythingTest.java deleted file mode 100644 index 8d2b447b..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsAnythingTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2000-2010 hamcrest.org - */ -package org.hamcrest.core; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsAnything.anything; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -public class IsAnythingTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - return anything(); - } - - public void testAlwaysEvaluatesToTrue() { - assertThat(null, anything()); - assertThat(new Object(), anything()); - assertThat("hi", anything()); - } - - public void testHasUsefulDefaultDescription() { - assertDescription("ANYTHING", anything()); - } - - public void testCanOverrideDescription() { - String description = "description"; - assertDescription(description, anything(description)); - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsEqualTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsEqualTest.java deleted file mode 100644 index a44b35dc..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsEqualTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; - - -public class IsEqualTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - return equalTo("irrelevant"); - } - - public void testComparesObjectsUsingEqualsMethod() { - assertThat("hi", equalTo("hi")); - assertThat("bye", not(equalTo("hi"))); - - assertThat(1, equalTo(1)); - assertThat(1, not(equalTo(2))); - } - - public void testCanCompareNullValues() { - assertThat(null, equalTo(null)); - - assertThat(null, not(equalTo("hi"))); - assertThat("hi", not(equalTo(null))); - } - - public void testHonoursIsEqualImplementationEvenWithNullValues() { - Object alwaysEqual = new Object() { - @Override - public boolean equals(Object obj) { - return true; - } - }; - Object neverEqual = new Object() { - @Override - public boolean equals(Object obj) { - return false; - } - }; - - assertThat(alwaysEqual, equalTo(null)); - assertThat(neverEqual, not(equalTo(null))); - } - - public void testComparesTheElementsOfAnObjectArray() { - String[] s1 = {"a", "b"}; - String[] s2 = {"a", "b"}; - String[] s3 = {"c", "d"}; - String[] s4 = {"a", "b", "c", "d"}; - - assertThat(s1, equalTo(s1)); - assertThat(s2, equalTo(s1)); - assertThat(s3, not(equalTo(s1))); - assertThat(s4, not(equalTo(s1))); - } - - public void testComparesArraysToNull() { - assertThat(new String[]{"a", "b"}, not(equalTo(null))); - assertThat(null, not(equalTo(new String[]{"a", "b"}))); - } - - public void testComparesTheElementsOfAnArrayOfPrimitiveTypes() { - int[] i1 = new int[]{1, 2}; - int[] i2 = new int[]{1, 2}; - int[] i3 = new int[]{3, 4}; - int[] i4 = new int[]{1, 2, 3, 4}; - - assertThat(i1, equalTo(i1)); - assertThat(i2, equalTo(i1)); - assertThat(i3, not(equalTo(i1))); - assertThat(i4, not(equalTo(i1))); - } - - public void testRecursivelyTestsElementsOfArrays() { - int[][] i1 = new int[][]{{1, 2}, {3, 4}}; - int[][] i2 = new int[][]{{1, 2}, {3, 4}}; - int[][] i3 = new int[][]{{5, 6}, {7, 8}}; - int[][] i4 = new int[][]{{1, 2, 3, 4}, {3, 4}}; - - assertThat(i1, equalTo(i1)); - assertThat(i2, equalTo(i1)); - assertThat(i3, not(equalTo(i1))); - assertThat(i4, not(equalTo(i1))); - } - - public void testIncludesTheResultOfCallingToStringOnItsArgumentInTheDescription() { - final String argumentDescription = "ARGUMENT DESCRIPTION"; - Object argument = new Object() { - @Override - public String toString() { - return argumentDescription; - } - }; - assertDescription("<" + argumentDescription + ">", equalTo(argument)); - } - - public void testReturnsAnObviousDescriptionIfCreatedWithANestedMatcherByMistake() { - Matcher innerMatcher = equalTo("NestedMatcher"); - assertDescription("<" + innerMatcher.toString() + ">", equalTo(innerMatcher)); - } - - public void testReturnsGoodDescriptionIfCreatedWithNullReference() { - assertDescription("null", equalTo(null)); - } -} - diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsInstanceOfTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsInstanceOfTest.java deleted file mode 100644 index aec72cd4..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsInstanceOfTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (c) 2000-2010 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsInstanceOf.*; -import static org.hamcrest.core.IsNot.not; - -public class IsInstanceOfTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - return instanceOf(Number.class); - } - - public void testEvaluatesToTrueIfArgumentIsInstanceOfASpecificClass() { - assertThat(1, instanceOf(Number.class)); - assertThat(1.0, instanceOf(Number.class)); - assertThat(null, not(instanceOf(Number.class))); - assertThat(new Object(), not(instanceOf(Number.class))); - } - - public void testHasAReadableDescription() { - assertDescription("an instance of java.lang.Number", instanceOf(Number.class)); - } - - public void testDecribesActualClassInMismatchMessage() { - assertMismatchDescription("\"some text\" is a java.lang.String", instanceOf(Number.class), "some text"); - } - - public void testMatchesPrimitiveTypes() { - assertThat(true, any(boolean.class)); - assertThat((byte)1, any(byte.class)); - assertThat('x', any(char.class)); - assertThat(5.0, any(double.class)); - assertThat(5.0f, any(float.class)); - assertThat(2, any(int.class)); - assertThat(4L, any(long.class)); - assertThat((short)1, any(short.class)); - } - - public void testInstanceOfRequiresACastToReturnTheCorrectTypeForUseInJMock() { - @SuppressWarnings("unused") - Integer anInteger = (Integer)with(instanceOf(Integer.class)); - } - - public void testAnyWillReturnTheCorrectTypeForUseInJMock() { - @SuppressWarnings("unused") - Integer anInteger = with(any(Integer.class)); - } - - - private static T with(@SuppressWarnings("unused") Matcher matcher) { - return null; - } - -} - diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsNotTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsNotTest.java deleted file mode 100644 index 8b631d00..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsNotTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2000-2009 hamcrest.org - */ -package org.hamcrest.core; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.number.OrderingComparison.greaterThan; - -public class IsNotTest extends AbstractMatcherTest { - @Override - protected Matcher createMatcher() { - return not("something"); - } - - public void testEvaluatesToTheTheLogicalNegationOfAnotherMatcher() { - assertMatches("should match", not(equalTo("A")), "B"); - assertDoesNotMatch("should not match", not(equalTo("B")), "B"); - } - - public void testProvidesConvenientShortcutForNotEqualTo() { - assertMatches("should match", not("A"), "B"); - assertMatches("should match", not("B"), "A"); - assertDoesNotMatch("should not match", not("A"), "A"); - assertDoesNotMatch("should not match", not("B"), "B"); - } - - public void testUsesDescriptionOfNegatedMatcherWithPrefix() { - assertDescription("not a value greater than <2>", not(greaterThan(2))); - assertDescription("not \"A\"", not("A")); - } - } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsNullTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsNullTest.java deleted file mode 100644 index fc0028e4..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsNullTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2000-20010 hamcrest.org - */ -package org.hamcrest.core; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.hamcrest.core.IsNull.nullValue; - -import java.math.BigDecimal; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - - -public class IsNullTest extends AbstractMatcherTest { - private static final BigDecimal ANY_NON_NULL_ARGUMENT = new BigDecimal(66); - - @Override - protected Matcher createMatcher() { - return nullValue(); - } - - public void testEvaluatesToTrueIfArgumentIsNull() { - assertThat(null, nullValue()); - assertThat(ANY_NON_NULL_ARGUMENT, not(nullValue())); - - assertThat(ANY_NON_NULL_ARGUMENT, notNullValue()); - assertThat(null, not(notNullValue())); - } - - public void testSupportsStaticTyping() { - requiresStringMatcher(nullValue(String.class)); - requiresStringMatcher(notNullValue(String.class)); - } - - private void requiresStringMatcher(@SuppressWarnings("unused") Matcher arg) { - // no-op - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsSameTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsSameTest.java deleted file mode 100644 index a141153d..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsSameTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.core; - -import static org.hamcrest.core.IsSame.theInstance; -import static org.hamcrest.core.IsSame.sameInstance; -import static org.hamcrest.core.IsNot.not; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import static org.hamcrest.MatcherAssert.assertThat; - - -public class IsSameTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - return sameInstance("irrelevant"); - } - - public void testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject() { - Object o1 = new Object(); - Object o2 = new Object(); - - assertThat(o1, sameInstance(o1)); - assertThat(o2, not(sameInstance(o1))); - } - - public void testAlternativeFactoryMethodAlsoMatchesOnlyIfArgumentIsReferenceToASpecifiedObject() { - Object o1 = new Object(); - Object o2 = new Object(); - - assertThat(o1, theInstance(o1)); - assertThat(o2, not(theInstance(o1))); - } - - public void testReturnsReadableDescriptionFromToString() { - assertDescription("sameInstance(\"ARG\")", sameInstance("ARG")); - } - - public void testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull() { - assertDescription("sameInstance(null)", sameInstance(null)); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsTest.java deleted file mode 100644 index 412b8641..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/core/IsTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.hamcrest.core; - -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.Is.is; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -public class IsTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - return is("something"); - } - - public void testJustMatchesTheSameWayTheUnderylingMatcherDoes() { - assertMatches("should match", is(equalTo(true)), true); - assertMatches("should match", is(equalTo(false)), false); - assertDoesNotMatch("should not match", is(equalTo(true)), false); - assertDoesNotMatch("should not match", is(equalTo(false)), true); - } - - public void testGeneratesIsPrefixInDescription() { - assertDescription("is ", is(equalTo(true))); - } - - public void testProvidesConvenientShortcutForIsEqualTo() { - assertMatches("should match", is("A"), "A"); - assertMatches("should match", is("B"), "B"); - assertDoesNotMatch("should not match", is("A"), "B"); - assertDoesNotMatch("should not match", is("B"), "A"); - assertDescription("is \"A\"", is("A")); - } - - public void testProvidesConvenientShortcutForIsInstanceOf() { - assertTrue("should match", is(String.class).matches("A")); - assertFalse("should not match", is(Integer.class).matches(new Object())); - assertFalse("should not match", is(Integer.class).matches(null)); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/EasyMock2FactoryWriterTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/generator/EasyMock2FactoryWriterTest.java deleted file mode 100644 index 595cbbbb..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/EasyMock2FactoryWriterTest.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.hamcrest.generator; - -import junit.framework.TestCase; - -import java.io.StringWriter; -import java.io.IOException; - -public class EasyMock2FactoryWriterTest extends TestCase { - - private FactoryWriter factoryWriter; - private StringWriter output = new StringWriter(); - - @Override - protected void setUp() throws Exception { - super.setUp(); - factoryWriter = new EasyMock2FactoryWriter(output, "com.blah", "EasyMatchers"); - } - - public void testWritesMethodDelegationMethodWrappedInAdapter() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "anyObject", "unusedReturnType"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static java.lang.Object anyObject() {\n" + - " org.hamcrest.integration.EasyMockAdapter.adapt(\n" + - " com.example.MyMatcher.anyObject());\n" + - " return null;\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesReturnType() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "anyString", "unusedReturnType"); - method.setGenerifiedType("String"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static String anyString() {\n" + - " org.hamcrest.integration.EasyMockAdapter.adapt(\n" + - " com.example.MyMatcher.anyString());\n" + - " return null;\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesAdvancedGenerifiedMatcherType() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "weirdThing", "unusedReturnType"); - method.setGenerifiedType("java.util.Map,?>"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static java.util.Map,?> weirdThing() {\n" + - " org.hamcrest.integration.EasyMockAdapter.adapt(\n" + - " com.example.MyMatcher.weirdThing());\n" + - " return null;\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesParameters() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "between", "unusedReturnType"); - method.addParameter("int[]", "lower"); - method.addParameter("com.blah.Cheesable...", "upper"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static java.lang.Object between(int[] lower, com.blah.Cheesable... upper) {\n" + - " org.hamcrest.integration.EasyMockAdapter.adapt(\n" + - " com.example.MyMatcher.between(lower, upper));\n" + - " return null;\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesExceptions() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "tricky", "unusedReturnType"); - method.addException("java.io.IOException"); - method.addException("com.foo.CheeselessException"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static java.lang.Object tricky() throws java.io.IOException, com.foo.CheeselessException {\n" + - " org.hamcrest.integration.EasyMockAdapter.adapt(\n" + - " com.example.MyMatcher.tricky());\n" + - " return null;\n" + - " }\n" + - "\n", - output.toString()); - } -// -// public void testWritesGenericTypeParameters() throws IOException { -// FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "tricky"); -// method.addGenericTypeParameter("T"); -// method.addGenericTypeParameter("V extends String & Cheese"); -// method.addParameter("T", "t"); -// method.addParameter("List", "v"); -// -// factoryWriter.writeMethod(method.getName(), method); -// assertEquals("" + -// " public static org.hamcrest.Matcher tricky(T t, List v) {\n" + -// " return com.example.MyMatcher.tricky(t, v);\n" + -// " }\n" + -// "\n", -// output.toString()); -// } -// -// public void testWritesJavaDoc() throws IOException { -// FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "needsDoc"); -// method.setJavaDoc("This is a complicated method.\nIt needs docs.\n\n@see MoreStuff"); -// -// factoryWriter.writeMethod(method.getName(), method); -// assertEquals("" + -// " /**\n" + -// " * This is a complicated method.\n" + -// " * It needs docs.\n" + -// " * \n" + -// " * @see MoreStuff\n" + -// " */\n" + -// " public static org.hamcrest.Matcher needsDoc() {\n" + -// " return com.example.MyMatcher.needsDoc();\n" + -// " }\n" + -// "\n", -// output.toString()); -// } -// -// public void testWritesMethodWithNameOverriden() throws IOException { -// FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "eq"); -// -// factoryWriter.writeMethod("anotherName", method); -// assertEquals("" + -// " public static org.hamcrest.Matcher anotherName() {\n" + -// " return com.example.MyMatcher.eq();\n" + -// " }\n" + -// "\n", -// output.toString()); -// } - - // primitives - // arrays? - // and/or/not/etc - - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/HamcrestFactoryWriterTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/generator/HamcrestFactoryWriterTest.java deleted file mode 100644 index a93c71d0..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/HamcrestFactoryWriterTest.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.hamcrest.generator; - -import java.io.IOException; -import java.io.StringWriter; - -import junit.framework.TestCase; - -public class HamcrestFactoryWriterTest extends TestCase { - private FactoryWriter factoryWriter; - private StringWriter output = new StringWriter(); - - @Override - protected void setUp() throws Exception { - super.setUp(); - factoryWriter = new HamcrestFactoryWriter(null, null, output); - } - - public void testWritesMethodDelegationMethod() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "anyObject", "matcher.ReturnType"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static matcher.ReturnType anyObject() {\n" + - " return com.example.MyMatcher.anyObject();\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesCompleteJavaSource() throws IOException { - factoryWriter = new HamcrestFactoryWriter("com.some.package", "SomeClass", output); - factoryWriter.writeHeader(); - factoryWriter.writeMethod("method1", new FactoryMethod("com.example.MyMatcher", "method1", "matcher.ReturnType")); - factoryWriter.writeMethod("method2", new FactoryMethod("com.example.MyMatcher", "method2", "matcher.ReturnType")); - factoryWriter.writeFooter(); - - assertEquals("" + - "// Generated source.\n" + - "package com.some.package;\n" + - "\n" + - "public class SomeClass {\n" + - "\n" + - " public static matcher.ReturnType method1() {\n" + - " return com.example.MyMatcher.method1();\n" + - " }\n" + - "\n" + - " public static matcher.ReturnType method2() {\n" + - " return com.example.MyMatcher.method2();\n" + - " }\n" + - "\n" + - "}\n", - output.toString()); - } - - public void testWritesGenerifiedMatcherType() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "anyString", "matcher.ReturnType"); - method.setGenerifiedType("String"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static matcher.ReturnType anyString() {\n" + - " return com.example.MyMatcher.anyString();\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesAdvancedGenerifiedMatcherType() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "weirdThing", "matcher.ReturnType"); - method.setGenerifiedType("java.util.Map,?>"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static matcher.ReturnType,?>> weirdThing() {\n" + - " return com.example.MyMatcher.weirdThing();\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesParameters() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "between", "matcher.ReturnType"); - method.addParameter("int[]", "lower"); - method.addParameter("com.blah.Cheesable...", "upper"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static matcher.ReturnType between(int[] lower, com.blah.Cheesable... upper) {\n" + - " return com.example.MyMatcher.between(lower, upper);\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesExceptions() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "tricky", "matcher.ReturnType"); - method.addException("java.io.IOException"); - method.addException("com.foo.CheeselessException"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static matcher.ReturnType tricky() throws java.io.IOException, com.foo.CheeselessException {\n" + - " return com.example.MyMatcher.tricky();\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesGenericTypeParameters() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "tricky", "matcher.ReturnType"); - method.addGenericTypeParameter("T"); - method.addGenericTypeParameter("V extends String & Cheese"); - method.addParameter("T", "t"); - method.addParameter("List", "v"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " public static matcher.ReturnType tricky(T t, List v) {\n" + - " return com.example.MyMatcher.tricky(t, v);\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesJavaDoc() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "needsDoc", "matcher.ReturnType"); - method.setJavaDoc("This is a complicated method.\nIt needs docs.\n\n@see MoreStuff"); - - factoryWriter.writeMethod(method.getName(), method); - assertEquals("" + - " /**\n" + - " * This is a complicated method.\n" + - " * It needs docs.\n" + - " * \n" + - " * @see MoreStuff\n" + - " */\n" + - " public static matcher.ReturnType needsDoc() {\n" + - " return com.example.MyMatcher.needsDoc();\n" + - " }\n" + - "\n", - output.toString()); - } - - public void testWritesMethodWithNameOverriden() throws IOException { - FactoryMethod method = new FactoryMethod("com.example.MyMatcher", "eq", "matcher.ReturnType"); - - factoryWriter.writeMethod("anotherName", method); - assertEquals("" + - " public static matcher.ReturnType anotherName() {\n" + - " return com.example.MyMatcher.eq();\n" + - " }\n" + - "\n", - output.toString()); - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/QDoxFactoryReaderTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/generator/QDoxFactoryReaderTest.java deleted file mode 100644 index 6a697574..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/QDoxFactoryReaderTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.hamcrest.generator; - -import junit.framework.TestCase; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class QDoxFactoryReaderTest extends TestCase { - - public void testExtractsOriginalParameterNamesFromSource() { - FactoryMethod method = new FactoryMethod("org.SomeClass", "someMethod", "unusedReturnType"); - method.addParameter("java.lang.String", "badParamName"); - - String input = "" + - "package org;\n" + - "class SomeClass {\n" + - " Matcher someMethod(String realParamName) { ... } \n" + - "}\n"; - FactoryMethod factoryMethod = wrapUsingQDoxedSource(method, "org.SomeClass", input); - - assertEquals("java.lang.String", factoryMethod.getParameters().get(0).getType()); - assertEquals("realParamName", factoryMethod.getParameters().get(0).getName()); - } - - public void testExtractsOriginalGenericParameterNamesFromSource() { - FactoryMethod method = new FactoryMethod("org.SomeClass", "someMethod", "unusedReturnType"); - method.addParameter("java.util.Collection", "badParamName"); - - String input = "" + - "package org;\n" + - "class SomeClass {\n" + - " Matcher someMethod(java.util.Collection realParamName) { ... } \n" + - "}\n"; - FactoryMethod factoryMethod = wrapUsingQDoxedSource(method, "org.SomeClass", input); - - assertEquals("java.util.Collection", factoryMethod.getParameters().get(0).getType()); - assertEquals("realParamName", factoryMethod.getParameters().get(0).getName()); - } - - public void testExtractsOriginalVarArgParameterNamesFromSource() { - FactoryMethod method = new FactoryMethod("org.SomeClass", "someMethod", "unusedReturnType"); - method.addParameter("java.lang.String...", "badParamName"); - - String input = "" + - "package org;\n" + - "class SomeClass {\n" + - " Matcher someMethod(java.lang.String... realParamName) { ... } \n" + - "}\n"; - FactoryMethod factoryMethod = wrapUsingQDoxedSource(method, "org.SomeClass", input); - - assertEquals("java.lang.String...", factoryMethod.getParameters().get(0).getType()); - assertEquals("realParamName", factoryMethod.getParameters().get(0).getName()); - } - - public void testExtractsOriginalJavaDocFromSource() { - FactoryMethod method = new FactoryMethod("org.SomeClass", "someMethod", "unusedReturnType"); - - String input = "" + - "package org;\n" + - "class SomeClass {\n" + - " /**\n" + - " * This class does something.\n" + - " *\n" + - " * @return stuff.\n" + - " */\n" + - " Matcher someMethod() { ... } \n" + - "}\n"; - FactoryMethod factoryMethod = wrapUsingQDoxedSource(method, "org.SomeClass", input); - - assertEquals("This class does something.\n\n@return stuff.\n", - factoryMethod.getJavaDoc()); - } - - private static FactoryMethod wrapUsingQDoxedSource(FactoryMethod originalMethod, - String className, String input) { - List originalMethods = new ArrayList(); - originalMethods.add(originalMethod); - - QDox qdox = new QDox(); - qdox.addSource(new StringReader(input)); - - QDoxFactoryReader qDoxFactoryReader = new QDoxFactoryReader( - originalMethods, qdox, className); - return getFirstFactoryMethod(qDoxFactoryReader); - } - - private static FactoryMethod getFirstFactoryMethod(QDoxFactoryReader qDoxFactoryReader) { - Iterator iterator = qDoxFactoryReader.iterator(); - iterator.hasNext(); - return iterator.next(); - } - - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/QuickReferenceWriterTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/generator/QuickReferenceWriterTest.java deleted file mode 100644 index d5fbfcac..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/QuickReferenceWriterTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.hamcrest.generator; - -import junit.framework.TestCase; - -import java.io.PrintStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -public class QuickReferenceWriterTest extends TestCase { - - private ByteArrayOutputStream actualBuffer; - private ByteArrayOutputStream expectedBuffer; - private PrintStream expected; - private QuickReferenceWriter writer; - - @Override - protected void setUp() throws Exception { - super.setUp(); - actualBuffer = new ByteArrayOutputStream(); - writer = new QuickReferenceWriter(new PrintStream(actualBuffer)); - - expectedBuffer = new ByteArrayOutputStream(); - expected = new PrintStream(expectedBuffer); - } - - public void testWritesSimplifiedSummaryOfMatchers() throws IOException { - FactoryMethod namedMethod = new FactoryMethod("SomeClass", "someMethod", "unusedReturnType"); - namedMethod.addParameter("Cheese", "a"); - namedMethod.addParameter("int", "b"); - namedMethod.setGenerifiedType("String"); - writer.writeMethod("namedMethod", namedMethod); - - FactoryMethod anotherMethod = new FactoryMethod("SomeClass", "anotherMethod", "unusedReturnType"); - anotherMethod.setGenerifiedType("int"); - writer.writeMethod("anotherMethod", anotherMethod); - - expected.println(" [String] namedMethod(Cheese a, int b)"); - expected.println(" [int] anotherMethod()"); - verify(); - } - - public void testRemovesPackageNames() throws IOException { - FactoryMethod namedMethod = new FactoryMethod("SomeClass", "someMethod", "unusedReturnType"); - namedMethod.addParameter("com.blah.Foo", "a"); - namedMethod.addParameter("com.foo.Cheese", "b"); - namedMethod.setGenerifiedType("java.lang.Cheese"); - writer.writeMethod("namedMethod", namedMethod); - - expected.println(" [Cheese] namedMethod(Foo a, Cheese b)"); - verify(); - } - - private void verify() { - assertEquals(new String(expectedBuffer.toByteArray()), new String(actualBuffer.toByteArray())); - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/ReflectiveFactoryReaderTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/generator/ReflectiveFactoryReaderTest.java deleted file mode 100644 index 0792b5bf..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/ReflectiveFactoryReaderTest.java +++ /dev/null @@ -1,269 +0,0 @@ -package org.hamcrest.generator; - -import junit.framework.TestCase; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Factory; -import org.hamcrest.Matcher; - -import java.io.IOException; -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -@SuppressWarnings("unused") -public class ReflectiveFactoryReaderTest extends TestCase { - - public static class SimpleSetOfMatchers { - - @Factory - public static Matcher firstMethod() { - return null; - } - - @Factory - public static Matcher secondMethod() { - return null; - } - - } - - public void testIteratesOverFactoryMethods() { - Iterable reader = new ReflectiveFactoryReader(SimpleSetOfMatchers.class); - Iterator methods = reader.iterator(); - - assertTrue("Expected first method", methods.hasNext()); - FactoryMethod firstMethod = methods.next(); - assertEquals("firstMethod", firstMethod.getName()); - assertEquals(SimpleSetOfMatchers.class.getName().replace('$', '.'), firstMethod.getMatcherClass()); - - assertTrue("Expected second method", methods.hasNext()); - FactoryMethod secondMethod = methods.next(); - assertEquals("secondMethod", secondMethod.getName()); - assertEquals(SimpleSetOfMatchers.class.getName().replace('$', '.'), secondMethod.getMatcherClass()); - - assertFalse("Expected no more methods", methods.hasNext()); - } - - public static class MatchersWithDodgySignatures { - - @Factory - public Matcher notStatic() { - return null; - } - - @Factory - static Matcher notPublic() { - return null; - } - - public static Matcher noAnnotation() { - return null; - } - - @Factory - public static Matcher goodMethod() { - return null; - } - - @Factory - public static String anotherGoodMethod() { - return null; - } - - @Factory - public static void wrongReturnType() { - } - - } - - public void testOnlyReadsPublicStaticAnnotatedMethodsThatReturnNonVoid() { - Iterable reader = new ReflectiveFactoryReader(MatchersWithDodgySignatures.class); - Iterator methods = reader.iterator(); - - assertTrue("Expected first method", methods.hasNext()); - assertEquals("goodMethod", methods.next().getName()); - - assertTrue("Expected second method", methods.hasNext()); - assertEquals("anotherGoodMethod", methods.next().getName()); - - assertFalse("Expected no more methods", methods.hasNext()); - } - - public static class GenerifiedMatchers { - - @Factory - public static Matcher> generifiedType() { - return null; - } - - @SuppressWarnings("rawtypes") - @Factory - public static Matcher noGenerifiedType() { - return null; - } - - @Factory - public static Matcher, Factory>> crazyType() { - return null; - } - - } - - public void testReadsFullyQualifiedGenericType() { - FactoryMethod method = readMethod(GenerifiedMatchers.class, "generifiedType"); - assertEquals("java.util.Comparator", method.getGenerifiedType()); - } - - public void testReadsNullGenerifiedTypeIfNotPresent() { - FactoryMethod method = readMethod(GenerifiedMatchers.class, "noGenerifiedType"); - assertNull(method.getGenerifiedType()); - } - - public void testReadsGenericsInGenericType() { - FactoryMethod method = readMethod(GenerifiedMatchers.class, "crazyType"); - assertEquals( - "java.util.Map, org.hamcrest.Factory>", - method.getGenerifiedType()); - } - - public static class ParamterizedMatchers { - - @Factory - public static Matcher withParam(String someString, int[] numbers, Collection things) { - return null; - } - - @Factory - public static Matcher withArray(String[] array) { - return null; - } - - @Factory - public static Matcher withVarArgs(String... things) { - return null; - } - - @Factory - public static Matcher withGenerifiedParam(Collection> things, Set[] x) { - return null; - } - - } - - public void testReadsParameterTypes() { - FactoryMethod method = readMethod(ParamterizedMatchers.class, "withParam"); - List params = method.getParameters(); - assertEquals(3, params.size()); - - assertEquals("java.lang.String", params.get(0).getType()); - assertEquals("int[]", params.get(1).getType()); - assertEquals("java.util.Collection", params.get(2).getType()); - } - - public void testReadsArrayAndVarArgParameterTypes() { - FactoryMethod arrayMethod = readMethod(ParamterizedMatchers.class, "withArray"); - assertEquals("java.lang.String[]", arrayMethod.getParameters().get(0).getType()); - - FactoryMethod varArgsMethod = readMethod(ParamterizedMatchers.class, "withVarArgs"); - assertEquals("java.lang.String...", varArgsMethod.getParameters().get(0).getType()); - } - - public void testReadsGenerifiedParameterTypes() { - FactoryMethod method = readMethod(ParamterizedMatchers.class, "withGenerifiedParam"); - assertEquals("java.util.Collection>", - method.getParameters().get(0).getType()); - assertEquals("java.util.Set[]", - method.getParameters().get(1).getType()); - } - - public void testCannotReadParameterNamesSoMakesThemUpInstead() { - FactoryMethod method = readMethod(ParamterizedMatchers.class, "withParam"); - List params = method.getParameters(); - - assertEquals("param1", params.get(0).getName()); - assertEquals("param2", params.get(1).getName()); - assertEquals("param3", params.get(2).getName()); - } - - public static class ExceptionalMatchers { - - @Factory - public static Matcher withExceptions() throws Error, IOException, RuntimeException { - return null; - } - - } - - public void testReadsExceptions() { - FactoryMethod method = readMethod(ExceptionalMatchers.class, "withExceptions"); - List exceptions = method.getExceptions(); - assertEquals(3, exceptions.size()); - - assertEquals("java.lang.Error", exceptions.get(0)); - assertEquals("java.io.IOException", exceptions.get(1)); - assertEquals("java.lang.RuntimeException", exceptions.get(2)); - } - - public static class WithJavaDoc { - - /** - * Look at me! - * - * @return something - */ - @Factory - public static Matcher documented() { - return null; - } - - } - - public void testCannotReadJavaDoc() { - // JavaDoc information is not available through reflection alone. - FactoryMethod method = readMethod(WithJavaDoc.class, "documented"); - assertEquals(null, method.getJavaDoc()); - } - - public static class G { - - @Factory - public static & Comparable> Matcher> x(Set t, V v) { - return null; - } - - } - - public void testReadsGenericTypeParameters() { - FactoryMethod method = readMethod(G.class, "x"); - assertEquals("T", method.getGenericTypeParameters().get(0)); - assertEquals("V extends java.util.List & java.lang.Comparable", - method.getGenericTypeParameters().get(1)); - assertEquals("java.util.Map", method.getGenerifiedType()); - assertEquals("java.util.Set", method.getParameters().get(0).getType()); - assertEquals("V", method.getParameters().get(1).getType()); - } - - public static class SubclassOfMatcher { - @Factory - public static BaseMatcher subclassMethod() { - return null; - } - } - - public void testCatchesSubclasses() { - assertNotNull(readMethod(SubclassOfMatcher.class, "subclassMethod")); - } - - private static FactoryMethod readMethod(Class cls, String methodName) { - for (FactoryMethod method : new ReflectiveFactoryReader(cls)) { - if (method.getName().equals(methodName)) { - return method; - } - } - return null; - } - -} \ No newline at end of file diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/config/XmlConfiguratorTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/generator/config/XmlConfiguratorTest.java deleted file mode 100644 index 7905fa40..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/generator/config/XmlConfiguratorTest.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.hamcrest.generator.config; - -import junit.framework.TestCase; -import org.hamcrest.Factory; -import org.hamcrest.Matcher; -import org.hamcrest.core.CombinableMatcher; -import org.hamcrest.generator.FactoryMethod; -import org.hamcrest.generator.FactoryWriter; -import org.hamcrest.generator.SugarConfiguration; -import org.xml.sax.InputSource; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsCollectionContaining.hasItem; - -public class XmlConfiguratorTest extends TestCase { - - private MockSugarConfiguration sugarConfiguration; - private XmlConfigurator config; - - @Override - protected void setUp() throws Exception { - super.setUp(); - sugarConfiguration = new MockSugarConfiguration(); - config = new XmlConfigurator(sugarConfiguration, getClass().getClassLoader()); - } - - public void testAddsMatcherFactoryMethodsToConfiguration() throws Exception { - config.load(createXml("" + - "" + - " " + - " " + - "")); - - assertThat(sugarConfiguration.factoryMethods(), - hasItem(new FactoryMethod(SomeMatcher.class.getName().replace('$', '.'), "matcher1", "org.hamcrest.Matcher"))); - assertThat(sugarConfiguration.factoryMethods(), - hasItem(new FactoryMethod(SomeMatcher.class.getName().replace('$', '.'), "matcher2", "org.hamcrest.Matcher"))); - assertThat(sugarConfiguration.factoryMethods(), - hasItem(new FactoryMethod(AnotherMatcher.class.getName().replace('$', '.'), "matcher3", "org.hamcrest.CombinableMatcher"))); - } - - private static InputSource createXml(String xml) { - return new InputSource(new StringReader(xml)); - } - - // Sample Matchers - - @SuppressWarnings("rawtypes") - public static class SomeMatcher { - @Factory - public static Matcher matcher1() { - return null; - } - - @Factory - public static Matcher matcher2() { - return null; - } - } - - @SuppressWarnings("rawtypes") - public static class AnotherMatcher { - @Factory - public static CombinableMatcher matcher3() { - return null; - } - } - - /** - * Simple 'record and check' style mock. Not using a mocking library to avoid - * cyclical dependency between mocking library and hamcrest. - */ - private static class MockSugarConfiguration implements SugarConfiguration { - - private final List seenFactoryMethods = new ArrayList(); - private final List seenFactoryWriters = new ArrayList(); - - @Override - public void addWriter(FactoryWriter factoryWriter) { - seenFactoryWriters.add(factoryWriter); - } - - @Override - public void addFactoryMethod(FactoryMethod method) { - seenFactoryMethods.add(method); - } - - @Override - public void addFactoryMethods(Iterable methods) { - for (FactoryMethod method : methods) { - addFactoryMethod(method); - } - } - - public List factoryMethods() { - return seenFactoryMethods; - } - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/integration/EasyMock2AdapterTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/integration/EasyMock2AdapterTest.java deleted file mode 100644 index 808e24bf..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/integration/EasyMock2AdapterTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.hamcrest.integration; - -import junit.framework.TestCase; -import org.easymock.IArgumentMatcher; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import static org.hamcrest.core.IsEqual.equalTo; - -public class EasyMock2AdapterTest extends TestCase { - - public static interface InterfaceToMock { - void doStuff(String name, int number); - } - - public void testAdaptsHamcrestMatcherToEasyMockArgumentsMatcher() { - IArgumentMatcher easyMockMatcher = new EasyMock2Adapter(equalTo("expected")); - assertTrue("Should have matched", easyMockMatcher.matches("expected")); - assertFalse("Should not have matched", easyMockMatcher.matches("unexpected")); - } - - public void testDelegatesDescriptionToUnderlyingMatcher() { - IArgumentMatcher easyMockMatcher = new EasyMock2Adapter(new BaseMatcher() { - @Override - public boolean matches(Object o) { - return false; - } - - @Override - public void describeTo(Description description) { - description.appendText("is like "); - description.appendValue("cheese"); - } - }); - - StringBuffer buffer = new StringBuffer(); - easyMockMatcher.appendTo(buffer); - assertEquals("is like \"cheese\"", buffer.toString()); - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/integration/JMock1AdapterTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/integration/JMock1AdapterTest.java deleted file mode 100644 index d6a0e5ed..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/integration/JMock1AdapterTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.hamcrest.integration; - -import junit.framework.TestCase; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import static org.hamcrest.core.IsEqual.equalTo; -import org.jmock.core.Constraint; - -public class JMock1AdapterTest extends TestCase { - - public static interface InterfaceToMock { - void doStuff(String name, int number); - } - - public void testAdaptsHamcrestMatcherToJMockConstraint() { - Constraint jMockConstraint = new JMock1Adapter(equalTo("expected")); - assertTrue("Should have matched", jMockConstraint.eval("expected")); - assertFalse("Should not have matched", jMockConstraint.eval("unexpected")); - } - - public void testDelegatesDescriptionToUnderlyingMatcher() { - Constraint jMockConstraint = new JMock1Adapter(new BaseMatcher() { - @Override - public boolean matches(Object o) { - return false; - } - - @Override - public void describeTo(Description description) { - description.appendText("is like "); - description.appendValue("cheese"); - } - }); - - StringBuffer buffer = new StringBuffer(); - buffer = jMockConstraint.describeTo(buffer); - assertEquals("is like \"cheese\"", buffer.toString()); - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/number/BigDecimalCloseToTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/number/BigDecimalCloseToTest.java deleted file mode 100644 index 288dc0fb..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/number/BigDecimalCloseToTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.hamcrest.number; - -import static org.hamcrest.number.BigDecimalCloseTo.closeTo; - -import java.math.BigDecimal; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -public class BigDecimalCloseToTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - BigDecimal irrelevant = new BigDecimal("0.01"); - return closeTo(irrelevant, irrelevant); - } - - public void testEvaluatesToTrueIfArgumentIsEqualToABigDecimalWithinSomeError() { - Matcher p = closeTo(new BigDecimal("1.0"), new BigDecimal("0.5")); - - assertTrue(p.matches(new BigDecimal("1.0"))); - assertTrue(p.matches(new BigDecimal("0.5"))); - assertTrue(p.matches(new BigDecimal("1.5"))); - - assertDoesNotMatch("too large", p, new BigDecimal("2.0")); - assertMismatchDescription("<2.0> differed by <0.5>", p, new BigDecimal("2.0")); - assertDoesNotMatch("number too small", p, new BigDecimal("0.0")); - assertMismatchDescription("<0.0> differed by <0.5>", p, new BigDecimal("0.0")); - } - - public void testEvaluatesToTrueIfArgumentHasDifferentScale() { - Matcher p = closeTo(new BigDecimal("1.0"), new BigDecimal("0.5")); - - assertTrue(p.matches(new BigDecimal("1.000000"))); - assertTrue(p.matches(new BigDecimal("0.500000"))); - assertTrue(p.matches(new BigDecimal("1.500000"))); - - assertDoesNotMatch("too large", p, new BigDecimal("2.000000")); - assertMismatchDescription("<2.000000> differed by <0.5>", p, new BigDecimal("2.000000")); - assertDoesNotMatch("number too small", p, new BigDecimal("0.000000")); - assertMismatchDescription("<0.000000> differed by <0.5>", p, new BigDecimal("0.000000")); - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/number/IsCloseToTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/number/IsCloseToTest.java deleted file mode 100644 index 268dcf5c..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/number/IsCloseToTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.number; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import static org.hamcrest.number.IsCloseTo.closeTo; - -public class IsCloseToTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - double irrelevant = 0.1; - return closeTo(irrelevant, irrelevant); - } - - public void testEvaluatesToTrueIfArgumentIsEqualToADoubleValueWithinSomeError() { - Matcher p = closeTo(1.0, 0.5); - - assertTrue(p.matches(1.0)); - assertTrue(p.matches(0.5d)); - assertTrue(p.matches(1.5d)); - - assertDoesNotMatch("too large", p, 2.0); - assertMismatchDescription("<2.0> differed by <0.5>", p, 2.0); - assertDoesNotMatch("number too small", p, 0.0); - assertMismatchDescription("<0.0> differed by <0.5>", p, 0.0); - } - -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/object/HasToStringTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/object/HasToStringTest.java deleted file mode 100644 index 8ddfe126..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/object/HasToStringTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.hamcrest.object; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.object.HasToString.hasToString; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import org.hamcrest.StringDescription; - -public class HasToStringTest extends AbstractMatcherTest { - private static final String TO_STRING_RESULT = "toString result"; - private static final Object ARG = new Object() { - @Override - public String toString() { - return TO_STRING_RESULT; - } - }; - - @Override - protected Matcher createMatcher() { - return hasToString(equalTo("irrelevant")); - } - - public void testPassesResultOfToStringToNestedMatcher() { - assertThat(ARG, hasToString(equalTo(TO_STRING_RESULT))); - assertThat(ARG, not(hasToString(equalTo("OTHER STRING")))); - } - - public void testProvidesConvenientShortcutForHasToStringEqualTo() { - assertThat(ARG, hasToString(TO_STRING_RESULT)); - assertThat(ARG, not(hasToString("OTHER STRING"))); - } - - public void testHasReadableDescription() { - Matcher toStringMatcher = equalTo(TO_STRING_RESULT); - Matcher> matcher = hasToString(toStringMatcher); - - assertEquals("with toString() " + descriptionOf(toStringMatcher), descriptionOf(matcher)); - } - - public void testMismatchContainsToStringValue() { - String expectedMismatchString = "toString() was \"Cheese\""; - assertMismatchDescription(expectedMismatchString, hasToString(TO_STRING_RESULT), "Cheese"); - } - - private static String descriptionOf(Matcher matcher) { - return StringDescription.asString(matcher); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEmptyStringTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEmptyStringTest.java deleted file mode 100644 index 36fad2c6..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEmptyStringTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.hamcrest.text; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.text.IsEmptyString.isEmptyOrNullString; -import static org.hamcrest.text.IsEmptyString.isEmptyString; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -public class IsEmptyStringTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - return isEmptyOrNullString(); - } - - public void testEmptyOrNullIsNull() { - assertThat(null, isEmptyOrNullString()); - } - - - public void testEmptyIsNotNull() { - assertThat(null, not(isEmptyString())); - } - - public void testMatchesEmptyString() { - assertMatches("empty string", isEmptyString(), ""); - assertMatches("empty string", isEmptyOrNullString(), ""); - } - - public void testDoesNotMatchNonEmptyString() { - assertDoesNotMatch("non empty string", isEmptyString(), "a"); - } - - public void testHasAReadableDescription() { - assertDescription("an empty string", isEmptyString()); - assertDescription("(null or an empty string)", isEmptyOrNullString()); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java deleted file mode 100644 index 0b0d01eb..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.text; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase; - -public class IsEqualIgnoringCaseTest extends AbstractMatcherTest { - - @Override - protected Matcher createMatcher() { - return equalToIgnoringCase("irrelevant"); - } - - public void testIgnoresCaseOfCharsInString() { - assertThat("HELLO", equalToIgnoringCase("heLLo")); - assertThat("hello", equalToIgnoringCase("heLLo")); - assertThat("HelLo", equalToIgnoringCase("heLLo")); - - assertThat("bye", not(equalToIgnoringCase("heLLo"))); - } - - public void testFailsIfAdditionalWhitespaceIsPresent() { - assertThat("heLLo ", not(equalToIgnoringCase("heLLo"))); - assertThat(" heLLo", not(equalToIgnoringCase("heLLo"))); - } - - public void testFailsIfMatchingAgainstNull() { - assertThat(null, not(equalToIgnoringCase("heLLo"))); - } - - public void testRequiresNonNullStringToBeConstructed() { - try { - equalToIgnoringCase(null); - fail("Expected exception"); - } catch (IllegalArgumentException goodException) { - // expected! - } - } - - public void testDescribesItselfAsCaseInsensitive() { - assertDescription("equalToIgnoringCase(\"heLLo\")", - equalToIgnoringCase("heLLo")); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpaceTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpaceTest.java deleted file mode 100644 index ad521377..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpaceTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.text; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - -public class IsEqualIgnoringWhiteSpaceTest extends AbstractMatcherTest { - - private final Matcher matcher = equalToIgnoringWhiteSpace("Hello World how\n are we? "); - - @Override - protected Matcher createMatcher() { - return matcher; - } - - public void testPassesIfWordsAreSameButWhitespaceDiffers() { - assertThat("Hello World how are we?", matcher); - assertThat(" Hello World how are \n\n\twe?", matcher); - } - - public void testFailsIfTextOtherThanWhitespaceDiffers() { - assertThat("Hello PLANET how are we?", not(matcher)); - assertThat("Hello World how are we", not(matcher)); - } - - public void testFailsIfWhitespaceIsAddedOrRemovedInMidWord() { - assertThat("HelloWorld how are we?", not(matcher)); - assertThat("Hello Wo rld how are we?", not(matcher)); - } - - public void testFailsIfMatchingAgainstNull() { - assertThat(null, not(matcher)); - } - - public void testRequiresNonNullStringToBeConstructed() { - try { - new IsEqualIgnoringWhiteSpace(null); - fail("Expected exception"); - } catch (IllegalArgumentException goodException) { - // expected! - } - } - - public void testHasAReadableDescription() { - assertDescription("equalToIgnoringWhiteSpace(\"Hello World how\\n are we? \")", - matcher); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringContainsInOrderTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringContainsInOrderTest.java deleted file mode 100644 index ba6951da..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringContainsInOrderTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.hamcrest.text; - -import static java.util.Arrays.asList; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - - -public class StringContainsInOrderTest extends AbstractMatcherTest { - StringContainsInOrder m = new StringContainsInOrder(asList("a", "b", "c")); - - @Override - protected Matcher createMatcher() { - return m; - } - - public void testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() { - assertMatches("substrings in order", m, "abc"); - assertMatches("substrings separated", m, "1a2b3c4"); - - assertDoesNotMatch("substrings out of order", m, "cab"); - assertDoesNotMatch("no substrings in string", m, "xyz"); - assertDoesNotMatch("substring missing", m, "ac"); - assertDoesNotMatch("empty string", m, ""); - } - - public void testHasAReadableDescription() { - assertDescription("a string containing \"a\", \"b\", \"c\" in order", m); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringContainsTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringContainsTest.java deleted file mode 100644 index 1ed24f60..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringContainsTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.text; - -import static org.hamcrest.core.StringContains.containsString; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - - -public class StringContainsTest extends AbstractMatcherTest { - static final String EXCERPT = "EXCERPT"; - Matcher stringContains = containsString(EXCERPT); - - @Override - protected Matcher createMatcher() { - return stringContains; - } - - public void testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() { - assertTrue("should be true if excerpt at beginning", - stringContains.matches(EXCERPT + "END")); - assertTrue("should be true if excerpt at end", - stringContains.matches("START" + EXCERPT)); - assertTrue("should be true if excerpt in middle", - stringContains.matches("START" + EXCERPT + "END")); - assertTrue("should be true if excerpt is repeated", - stringContains.matches(EXCERPT + EXCERPT)); - - assertFalse("should not be true if excerpt is not in string", - stringContains.matches("Something else")); - assertFalse("should not be true if part of excerpt is in string", - stringContains.matches(EXCERPT.substring(1))); - } - - public void testEvaluatesToTrueIfArgumentIsEqualToSubstring() { - assertTrue("should be true if excerpt is entire string", - stringContains.matches(EXCERPT)); - } - - public void testHasAReadableDescription() { - assertDescription("a string containing \"EXCERPT\"", stringContains); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringEndsWithTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringEndsWithTest.java deleted file mode 100644 index efff4d55..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringEndsWithTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.text; - -import static org.hamcrest.core.StringEndsWith.endsWith; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - - -public class StringEndsWithTest extends AbstractMatcherTest { - static final String EXCERPT = "EXCERPT"; - Matcher stringEndsWith = endsWith(EXCERPT); - - @Override - protected Matcher createMatcher() { - return stringEndsWith; - } - - public void testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() { - assertFalse("should be false if excerpt at beginning", - stringEndsWith.matches(EXCERPT + "END")); - assertTrue("should be true if excerpt at end", - stringEndsWith.matches("START" + EXCERPT)); - assertFalse("should be false if excerpt in middle", - stringEndsWith.matches("START" + EXCERPT + "END")); - assertTrue("should be true if excerpt is at end and repeated", - stringEndsWith.matches(EXCERPT + EXCERPT)); - - assertFalse("should be false if excerpt is not in string", - stringEndsWith.matches("Something else")); - assertFalse("should be false if part of excerpt is at end of string", - stringEndsWith.matches(EXCERPT.substring(0, EXCERPT.length() - 2))); - } - - public void testEvaluatesToTrueIfArgumentIsEqualToSubstring() { - assertTrue("should be true if excerpt is entire string", - stringEndsWith.matches(EXCERPT)); - } - - public void testHasAReadableDescription() { - assertDescription("a string ending with \"EXCERPT\"", stringEndsWith); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringStartsWithTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringStartsWithTest.java deleted file mode 100644 index f49e4937..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/text/StringStartsWithTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ -package org.hamcrest.text; - -import static org.hamcrest.core.StringStartsWith.startsWith; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - - -public class StringStartsWithTest extends AbstractMatcherTest { - static final String EXCERPT = "EXCERPT"; - Matcher stringStartsWith = startsWith(EXCERPT); - - @Override - protected Matcher createMatcher() { - return stringStartsWith; - } - - public void testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() { - assertTrue("should be true if excerpt at beginning", - stringStartsWith.matches(EXCERPT + "END")); - assertFalse("should be false if excerpt at end", - stringStartsWith.matches("START" + EXCERPT)); - assertFalse("should be false if excerpt in middle", - stringStartsWith.matches("START" + EXCERPT + "END")); - assertTrue("should be true if excerpt is at beginning and repeated", - stringStartsWith.matches(EXCERPT + EXCERPT)); - - assertFalse("should be false if excerpt is not in string", - stringStartsWith.matches("Something else")); - assertFalse("should be false if part of excerpt is at start of string", - stringStartsWith.matches(EXCERPT.substring(1))); - } - - public void testEvaluatesToTrueIfArgumentIsEqualToSubstring() { - assertTrue("should be true if excerpt is entire string", - stringStartsWith.matches(EXCERPT)); - } - - public void testHasAReadableDescription() { - assertDescription("a string starting with \"EXCERPT\"", stringStartsWith); - } -} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/xml/HasXPathTest.java b/hamcrest-unit-test/src/main/java/org/hamcrest/xml/HasXPathTest.java deleted file mode 100644 index 53cf41bb..00000000 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/xml/HasXPathTest.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.hamcrest.xml; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsNot.not; -import static org.hamcrest.core.StringContains.containsString; -import static org.hamcrest.xml.HasXPath.hasXPath; - -import java.io.ByteArrayInputStream; -import java.util.HashSet; -import java.util.Iterator; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import org.w3c.dom.Document; - -/** - * @author Joe Walnes - */ -public class HasXPathTest extends AbstractMatcherTest { - private Document xml; - private NamespaceContext ns; - - @Override - protected void setUp() throws Exception { - super.setUp(); - xml = parse("" - + "\n" - + " Edam\n" - + " Cheddar\n" - + " Caravane\n" - + " \n" - + " " - + "\n" - ); - ns = new NamespaceContext() { - @Override - public String getNamespaceURI(String prefix) { - return ("cheese".equals(prefix) ? "http://cheese.com" : null); - } - - @Override - public String getPrefix(String namespaceURI) { - return ("http://cheese.com".equals(namespaceURI) ? "cheese" : null); - } - - @Override - public Iterator getPrefixes(String namespaceURI) { - HashSet prefixes = new HashSet(); - String prefix = getPrefix(namespaceURI); - if (prefix != null) { - prefixes.add(prefix); - } - return prefixes.iterator(); - } - }; - } - - @Override - protected Matcher createMatcher() { - return hasXPath("//irrelevant"); - } - - public void testAppliesMatcherToXPathInDocument() throws Exception { - assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar"))); - assertThat(xml, hasXPath("//something[1]/cheese", containsString("dam"))); - assertThat(xml, hasXPath("//something[2]/cheese", not(containsString("dam")))); - assertThat(xml, hasXPath("/root/@type", equalTo("food"))); - assertThat(xml, hasXPath("//something[@id='b']/cheese", equalTo("Cheddar"))); - assertThat(xml, hasXPath("//something[@id='b']/cheese")); - } - - public void testMatchesEmptyElement() throws Exception { - assertThat(xml, hasXPath("//emptySomething")); - } - - public void testMatchesEmptyElementInNamespace() throws Exception { - assertThat(xml, hasXPath("//cheese:emptySomething", ns)); - } - - public void testFailsIfNodeIsMissing() throws Exception { - assertThat(xml, not(hasXPath("/root/something[3]/cheese", ns, equalTo("Cheddar")))); - assertThat(xml, not(hasXPath("//something[@id='c']/cheese", ns))); - } - - public void testFailsIfNodeIsMissingInNamespace() throws Exception { - assertThat(xml, not(hasXPath("//cheese:foreignSomething", equalTo("Badger")))); - assertThat(xml, not(hasXPath("//cheese:foreignSomething"))); - } - - public void testMatchesWithNamespace() throws Exception { - assertThat(xml, hasXPath("//cheese:foreignSomething", ns)); - assertThat(xml, hasXPath("//cheese:foreignSomething/@milk", ns, equalTo("camel"))); - assertThat(xml, hasXPath("//cheese:foreignSomething/text()", ns, equalTo("Caravane"))); - } - - public void testThrowsIllegalArgumentExceptionIfGivenIllegalExpression() { - try { - hasXPath("\\g:dfgd::DSgf/root/something[2]/cheese", equalTo("blah")); - fail("Expected exception"); - } catch (IllegalArgumentException expectedException) { - // expected exception - } - } - - public void testDescribesItself() throws Exception { - assertDescription("an XML document with XPath /some/path \"Cheddar\"", - hasXPath("/some/path", equalTo("Cheddar"))); - assertDescription("an XML document with XPath /some/path", - hasXPath("/some/path")); - } - - public void testDescribesMissingNodeMismatch() { - assertMismatchDescription("xpath returned no results.", hasXPath("//honky"), xml); - } - - public void testDescribesIncorrectNodeValueMismatch() { - assertMismatchDescription("was \"Edam\"", hasXPath("//something[1]/cheese", equalTo("parmesan")), xml); - } - - private static Document parse(String xml) throws Exception { - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - documentBuilderFactory.setNamespaceAware(true); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - return documentBuilder.parse(new ByteArrayInputStream(xml.getBytes())); - } -} diff --git a/hamcrest/hamcrest.gradle b/hamcrest/hamcrest.gradle new file mode 100644 index 00000000..932990e9 --- /dev/null +++ b/hamcrest/hamcrest.gradle @@ -0,0 +1,24 @@ +apply plugin: 'osgi' + +version = rootProject.version + +dependencies { + testImplementation(group: 'junit', name: 'junit', version: '4.12') { + transitive = false + } +} + +jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Vendor': 'hamcrest.org', + 'Implementation-Version': version, + 'Automatic-Module-Name': 'org.hamcrest' + instruction 'Import-Package', '''javax.xml.namespace; resolution:=optional, + javax.xml.xpath; resolution:=optional, + org.w3c.dom; resolution:=optional, + *''' + } +} + +javadoc.title = "Hamcrest $version API" diff --git a/hamcrest-core/src/main/java/org/hamcrest/BaseDescription.java b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java similarity index 91% rename from hamcrest-core/src/main/java/org/hamcrest/BaseDescription.java rename to hamcrest/src/main/java/org/hamcrest/BaseDescription.java index e78a9683..d0c8fc41 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/BaseDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java @@ -1,12 +1,12 @@ package org.hamcrest; -import static java.lang.String.valueOf; +import org.hamcrest.internal.ArrayIterator; +import org.hamcrest.internal.SelfDescribingValueIterator; import java.util.Arrays; import java.util.Iterator; -import org.hamcrest.internal.ArrayIterator; -import org.hamcrest.internal.SelfDescribingValueIterator; +import static java.lang.String.valueOf; /** * A {@link Description} that is stored as a string. @@ -35,6 +35,10 @@ public Description appendValue(Object value) { append('"'); toJavaSyntax((Character) value); append('"'); + } else if (value instanceof Byte) { + append('<'); + append(descriptionOf(value)); + append("b>"); } else if (value instanceof Short) { append('<'); append(descriptionOf(value)); @@ -66,8 +70,9 @@ private String descriptionOf(Object value) { } } + @SafeVarargs @Override - public Description appendValueList(String start, String separator, String end, T... values) { + public final Description appendValueList(String start, String separator, String end, T... values) { return appendValueList(start, separator, end, Arrays.asList(values)); } @@ -77,7 +82,7 @@ public Description appendValueList(String start, String separator, String en } private Description appendValueList(String start, String separator, String end, Iterator values) { - return appendList(start, separator, end, new SelfDescribingValueIterator(values)); + return appendList(start, separator, end, new SelfDescribingValueIterator<>(values)); } @Override @@ -137,6 +142,9 @@ private void toJavaSyntax(char ch) { case '\t': append("\\t"); break; + case '\\': + append("\\\\"); + break; default: append(ch); } diff --git a/hamcrest-core/src/main/java/org/hamcrest/BaseMatcher.java b/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java similarity index 58% rename from hamcrest-core/src/main/java/org/hamcrest/BaseMatcher.java rename to hamcrest/src/main/java/org/hamcrest/BaseMatcher.java index 9ae18c86..aaa6e957 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/BaseMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java @@ -1,5 +1,3 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest; /** @@ -27,4 +25,18 @@ public void describeMismatch(Object item, Description description) { public String toString() { return StringDescription.toString(this); } + + /** + * Useful null-check method. Writes a mismatch description if the actual object is null + * @param actual the object to check + * @param mismatch where to write the mismatch description, if any + * @return false iff the actual object is null + */ + protected static boolean isNotNull(Object actual, Description mismatch) { + if (actual == null) { + mismatch.appendText("was null"); + return false; + } + return true; + } } diff --git a/hamcrest-core/src/main/java/org/hamcrest/Condition.java b/hamcrest/src/main/java/org/hamcrest/Condition.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/Condition.java rename to hamcrest/src/main/java/org/hamcrest/Condition.java diff --git a/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java new file mode 100644 index 00000000..02b5e426 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java @@ -0,0 +1,450 @@ +package org.hamcrest; + +import org.hamcrest.core.IsIterableContaining; + +@SuppressWarnings("UnusedDeclaration") +public class CoreMatchers { + + /** + * Creates a matcher that matches if the examined object matches ALL of the specified matchers. + * For example: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static org.hamcrest.Matcher allOf(java.lang.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: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + @SafeVarargs + public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher... matchers) { + return org.hamcrest.core.AllOf.allOf(matchers); + } + + + /** + * Creates a matcher that matches if the examined object matches ANY of the specified matchers. + * For example: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static org.hamcrest.core.AnyOf anyOf(java.lang.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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + @SafeVarargs + public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher... matchers) { + return org.hamcrest.core.AnyOf.anyOf(matchers); + } + + /** + * Creates a matcher that matches when both of the specified matchers match the examined object. + * For example: + *
assertThat("fab", both(containsString("a")).and(containsString("b")))
+ */ + public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcher both(org.hamcrest.Matcher 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: + *
assertThat("fan", either(containsString("a")).or(containsString("b")))
+ */ + public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher either(org.hamcrest.Matcher 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 description + * the new description for the wrapped matcher + * @param matcher + * the matcher to wrap + * @param values + * optional values to insert into the tokenised description + */ + public static org.hamcrest.Matcher describedAs(java.lang.String description, org.hamcrest.Matcher matcher, java.lang.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: + *
assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
+ * + * @param itemMatcher + * the matcher to apply to every item provided by the examined {@link Iterable} + */ + public static org.hamcrest.Matcher> everyItem(org.hamcrest.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))
+ */ + public static org.hamcrest.Matcher is(org.hamcrest.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)))
+ */ + public static org.hamcrest.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)))
+ */ + public static org.hamcrest.Matcher isA(java.lang.Class type) { + return org.hamcrest.core.Is.isA(type); + } + + /** + * Creates a matcher that always matches, regardless of the examined object. + */ + public static org.hamcrest.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 + */ + public static org.hamcrest.Matcher anything(java.lang.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: + *
assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
+ * + * @param itemMatcher + * the matcher to apply to items provided by the examined {@link Iterable} + */ + public static org.hamcrest.Matcher> hasItem(org.hamcrest.Matcher 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: + *
assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
+ * + * @param item + * the item to compare against the items provided by the examined {@link Iterable} + */ + public static org.hamcrest.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: + *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
+ * + * @param itemMatchers + * the matchers to apply to items provided by the examined {@link Iterable} + */ + @SafeVarargs + public static org.hamcrest.Matcher> hasItems(org.hamcrest.Matcher... 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: + *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
+ * + * @param items + * the items to compare against the items provided by the examined {@link Iterable} + */ + @SafeVarargs + public static org.hamcrest.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.

+ * For example: + *
+   * assertThat("foo", equalTo("foo"));
+   * assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+   * 
+ */ + public static org.hamcrest.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. + */ + public static org.hamcrest.Matcher equalToObject(java.lang.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));
+ */ + public static org.hamcrest.Matcher any(java.lang.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.

+ * For example: + *
assertThat(new Canoe(), instanceOf(Paddlable.class));
+ */ + public static org.hamcrest.Matcher instanceOf(java.lang.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 matcher + * the matcher whose sense should be inverted + */ + public static org.hamcrest.Matcher not(org.hamcrest.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 value + * the value that any examined object should not equal + */ + public static org.hamcrest.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())))
+ */ + public static org.hamcrest.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 type + * dummy parameter used to infer the generic type of the returned matcher + */ + public static org.hamcrest.Matcher notNullValue(java.lang.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())
+ */ + public static org.hamcrest.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 type + * dummy parameter used to infer the generic type of the returned matcher + */ + public static org.hamcrest.Matcher nullValue(java.lang.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 target + * the target instance against which others should be assessed + */ + public static org.hamcrest.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 target + * the target instance against which others should be assessed + */ + public static org.hamcrest.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: + *
assertThat("myStringOfNote", containsString("ring"))
+ * + * @param substring + * the substring that the returned matcher will expect to find within any examined string + */ + public static org.hamcrest.Matcher containsString(java.lang.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: + *
assertThat("myStringOfNote", containsString("ring"))
+ * + * @param substring + * the substring that the returned matcher will expect to find within any examined string + */ + public static org.hamcrest.Matcher containsStringIgnoringCase(java.lang.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 + */ + public static org.hamcrest.Matcher startsWith(java.lang.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 + *

+ * For example: + *
assertThat("myStringOfNote", startsWith("my"))
+ * + * @param prefix + * the substring that the returned matcher will expect at the start of any examined string + */ + public static org.hamcrest.Matcher startsWithIgnoringCase(java.lang.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 + */ + public static org.hamcrest.Matcher endsWith(java.lang.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: + *
assertThat("myStringOfNote", endsWith("Note"))
+ * + * @param suffix + * the substring that the returned matcher will expect at the end of any examined string + */ + public static org.hamcrest.Matcher endsWithIgnoringCase(java.lang.String suffix) { + return org.hamcrest.core.StringEndsWith.endsWithIgnoringCase(suffix); + } + +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/CustomMatcher.java b/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java similarity index 92% rename from hamcrest-core/src/main/java/org/hamcrest/CustomMatcher.java rename to hamcrest/src/main/java/org/hamcrest/CustomMatcher.java index bac02d78..036a7640 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/CustomMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java @@ -6,7 +6,7 @@ *
  * Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
  *   public boolean matches(Object object) {
- *     return ((object instanceof String) && !((String) object).isEmpty();
+ *     return ((object instanceof String) && !((String) object).isEmpty();
  *   }
  * };
  * 
diff --git a/hamcrest-core/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java rename to hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java diff --git a/hamcrest-core/src/main/java/org/hamcrest/Description.java b/hamcrest/src/main/java/org/hamcrest/Description.java similarity index 97% rename from hamcrest-core/src/main/java/org/hamcrest/Description.java rename to hamcrest/src/main/java/org/hamcrest/Description.java index e38fbdc4..73bfa385 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/Description.java +++ b/hamcrest/src/main/java/org/hamcrest/Description.java @@ -23,7 +23,7 @@ public interface Description { Description appendDescriptionOf(SelfDescribing value); /** - * Appends an arbitary value to the description. + * Appends an arbitrary value to the description. */ Description appendValue(Object value); diff --git a/hamcrest-core/src/main/java/org/hamcrest/DiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/DiagnosingMatcher.java rename to hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java diff --git a/hamcrest-core/src/main/java/org/hamcrest/FeatureMatcher.java b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java similarity index 99% rename from hamcrest-core/src/main/java/org/hamcrest/FeatureMatcher.java rename to hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java index c2b76be4..385cf999 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/FeatureMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java @@ -44,7 +44,7 @@ protected boolean matchesSafely(T actual, Description mismatch) { return false; } return true; - }; + } @Override public final void describeTo(Description description) { diff --git a/hamcrest-core/src/main/java/org/hamcrest/Matcher.java b/hamcrest/src/main/java/org/hamcrest/Matcher.java similarity index 73% rename from hamcrest-core/src/main/java/org/hamcrest/Matcher.java rename to hamcrest/src/main/java/org/hamcrest/Matcher.java index c9929730..77e09d5b 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/Matcher.java +++ b/hamcrest/src/main/java/org/hamcrest/Matcher.java @@ -1,40 +1,44 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest; /** + *

* A matcher over acceptable values. * A matcher is able to describe itself to give feedback when it fails. - *

+ *

+ *

* Matcher implementations should NOT directly implement this interface. * Instead, extend the {@link BaseMatcher} abstract class, * which will ensure that the Matcher API can grow to support * new features and remain compatible with all Matcher implementations. - *

- * For easy access to common Matcher implementations, use the static factory - * methods in {@link CoreMatchers}. - *

+ *

+ *

+ * When using Hamcrest, there is no guarantee as to how often matches() or + * describeMismatch() will be called, so the objects passed as + * actual arguments should not change when referenced. If you're testing a + * stream, a good practice is to collect the contents of the stream before matching. + *

+ *

* N.B. Well designed matchers should be immutable. - * - * @see CoreMatchers + *

+ * * @see BaseMatcher */ public interface Matcher extends SelfDescribing { /** * Evaluates the matcher for argument item. - *

+ * * This method matches against Object, instead of the generic type T. This is * because the caller of the Matcher does not know at runtime what the type is * (because of type erasure with Java generics). It is down to the implementations * to check the correct type. * - * @param item the object against which the matcher is evaluated. + * @param actual the object against which the matcher is evaluated. * @return true if item matches, otherwise false. * * @see BaseMatcher */ - boolean matches(Object item); + boolean matches(Object actual); /** * Generate a description of why the matcher has not accepted the item. @@ -43,11 +47,11 @@ public interface Matcher extends SelfDescribing { * This method assumes that matches(item) is false, but * will not check this. * - * @param item The item that the Matcher has rejected. + * @param actual The item that the Matcher has rejected. * @param mismatchDescription * The description to be built or appended to. */ - void describeMismatch(Object item, Description mismatchDescription); + void describeMismatch(Object actual, Description mismatchDescription); /** * This method simply acts a friendly reminder not to implement Matcher directly and diff --git a/hamcrest-core/src/main/java/org/hamcrest/MatcherAssert.java b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java similarity index 78% rename from hamcrest-core/src/main/java/org/hamcrest/MatcherAssert.java rename to hamcrest/src/main/java/org/hamcrest/MatcherAssert.java index 2a4a46c5..bc001ebb 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/MatcherAssert.java +++ b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java @@ -1,5 +1,3 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest; @@ -12,9 +10,11 @@ public static void assertThat(String reason, T actual, Matcher ma if (!matcher.matches(actual)) { Description description = new StringDescription(); description.appendText(reason) - .appendText("\nExpected: ") + .appendText(System.lineSeparator()) + .appendText("Expected: ") .appendDescriptionOf(matcher) - .appendText("\n but: "); + .appendText(System.lineSeparator()) + .appendText(" but: "); matcher.describeMismatch(actual, description); throw new AssertionError(description.toString()); diff --git a/hamcrest/src/main/java/org/hamcrest/Matchers.java b/hamcrest/src/main/java/org/hamcrest/Matchers.java new file mode 100644 index 00000000..30064b12 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/Matchers.java @@ -0,0 +1,1701 @@ +package org.hamcrest; + +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; + +@SuppressWarnings({"unused", "WeakerAccess"}) +public class Matchers { + + /** + * Creates a matcher that matches if the examined object matches ALL of the specified matchers. + * For example: + *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static org.hamcrest.Matcher allOf(java.lang.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: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + @SafeVarargs + public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher... 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: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher 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: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher 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: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher 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: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher 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: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher fifth, org.hamcrest.Matcher 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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static org.hamcrest.core.AnyOf anyOf(java.lang.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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + @SafeVarargs + public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher... 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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher 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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher 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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher 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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher 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: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher fifth, org.hamcrest.Matcher 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: + *
assertThat("fab", both(containsString("a")).and(containsString("b")))
+ */ + public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcher both(org.hamcrest.Matcher 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: + *
assertThat("fan", either(containsString("a")).or(containsString("b")))
+ */ + public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher either(org.hamcrest.Matcher 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 description + * the new description for the wrapped matcher + * @param matcher + * the matcher to wrap + * @param values + * optional values to insert into the tokenized description + */ + public static org.hamcrest.Matcher describedAs(java.lang.String description, org.hamcrest.Matcher matcher, java.lang.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: + *
assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
+ * + * @param itemMatcher + * the matcher to apply to every item provided by the examined {@link Iterable} + */ + public static org.hamcrest.Matcher> everyItem(org.hamcrest.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))
+ */ + public static org.hamcrest.Matcher is(org.hamcrest.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)))
+ */ + public static org.hamcrest.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)))
+ */ + public static org.hamcrest.Matcher isA(java.lang.Class type) { + return org.hamcrest.core.Is.isA(type); + } + + /** + * Creates a matcher that always matches, regardless of the examined object. + */ + public static org.hamcrest.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 + */ + public static org.hamcrest.Matcher anything(java.lang.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: + *
assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
+ * + * @param itemMatcher + * the matcher to apply to items provided by the examined {@link Iterable} + */ + public static org.hamcrest.Matcher> hasItem(org.hamcrest.Matcher 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: + *
assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
+ * + * @param item + * the item to compare against the items provided by the examined {@link Iterable} + */ + public static org.hamcrest.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: + *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
+ * + * @param itemMatchers + * the matchers to apply to items provided by the examined {@link Iterable} + */ + @SafeVarargs + public static org.hamcrest.Matcher> hasItems(org.hamcrest.Matcher... 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: + *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
+ * + * @param items + * the items to compare against the items provided by the examined {@link Iterable} + */ + @SafeVarargs + public static org.hamcrest.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.

+ * For example: + *
+   * assertThat("foo", equalTo("foo"));
+   * assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+   * 
+ */ + public static org.hamcrest.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. + */ + public static org.hamcrest.Matcher equalToObject(java.lang.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));
+ */ + public static org.hamcrest.Matcher any(java.lang.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.

+ * For example: + *
assertThat(new Canoe(), instanceOf(Paddlable.class));
+ */ + public static org.hamcrest.Matcher instanceOf(java.lang.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 matcher + * the matcher whose sense should be inverted + */ + public static org.hamcrest.Matcher not(org.hamcrest.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 value + * the value that any examined object should not equal + */ + public static org.hamcrest.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())))
+ */ + public static org.hamcrest.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 type + * dummy parameter used to infer the generic type of the returned matcher + */ + public static org.hamcrest.Matcher notNullValue(java.lang.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())
+ */ + public static org.hamcrest.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 type + * dummy parameter used to infer the generic type of the returned matcher + */ + public static org.hamcrest.Matcher nullValue(java.lang.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 target + * the target instance against which others should be assessed + */ + public static org.hamcrest.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 target + * the target instance against which others should be assessed + */ + public static org.hamcrest.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: + *
assertThat("myStringOfNote", containsString("ring"))
+ * + * @param substring + * the substring that the returned matcher will expect to find within any examined string + */ + public static Matcher containsString(java.lang.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: + *
assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))
+ * + * @param substring + * the substring that the returned matcher will expect to find within any examined string + */ + public static Matcher containsStringIgnoringCase(java.lang.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 + */ + public static Matcher startsWith(java.lang.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 + *

+ * For example: + *
assertThat("myStringOfNote", startsWithIgnoringCase("My"))
+ * + * @param prefix + * the substring that the returned matcher will expect at the start of any examined string + */ + public static Matcher startsWithIgnoringCase(java.lang.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 + */ + public static Matcher endsWith(java.lang.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: + *
assertThat("myStringOfNote", endsWithIgnoringCase("note"))
+ * + * @param suffix + * the substring that the returned matcher will expect at the end of any examined string + */ + public static Matcher endsWithIgnoringCase(java.lang.String suffix) { + return org.hamcrest.core.StringEndsWith.endsWithIgnoringCase(suffix); + } + + /** + * Validate a string with a {@link java.util.regex.Pattern}. + * + *
+   * assertThat("abc", matchesRegex(Pattern.compile("ˆ[a-z]$"));
+   * 
+ * + * @param pattern + * the pattern to be used. + * @return The matcher. + */ + public static Matcher matchesRegex(Pattern pattern) { + return StringRegularExpression.matchesRegex(pattern); + } + + /** + * Validate a string with a regex. + * + *
+   * assertThat("abc", matchesRegex("ˆ[a-z]+$"));
+   * 
+ * + * @param regex + * The regex to be used for the validation. + * @return The 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: + *
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
+ * + * @param elementMatchers + * the matchers that the elements of examined arrays should satisfy + */ + @SafeVarargs + public static org.hamcrest.collection.IsArray array(org.hamcrest.Matcher... 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: + *
assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
+ * + * @param elementMatcher + * the matcher to apply to elements in examined arrays + */ + public static org.hamcrest.Matcher hasItemInArray(org.hamcrest.Matcher 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 element + * the element that should be present in examined arrays + */ + public static org.hamcrest.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: + *
assertThat(new String[]{"foo", "bar"}, arrayContaining("foo", "bar"))
+ * + * @param items + * the items that must equal the items within an examined array + */ + @SafeVarargs + public static org.hamcrest.Matcher arrayContaining(E... 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: + *
assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))
+ * + * @param itemMatchers + * the matchers that must be satisfied by the items in the examined array + */ + @SafeVarargs + public static org.hamcrest.Matcher arrayContaining(org.hamcrest.Matcher... 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: + *
assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by the corresponding item in an examined array + */ + public static org.hamcrest.Matcher arrayContaining(java.util.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. + *

+ *

+ * For example: + *

+ *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by an entry in an examined array + */ + @SafeVarargs + public static org.hamcrest.Matcher arrayContainingInAnyOrder(org.hamcrest.Matcher... 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. + *

+ *

+ * For example: + *

+ *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by an item provided by an examined array + */ + public static org.hamcrest.Matcher arrayContainingInAnyOrder(java.util.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. + *

+ *

+ * For example: + *

+ *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder("bar", "foo"))
+ * + * @param items + * the items that must equal the entries of an examined array, in any order + */ + @SafeVarargs + public static org.hamcrest.Matcher arrayContainingInAnyOrder(E... items) { + return ArrayMatching.arrayContainingInAnyOrder(items); + } + + /** + * Creates a matcher for arrays that matches when the length of the array + * satisfies the specified matcher. + * For example: + *
assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
+ * + * @param sizeMatcher + * a matcher for the length of an examined array + */ + public static org.hamcrest.Matcher arrayWithSize(org.hamcrest.Matcher 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: + *
assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
+ * + * @param size + * the length that an examined array must have for a positive match + */ + public static org.hamcrest.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())
+ */ + public static org.hamcrest.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 sizeMatcher + * a matcher for the size of an examined {@link java.util.Map} + */ + public static org.hamcrest.Matcher> aMapWithSize(org.hamcrest.Matcher sizeMatcher) { + return org.hamcrest.collection.IsMapWithSize.aMapWithSize(sizeMatcher); + } + + /** + * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns + * a value equal to the specified size. + * For example: + *
assertThat(myMap, is(aMapWithSize(2)))
+ * + * @param size + * the expected size of an examined {@link java.util.Map} + */ + public static org.hamcrest.Matcher> aMapWithSize(int size) { + return org.hamcrest.collection.IsMapWithSize.aMapWithSize(size); + } + + /** + * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns + * zero. + * For example: + *
assertThat(myMap, is(anEmptyMap()))
+ */ + public static org.hamcrest.Matcher> anEmptyMap() { + return org.hamcrest.collection.IsMapWithSize.anEmptyMap(); + } + + /** + * Creates a matcher for {@link java.util.Collection}s that matches when the size() method returns + * a value that satisfies the specified matcher. + * For example: + *
assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
+ * + * @param sizeMatcher + * a matcher for the size of an examined {@link java.util.Collection} + */ + public static org.hamcrest.Matcher> hasSize(org.hamcrest.Matcher sizeMatcher) { + return org.hamcrest.collection.IsCollectionWithSize.hasSize(sizeMatcher); + } + + /** + * Creates a matcher for {@link java.util.Collection}s that matches when the size() method returns + * a value equal to the specified size. + * For example: + *
assertThat(Arrays.asList("foo", "bar"), hasSize(2))
+ * + * @param size + * the expected size of an examined {@link java.util.Collection} + */ + public static org.hamcrest.Matcher> hasSize(int size) { + return org.hamcrest.collection.IsCollectionWithSize.hasSize(size); + } + + /** + * Creates a matcher for {@link java.util.Collection}s matching examined collections whose isEmpty + * method returns true. + * For example: + *
assertThat(new ArrayList<String>(), is(empty()))
+ */ + public static org.hamcrest.Matcher> empty() { + return org.hamcrest.collection.IsEmptyCollection.empty(); + } + + /** + * Creates a matcher for {@link java.util.Collection}s matching examined collections whose isEmpty + * method returns true. + * For example: + *
assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
+ * + * @param unusedToForceReturnType + * the type of the collection's content + */ + public static org.hamcrest.Matcher> emptyCollectionOf(java.lang.Class unusedToForceReturnType) { + return org.hamcrest.collection.IsEmptyCollection.emptyCollectionOf(unusedToForceReturnType); + } + + /** + * Creates a matcher for {@link Iterable}s matching examined iterables that yield no items. + * For example: + *
assertThat(new ArrayList<String>(), is(emptyIterable()))
+ */ + public static org.hamcrest.Matcher> emptyIterable() { + return org.hamcrest.collection.IsEmptyIterable.emptyIterable(); + } + + /** + * Creates a matcher for {@link Iterable}s matching examined iterables that yield no items. + * For example: + *
assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
+ * + * @param unusedToForceReturnType + * the type of the iterable's content + */ + public static org.hamcrest.Matcher> emptyIterableOf(java.lang.Class unusedToForceReturnType) { + return org.hamcrest.collection.IsEmptyIterable.emptyIterableOf(unusedToForceReturnType); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, each logically equal to the + * corresponding item in the specified items. For a positive match, the examined iterable + * must be of the same length as the number of specified items. + * For example: + *
assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
+ * + * @param items + * the items that must equal the items provided by an examined {@link Iterable} + */ + @SafeVarargs + public static org.hamcrest.Matcher> contains(E... items) { + return org.hamcrest.collection.IsIterableContainingInOrder.contains(items); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a single item that satisfies the specified matcher. + * For a positive match, the examined iterable must only yield one item. + * For example: + *
assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
+ * + * @param itemMatcher + * the matcher that must be satisfied by the single item provided by an + * examined {@link Iterable} + */ + public static org.hamcrest.Matcher> contains(org.hamcrest.Matcher itemMatcher) { + return org.hamcrest.collection.IsIterableContainingInOrder.contains(itemMatcher); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, each satisfying the corresponding + * matcher in the specified matchers. For a positive match, the examined iterable + * must be of the same length as the number of specified matchers. + * For example: + *
assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
+ * + * @param itemMatchers + * the matchers that must be satisfied by the items provided by an examined {@link Iterable} + */ + @SafeVarargs + public static org.hamcrest.Matcher> contains(org.hamcrest.Matcher... itemMatchers) { + return org.hamcrest.collection.IsIterableContainingInOrder.contains(itemMatchers); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, each satisfying the corresponding + * matcher in the specified list of matchers. For a positive match, the examined iterable + * must be of the same length as the specified list of matchers. + * For example: + *
assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by the corresponding item provided by + * an examined {@link Iterable} + */ + public static org.hamcrest.Matcher> contains(java.util.List> itemMatchers) { + return org.hamcrest.collection.IsIterableContainingInOrder.contains(itemMatchers); + } + + /** + *

+ * Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over + * the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere + * in the specified matchers. For a positive match, the examined iterable 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 + * iterable. + *

+ *

+ * For example: + *

+ *
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} + */ + @SafeVarargs + public static org.hamcrest.Matcher> containsInAnyOrder(org.hamcrest.Matcher... itemMatchers) { + return org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder(itemMatchers); + } + + /** + *

+ * Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over + * the examined {@link Iterable} yields a series of items, each logically equal to one item + * anywhere in the specified items. For a positive match, the examined iterable + * 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 + * iterable. + *

+ *

+ * For example: + *

+ *
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
+ * + * @param items + * the items that must equal the items provided by an examined {@link Iterable} in any order + */ + @SafeVarargs + public static org.hamcrest.Matcher> containsInAnyOrder(T... items) { + return org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder(items); + } + + /** + *

+ * Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over + * the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere + * in the specified collection of matchers. For a positive match, the examined iterable + * 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 iterable. + *

+ *

For example:

+ *
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} + */ + public static org.hamcrest.Matcher> containsInAnyOrder(java.util.Collection> itemMatchers) { + return org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder(itemMatchers); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, that contains items logically equal to the + * corresponding item in the specified items, in the same relative order + * For example: + *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
+ * + * @param items + * the items that must be contained within items provided by an examined {@link Iterable} in the same relative order + */ + @SafeVarargs + public static org.hamcrest.Matcher> containsInRelativeOrder(E... items) { + return org.hamcrest.collection.IsIterableContainingInRelativeOrder.containsInRelativeOrder(items); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, that each satisfying the corresponding + * matcher in the specified matchers, in the same relative order. + * For example: + *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
+ * + * @param itemMatchers + * the matchers that must be satisfied by the items provided by an examined {@link Iterable} in the same relative order + */ + @SafeVarargs + public static org.hamcrest.Matcher> containsInRelativeOrder(org.hamcrest.Matcher... itemMatchers) { + return org.hamcrest.collection.IsIterableContainingInRelativeOrder.containsInRelativeOrder(itemMatchers); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, that contains items satisfying the corresponding + * matcher in the specified list of matchers, in the same relative order. + * For example: + *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by the items provided by + * an examined {@link Iterable} in the same relative order + */ + public static org.hamcrest.Matcher> containsInRelativeOrder(java.util.List> itemMatchers) { + return org.hamcrest.collection.IsIterableContainingInRelativeOrder.containsInRelativeOrder(itemMatchers); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields an item count that satisfies the specified + * matcher. + * For example: + *
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
+ * + * @param sizeMatcher + * a matcher for the number of items that should be yielded by an examined {@link Iterable} + */ + public static org.hamcrest.Matcher> iterableWithSize(org.hamcrest.Matcher sizeMatcher) { + return org.hamcrest.collection.IsIterableWithSize.iterableWithSize(sizeMatcher); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields an item count that is equal to the specified + * size argument. + * For example: + *
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
+ * + * @param size + * the number of items that should be yielded by an examined {@link Iterable} + */ + public static org.hamcrest.Matcher> iterableWithSize(int size) { + return org.hamcrest.collection.IsIterableWithSize.iterableWithSize(size); + } + + /** + * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains + * at least one entry whose key satisfies the specified keyMatcher and whose + * value satisfies the specified valueMatcher. + * For example: + *
assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
+ * + * @param keyMatcher + * the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry + * @param valueMatcher + * the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry + */ + public static org.hamcrest.Matcher> hasEntry(org.hamcrest.Matcher keyMatcher, org.hamcrest.Matcher valueMatcher) { + return org.hamcrest.collection.IsMapContaining.hasEntry(keyMatcher, valueMatcher); + } + + /** + * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains + * at least one entry whose key equals the specified key and whose value equals the + * specified value. + * For example: + *
assertThat(myMap, hasEntry("bar", "foo"))
+ * + * @param key + * the key that, in combination with the value, must be describe at least one entry + * @param value + * the value that, in combination with the key, must be describe at least one entry + */ + public static org.hamcrest.Matcher> hasEntry(K key, V value) { + return org.hamcrest.collection.IsMapContaining.hasEntry(key, value); + } + + /** + * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains + * at least one key that satisfies the specified matcher. + * For example: + *
assertThat(myMap, hasKey(equalTo("bar")))
+ * + * @param keyMatcher + * the matcher that must be satisfied by at least one key + */ + public static org.hamcrest.Matcher> hasKey(org.hamcrest.Matcher keyMatcher) { + return org.hamcrest.collection.IsMapContaining.hasKey(keyMatcher); + } + + /** + * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains + * at least one key that is equal to the specified key. + * For example: + *
assertThat(myMap, hasKey("bar"))
+ * + * @param key + * the key that satisfying maps must contain + */ + public static org.hamcrest.Matcher> hasKey(K key) { + return org.hamcrest.collection.IsMapContaining.hasKey(key); + } + + /** + * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains + * at least one value that satisfies the specified valueMatcher. + * For example: + *
assertThat(myMap, hasValue(equalTo("foo")))
+ * + * @param valueMatcher + * the matcher that must be satisfied by at least one value + */ + public static org.hamcrest.Matcher> hasValue(org.hamcrest.Matcher valueMatcher) { + return org.hamcrest.collection.IsMapContaining.hasValue(valueMatcher); + } + + /** + * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains + * at least one value that is equal to the specified value. + * For example: + *
assertThat(myMap, hasValue("foo"))
+ * + * @param value + * the value that satisfying maps must contain + */ + public static org.hamcrest.Matcher> hasValue(V value) { + return org.hamcrest.collection.IsMapContaining.hasValue(value); + } + + /** + * Creates a matcher that matches when the examined object is found within the + * specified collection. + * For example: + *
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
+ * + * @param collection + * the collection in which matching items must be found + */ + public static org.hamcrest.Matcher in(java.util.Collection collection) { + return org.hamcrest.collection.IsIn.in(collection); + } + + /** + * Creates a matcher that matches when the examined object is found within the + * specified array. + * For example: + *
assertThat("foo", is(in(new String[]{"bar", "foo"})))
+ * + * @param elements + * the array in which matching items must be found + */ + public static org.hamcrest.Matcher in(T[] elements) { + return org.hamcrest.collection.IsIn.in(elements); + } + + /** + * Creates a matcher that matches when the examined object is found within the + * specified collection. + * For example: + *
assertThat("foo", isIn(Arrays.asList("bar", "foo")))
+ * + * @deprecated use is(in(...)) instead + * @param collection + * the collection in which matching items must be found + */ + @SuppressWarnings("deprecation") + public static org.hamcrest.Matcher isIn(java.util.Collection collection) { + return org.hamcrest.collection.IsIn.isIn(collection); + } + + /** + * Creates a matcher that matches when the examined object is found within the + * specified array. + * For example: + *
assertThat("foo", isIn(new String[]{"bar", "foo"}))
+ * + * @deprecated use is(in(...)) instead + * @param elements + * the array in which matching items must be found + */ + @SuppressWarnings("deprecation") + public static org.hamcrest.Matcher isIn(T[] elements) { + return org.hamcrest.collection.IsIn.isIn(elements); + } + + /** + * Creates a matcher that matches when the examined object is equal to one of the + * specified elements. + * For example: + *
assertThat("foo", isOneOf("bar", "foo"))
+ * + * @deprecated use is(oneOf(...)) instead + * @param elements + * the elements amongst which matching items will be found + */ + @SuppressWarnings("deprecation") + @SafeVarargs + public static org.hamcrest.Matcher isOneOf(T... elements) { + return org.hamcrest.collection.IsIn.isOneOf(elements); + } + + /** + * Creates a matcher that matches when the examined object is equal to one of the + * specified elements. + * For example: + *
assertThat("foo", is(oneOf("bar", "foo")))
+ * + * @param elements + * the elements amongst which matching items will be found + */ + @SafeVarargs + public static org.hamcrest.Matcher oneOf(T... elements) { + return org.hamcrest.collection.IsIn.oneOf(elements); + } + + /** + * Creates a matcher of {@link Double}s that matches when an examined double is equal + * to the specified operand, within a range of +/- error. + * For example: + *
assertThat(1.03, is(closeTo(1.0, 0.03)))
+ * + * @param operand + * the expected value of matching doubles + * @param error + * the delta (+/-) within which matches will be allowed + */ + public static org.hamcrest.Matcher closeTo(double operand, double error) { + return org.hamcrest.number.IsCloseTo.closeTo(operand, error); + } + + /** + * Creates a matcher of {@link Double}s that matches when an examined double is not a number. + * For example: + *
assertThat(Double.NaN, is(notANumber()))
+ */ + public static org.hamcrest.Matcher notANumber() { + return org.hamcrest.number.IsNaN.notANumber(); + } + + /** + * Creates a matcher of {@link java.math.BigDecimal}s that matches when an examined BigDecimal is equal + * to the specified operand, within a range of +/- error. The comparison for equality + * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method. + * For example: + *
assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
+ * + * @param operand + * the expected value of matching BigDecimals + * @param error + * the delta (+/-) within which matches will be allowed + */ + public static org.hamcrest.Matcher closeTo(java.math.BigDecimal operand, java.math.BigDecimal error) { + return org.hamcrest.number.BigDecimalCloseTo.closeTo(operand, error); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * equal to the specified value, as reported by the compareTo method of the + * examined object. + * For example: + *
assertThat(1, comparesEqualTo(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return zero + */ + public static > org.hamcrest.Matcher comparesEqualTo(T value) { + return org.hamcrest.number.OrderingComparison.comparesEqualTo(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * greater than the specified value, as reported by the compareTo method of the + * examined object. + * For example: + *
assertThat(2, greaterThan(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return greater + * than zero + */ + public static > org.hamcrest.Matcher greaterThan(T value) { + return org.hamcrest.number.OrderingComparison.greaterThan(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * greater than or equal to the specified value, as reported by the compareTo method + * of the examined object. + * For example: + *
assertThat(1, greaterThanOrEqualTo(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return greater + * than or equal to zero + */ + public static > org.hamcrest.Matcher greaterThanOrEqualTo(T value) { + return org.hamcrest.number.OrderingComparison.greaterThanOrEqualTo(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * less than the specified value, as reported by the compareTo method of the + * examined object. + * For example: + *
assertThat(1, lessThan(2))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return less + * than zero + */ + public static > org.hamcrest.Matcher lessThan(T value) { + return org.hamcrest.number.OrderingComparison.lessThan(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * less than or equal to the specified value, as reported by the compareTo method + * of the examined object. + * For example: + *
assertThat(1, lessThanOrEqualTo(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return less + * than or equal to zero + */ + public static > org.hamcrest.Matcher lessThanOrEqualTo(T value) { + return org.hamcrest.number.OrderingComparison.lessThanOrEqualTo(value); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string is equal to + * the specified expectedString, ignoring case. + * For example: + *
assertThat("Foo", equalToIgnoringCase("FOO"))
+ * + * @param expectedString + * the expected value of matched strings + */ + public static Matcher equalToIgnoringCase(java.lang.String expectedString) { + return org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase(expectedString); + } + + /** + * @deprecated {@link #equalToCompressingWhiteSpace(String)} + * @param expectedString + * the expected value of matched strings + */ + public static Matcher equalToIgnoringWhiteSpace(java.lang.String expectedString) { + return equalToCompressingWhiteSpace(expectedString); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string is equal to + * the specified expectedString, when whitespace differences are (mostly) ignored. To be + * exact, the following whitespace rules are applied: + *
    + *
  • all leading and trailing whitespace of both the expectedString and the examined string are ignored
  • + *
  • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
  • + *
+ * For example: + *
assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
+ * + * @param expectedString + * the expected value of matched strings + */ + public static Matcher equalToCompressingWhiteSpace(java.lang.String expectedString) { + return IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace(expectedString); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string is null, or + * has zero length. + * For example: + *
assertThat(((String)null), is(emptyOrNullString()))
+ */ + public static Matcher emptyOrNullString() { + return org.hamcrest.text.IsEmptyString.emptyOrNullString(); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string has zero length. + * For example: + *
assertThat("", is(emptyString()))
+ */ + public static Matcher emptyString() { + return org.hamcrest.text.IsEmptyString.emptyString(); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string is null, or + * has zero length. + * For example: + *
assertThat(((String)null), isEmptyOrNullString())
+ * + * @deprecated use is(emptyOrNullString()) instead + */ + @SuppressWarnings("deprecation") + public static Matcher isEmptyOrNullString() { + return org.hamcrest.text.IsEmptyString.isEmptyOrNullString(); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string has zero length. + * For example: + *
assertThat("", isEmptyString())
+ * + * @deprecated use is(emptyString()) instead + */ + @SuppressWarnings("deprecation") + public static Matcher isEmptyString() { + return org.hamcrest.text.IsEmptyString.isEmptyString(); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string is null, or + * contains zero or more whitespace characters and nothing else. + * For example: + *
assertThat(((String)null), is(blankOrNullString()))
+ */ + public static Matcher blankOrNullString() { + return org.hamcrest.text.IsBlankString.blankOrNullString(); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string contains + * zero or more whitespace characters and nothing else. + * For example: + *
assertThat("  ", is(blankString()))
+ */ + public static Matcher blankString() { + return org.hamcrest.text.IsBlankString.blankString(); + } + + /** + * Creates a matcher of {@link java.lang.String} that matches when the examined string + * exactly matches the given {@link java.util.regex.Pattern}. + */ + public static Matcher matchesPattern(java.util.regex.Pattern pattern) { + return org.hamcrest.text.MatchesPattern.matchesPattern(pattern); + } + + /** + * Creates a matcher of {@link java.lang.String} that matches when the examined string + * exactly matches the given regular expression, treated as a {@link java.util.regex.Pattern}. + */ + public static Matcher matchesPattern(java.lang.String regex) { + return org.hamcrest.text.MatchesPattern.matchesPattern(regex); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string contains all of + * the specified substrings, considering the order of their appearance. + * For example: + *
assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
+ * fails as "foo" occurs before "bar" in the string "myfoobarbaz" + * + * @param substrings + * the substrings that must be contained within matching strings + */ + public static Matcher stringContainsInOrder(java.lang.Iterable substrings) { + return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string contains all of + * the specified substrings, considering the order of their appearance. + * For example: + *
assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
+ * fails as "foo" occurs before "bar" in the string "myfoobarbaz" + * + * @param substrings + * the substrings that must be contained within matching strings + */ + public static Matcher stringContainsInOrder(java.lang.String... substrings) { + return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); + } + + /** + * Creates a matcher of {@link CharSequence} that matches when a char sequence has the length + * of the specified argument. + * For example: + * + *
+     * assertThat("text", length(4))
+     * 
+ * + * @param length the expected length of the string + */ + public static Matcher hasLength(int length) { + return org.hamcrest.text.CharSequenceLength.hasLength(length); + } + + /** + * Creates a matcher that matches any examined object whose toString method + * returns a value that satisfies the specified matcher. + * For example: + *
assertThat(true, hasToString(equalTo("TRUE")))
+ * + * @param toStringMatcher + * the matcher used to verify the toString result + */ + public static org.hamcrest.Matcher hasToString(org.hamcrest.Matcher toStringMatcher) { + return org.hamcrest.object.HasToString.hasToString(toStringMatcher); + } + + /** + * Creates a matcher that matches any examined object whose toString method + * returns a value equalTo the specified string. + * For example: + *
assertThat(true, hasToString("TRUE"))
+ * + * @param expectedToString + * the expected toString result + */ + public static org.hamcrest.Matcher hasToString(java.lang.String expectedToString) { + return org.hamcrest.object.HasToString.hasToString(expectedToString); + } + + /** + * Creates a matcher of {@link Class} that matches when the specified baseType is + * assignable from the examined class. + * For example: + *
assertThat(Integer.class, typeCompatibleWith(Number.class))
+ * + * @param baseType + * the base class to examine classes against + */ + public static org.hamcrest.Matcher> typeCompatibleWith(java.lang.Class baseType) { + return org.hamcrest.object.IsCompatibleType.typeCompatibleWith(baseType); + } + + /** + * Creates a matcher of {@link java.util.EventObject} that matches any object + * derived from eventClass announced by source. + * For example: + *
assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
+ * + * @param eventClass + * the class of the event to match on + * @param source + * the source of the event + */ + public static org.hamcrest.Matcher eventFrom(java.lang.Class eventClass, java.lang.Object source) { + return org.hamcrest.object.IsEventFrom.eventFrom(eventClass, source); + } + + /** + * Creates a matcher of {@link java.util.EventObject} that matches any EventObject + * announced by source. + * For example: + *
assertThat(myEvent, is(eventFrom(myBean)))
+ * + * @param source + * the source of the event + */ + public static org.hamcrest.Matcher eventFrom(java.lang.Object source) { + return org.hamcrest.object.IsEventFrom.eventFrom(source); + } + + /** + * Creates a matcher that matches when the examined object has a JavaBean property + * with the specified name. + * For example: + *
assertThat(myBean, hasProperty("foo"))
+ * + * @param propertyName + * the name of the JavaBean property that examined beans should possess + */ + public static org.hamcrest.Matcher hasProperty(java.lang.String propertyName) { + return org.hamcrest.beans.HasProperty.hasProperty(propertyName); + } + + /** + * Creates a matcher that matches when the examined object has a JavaBean property + * with the specified name whose value satisfies the specified matcher. + * For example: + *
assertThat(myBean, hasProperty("foo", equalTo("bar"))
+ * + * @param propertyName + * the name of the JavaBean property that examined beans should possess + * @param valueMatcher + * a matcher for the value of the specified property of the examined bean + */ + public static org.hamcrest.Matcher hasProperty(java.lang.String propertyName, org.hamcrest.Matcher valueMatcher) { + return org.hamcrest.beans.HasPropertyWithValue.hasProperty(propertyName, valueMatcher); + } + + /** + * Creates a matcher that matches when the examined object has values for all of + * its JavaBean properties that are equal to the corresponding values of the + * specified bean. If any properties are marked as ignored, they will be dropped from + * both the expected and actual bean. Note that the ignored properties use JavaBean + * display names, for example
age
rather than method names such as
getAge
. + * For example: + *
assertThat(myBean, samePropertyValuesAs(myExpectedBean))
+ *
assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
+ * + * @param expectedBean + * the bean against which examined beans are compared + * @param ignoredProperties + * do not check any of these named properties. + */ + public static Matcher samePropertyValuesAs(B expectedBean, String... ignoredProperties) { + return org.hamcrest.beans.SamePropertyValuesAs.samePropertyValuesAs(expectedBean, ignoredProperties); + } + + /** + * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the + * specified xPath that satisfies the specified valueMatcher. + * For example: + *
assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
+ * + * @param xPath + * the target xpath + * @param valueMatcher + * matcher for the value at the specified xpath + */ + public static org.hamcrest.Matcher hasXPath(java.lang.String xPath, Matcher valueMatcher) { + return org.hamcrest.xml.HasXPath.hasXPath(xPath, valueMatcher); + } + + /** + * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the + * specified xPath, within the specified namespaceContext, that satisfies + * the specified valueMatcher. + * For example: + *
assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
+ * + * @param xPath + * the target xpath + * @param namespaceContext + * the namespace for matching nodes + * @param valueMatcher + * matcher for the value at the specified xpath + */ + public static org.hamcrest.Matcher hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext, Matcher valueMatcher) { + return org.hamcrest.xml.HasXPath.hasXPath(xPath, namespaceContext, valueMatcher); + } + + /** + * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node + * at the specified xPath, with any content. + * For example: + *
assertThat(xml, hasXPath("/root/something[2]/cheese"))
+ * + * @param xPath + * the target xpath + */ + public static org.hamcrest.Matcher hasXPath(java.lang.String xPath) { + return org.hamcrest.xml.HasXPath.hasXPath(xPath); + } + + /** + * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node + * at the specified xPath within the specified namespace context, with any content. + * For example: + *
assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
+ * + * @param xPath + * the target xpath + * @param namespaceContext + * the namespace for matching nodes + */ + public static org.hamcrest.Matcher hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext) { + return org.hamcrest.xml.HasXPath.hasXPath(xPath, namespaceContext); + } + + +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/SelfDescribing.java b/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/SelfDescribing.java rename to hamcrest/src/main/java/org/hamcrest/SelfDescribing.java diff --git a/hamcrest-core/src/main/java/org/hamcrest/StringDescription.java b/hamcrest/src/main/java/org/hamcrest/StringDescription.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/StringDescription.java rename to hamcrest/src/main/java/org/hamcrest/StringDescription.java diff --git a/hamcrest-core/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java similarity index 88% rename from hamcrest-core/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java rename to hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java index c204120a..03efa9db 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java @@ -60,9 +60,14 @@ public final boolean matches(Object item) { @SuppressWarnings("unchecked") @Override public final void describeMismatch(Object item, Description mismatchDescription) { - if (item == null || !expectedType.isInstance(item)) { - super.describeMismatch(item, mismatchDescription); - } else { + if (item == null) { + mismatchDescription.appendText("was null"); + } else if (!expectedType.isInstance(item)) { + mismatchDescription.appendText("was ") + .appendText(item.getClass().getSimpleName()) + .appendText(" ") + .appendValue(item); + } else { matchesSafely((T) item, mismatchDescription); } } diff --git a/hamcrest-core/src/main/java/org/hamcrest/TypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java similarity index 98% rename from hamcrest-core/src/main/java/org/hamcrest/TypeSafeMatcher.java rename to hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java index a7243c76..08dfce8b 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/TypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java @@ -71,7 +71,7 @@ public final boolean matches(Object item) { @Override final public void describeMismatch(Object item, Description description) { if (item == null) { - super.describeMismatch(item, description); + super.describeMismatch(null, description); } else if (! expectedType.isInstance(item)) { description.appendText("was a ") .appendText(item.getClass().getName()) diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/HasProperty.java b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java similarity index 94% rename from hamcrest-library/src/main/java/org/hamcrest/beans/HasProperty.java rename to hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java index 4fc3059b..320a49ef 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/HasProperty.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java @@ -1,9 +1,6 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.beans; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; @@ -46,14 +43,12 @@ public void describeTo(Description description) { /** * Creates a matcher that matches when the examined object has a JavaBean property * with the specified name. - *

* For example: *

assertThat(myBean, hasProperty("foo"))
* * @param propertyName * the name of the JavaBean property that examined beans should possess */ - @Factory public static Matcher hasProperty(String propertyName) { return new HasProperty(propertyName); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java similarity index 69% rename from hamcrest-library/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java rename to hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java index 5d1958f4..29b299b8 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java @@ -1,26 +1,28 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.beans; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; - import org.hamcrest.Condition; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; +import java.beans.PropertyDescriptor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.ListIterator; + import static org.hamcrest.Condition.matched; import static org.hamcrest.Condition.notMatched; import static org.hamcrest.beans.PropertyUtil.NO_ARGUMENTS; /** - * Matcher that asserts that a JavaBean property on an argument passed to the + *

Matcher that asserts that a JavaBean property on an argument passed to the * mock object meets the provided matcher. This is useful for when objects * are created within code under test and passed to a mock object, and you wish * to assert that the created object has certain properties. - *

+ *

+ * *

Example Usage

* Consider the situation where we have a class representing a person, which * follows the basic JavaBean convention of having get() and possibly set() @@ -51,29 +53,36 @@ * personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain"))); * PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy(); * - * If an exception is thrown by the getter method for a property, the property + *

If an exception is thrown by the getter method for a property, the property * does not exist, is not readable, or a reflection related exception is thrown * when trying to invoke it then this is treated as an evaluation failure and * the matches method will return false. - *

- * This matcher class will also work with JavaBean objects that have explicit + *

+ *

This matcher class will also work with JavaBean objects that have explicit * bean descriptions via an associated BeanInfo description class. See the * JavaBeans specification for more information: - *

* http://java.sun.com/products/javabeans/docs/index.html + *

* * @author Iain McGinniss * @author Nat Pryce * @author Steve Freeman + * @author cristcost at github */ public class HasPropertyWithValue extends TypeSafeDiagnosingMatcher { private static final Condition.Step WITH_READ_METHOD = withReadMethod(); private final String propertyName; private final Matcher valueMatcher; + private final String messageFormat; public HasPropertyWithValue(String propertyName, Matcher valueMatcher) { + this(propertyName, valueMatcher, " property '%s' "); + } + + public HasPropertyWithValue(String propertyName, Matcher valueMatcher, String messageFormat) { this.propertyName = propertyName; this.valueMatcher = nastyGenericsWorkaround(valueMatcher); + this.messageFormat = messageFormat; } @Override @@ -81,7 +90,7 @@ public boolean matchesSafely(T bean, Description mismatch) { return propertyOn(bean, mismatch) .and(WITH_READ_METHOD) .and(withPropertyValue(bean)) - .matching(valueMatcher, "property '" + propertyName + "' "); + .matching(valueMatcher, String.format(messageFormat, propertyName)); } @Override @@ -106,9 +115,16 @@ private Condition.Step withPropertyValue(final T bean) { public Condition apply(Method readMethod, Description mismatch) { try { return matched(readMethod.invoke(bean, NO_ARGUMENTS), mismatch); - } catch (Exception e) { - mismatch.appendText(e.getMessage()); + } catch (InvocationTargetException e) { + mismatch + .appendText("Calling '") + .appendText(readMethod.toString()) + .appendText("': ") + .appendValue(e.getTargetException().getMessage()); return notMatched(); + } catch (Exception e) { + throw new IllegalStateException( + "Calling: '" + readMethod + "' should not have thrown " + e); } } }; @@ -136,7 +152,6 @@ public Condition apply(PropertyDescriptor property, Description mismatch /** * Creates a matcher that matches when the examined object has a JavaBean property * with the specified name whose value satisfies the specified matcher. - *

* For example: *

assertThat(myBean, hasProperty("foo", equalTo("bar"))
* @@ -145,8 +160,33 @@ public Condition apply(PropertyDescriptor property, Description mismatch * @param valueMatcher * a matcher for the value of the specified property of the examined bean */ - @Factory public static Matcher hasProperty(String propertyName, Matcher valueMatcher) { - return new HasPropertyWithValue(propertyName, valueMatcher); + return new HasPropertyWithValue<>(propertyName, valueMatcher); } + + /** + * Creates a matcher that matches when the examined object is a graph of + * JavaBean objects that can be navigated along the declared dot-separated path + * and the final element of that path is a JavaBean property whose value satisfies the + * specified matcher. + * For example: + *
assertThat(myBean, hasProperty("foo.bar.baz", equalTo("a property value"))
+ * + * @param path + * the dot-separated path from the examined object to the JavaBean property + * @param valueMatcher + * a matcher for the value of the specified property of the examined bean + */ + public static Matcher hasPropertyAtPath(String path, Matcher valueMatcher) { + List properties = Arrays.asList(path.split("\\.")); + ListIterator iterator = + properties.listIterator(properties.size()); + + Matcher ret = valueMatcher; + while (iterator.hasPrevious()) { + ret = new HasPropertyWithValue<>(iterator.previous(), ret, "%s."); + } + return ret; + } + } diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/PropertyUtil.java b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java similarity index 97% rename from hamcrest-library/src/main/java/org/hamcrest/beans/PropertyUtil.java rename to hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java index 3dd12e8c..946c4f84 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/PropertyUtil.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java @@ -1,5 +1,3 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.beans; import java.beans.IntrospectionException; @@ -8,7 +6,6 @@ /** * Utility class for accessing properties on JavaBean objects. - *

* See http://java.sun.com/products/javabeans/docs/index.html for * more information on JavaBeans. * diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java similarity index 51% rename from hamcrest-library/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java rename to hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java index bade84c4..4799aeaa 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java @@ -1,55 +1,63 @@ package org.hamcrest.beans; -import org.hamcrest.*; +import org.hamcrest.Description; +import org.hamcrest.DiagnosingMatcher; +import org.hamcrest.Matcher; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; +import static java.util.Arrays.asList; import static org.hamcrest.beans.PropertyUtil.NO_ARGUMENTS; import static org.hamcrest.beans.PropertyUtil.propertyDescriptorsFor; import static org.hamcrest.core.IsEqual.equalTo; -public class SamePropertyValuesAs extends TypeSafeDiagnosingMatcher { +public class SamePropertyValuesAs extends DiagnosingMatcher { private final T expectedBean; private final Set propertyNames; private final List propertyMatchers; + private final List ignoredFields; - - public SamePropertyValuesAs(T expectedBean) { + @SuppressWarnings("WeakerAccess") + public SamePropertyValuesAs(T expectedBean, List ignoredProperties) { PropertyDescriptor[] descriptors = propertyDescriptorsFor(expectedBean, Object.class); this.expectedBean = expectedBean; - this.propertyNames = propertyNamesFrom(descriptors); - this.propertyMatchers = propertyMatchersFor(expectedBean, descriptors); + this.ignoredFields = ignoredProperties; + this.propertyNames = propertyNamesFrom(descriptors, ignoredProperties); + this.propertyMatchers = propertyMatchersFor(expectedBean, descriptors, ignoredProperties); } @Override - public boolean matchesSafely(T bean, Description mismatch) { - return isCompatibleType(bean, mismatch) - && hasNoExtraProperties(bean, mismatch) - && hasMatchingValues(bean, mismatch); + protected boolean matches(Object actual, Description mismatch) { + return isNotNull(actual, mismatch) + && isCompatibleType(actual, mismatch) + && hasNoExtraProperties(actual, mismatch) + && hasMatchingValues(actual, mismatch); } @Override public void describeTo(Description description) { description.appendText("same property values as " + expectedBean.getClass().getSimpleName()) .appendList(" [", ", ", "]", propertyMatchers); + if (! ignoredFields.isEmpty()) { + description.appendText(" ignoring ") + .appendValueList("[", ", ", "]", ignoredFields); + } } - private boolean isCompatibleType(T item, Description mismatchDescription) { - if (!expectedBean.getClass().isAssignableFrom(item.getClass())) { - mismatchDescription.appendText("is incompatible type: " + item.getClass().getSimpleName()); - return false; + private boolean isCompatibleType(Object actual, Description mismatchDescription) { + if (expectedBean.getClass().isAssignableFrom(actual.getClass())) { + return true; } - return true; + + mismatchDescription.appendText("is incompatible type: " + actual.getClass().getSimpleName()); + return false; } - private boolean hasNoExtraProperties(T item, Description mismatchDescription) { - Set actualPropertyNames = propertyNamesFrom(propertyDescriptorsFor(item, Object.class)); + private boolean hasNoExtraProperties(Object actual, Description mismatchDescription) { + Set actualPropertyNames = propertyNamesFrom(propertyDescriptorsFor(actual, Object.class), ignoredFields); actualPropertyNames.removeAll(propertyNames); if (!actualPropertyNames.isEmpty()) { mismatchDescription.appendText("has extra properties called " + actualPropertyNames); @@ -58,33 +66,42 @@ private boolean hasNoExtraProperties(T item, Description mismatchDescription) { return true; } - private boolean hasMatchingValues(T item, Description mismatchDescription) { + private boolean hasMatchingValues(Object actual, Description mismatchDescription) { for (PropertyMatcher propertyMatcher : propertyMatchers) { - if (!propertyMatcher.matches(item)) { - propertyMatcher.describeMismatch(item, mismatchDescription); + if (!propertyMatcher.matches(actual)) { + propertyMatcher.describeMismatch(actual, mismatchDescription); return false; } } return true; } - private static List propertyMatchersFor(T bean, PropertyDescriptor[] descriptors) { - List result = new ArrayList(descriptors.length); + private static List propertyMatchersFor(T bean, PropertyDescriptor[] descriptors, List ignoredFields) { + List result = new ArrayList<>(descriptors.length); for (PropertyDescriptor propertyDescriptor : descriptors) { - result.add(new PropertyMatcher(propertyDescriptor, bean)); + if (isIgnored(ignoredFields, propertyDescriptor)) { + result.add(new PropertyMatcher(propertyDescriptor, bean)); + } } return result; } - private static Set propertyNamesFrom(PropertyDescriptor[] descriptors) { - HashSet result = new HashSet(); + private static Set propertyNamesFrom(PropertyDescriptor[] descriptors, List ignoredFields) { + HashSet result = new HashSet<>(); for (PropertyDescriptor propertyDescriptor : descriptors) { - result.add(propertyDescriptor.getDisplayName()); + if (isIgnored(ignoredFields, propertyDescriptor)) { + result.add(propertyDescriptor.getDisplayName()); + } } return result; } - public static class PropertyMatcher extends DiagnosingMatcher { + private static boolean isIgnored(List ignoredFields, PropertyDescriptor propertyDescriptor) { + return ! ignoredFields.contains(propertyDescriptor.getDisplayName()); + } + + @SuppressWarnings("WeakerAccess") + private static class PropertyMatcher extends DiagnosingMatcher { private final Method readMethod; private final Matcher matcher; private final String propertyName; @@ -123,17 +140,20 @@ private static Object readProperty(Method method, Object target) { /** * Creates a matcher that matches when the examined object has values for all of * its JavaBean properties that are equal to the corresponding values of the - * specified bean. - *

+ * specified bean. If any properties are marked as ignored, they will be dropped from + * both the expected and actual bean. Note that the ignored properties use JavaBean + * display names, for example

age
rather than method names such as
getAge
. * For example: *
assertThat(myBean, samePropertyValuesAs(myExpectedBean))
- * + *
assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
+ * * @param expectedBean * the bean against which examined beans are compared + * @param ignoredProperties + * do not check any of these named properties. */ - @Factory - public static Matcher samePropertyValuesAs(T expectedBean) { - return new SamePropertyValuesAs(expectedBean); + public static Matcher samePropertyValuesAs(B expectedBean, String... ignoredProperties) { + return new SamePropertyValuesAs<>(expectedBean, asList(ignoredProperties)); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/package.html b/hamcrest/src/main/java/org/hamcrest/beans/package.html similarity index 100% rename from hamcrest-library/src/main/java/org/hamcrest/beans/package.html rename to hamcrest/src/main/java/org/hamcrest/beans/package.html diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java new file mode 100644 index 00000000..a841a2c9 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java @@ -0,0 +1,45 @@ +package org.hamcrest.collection; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.TypeSafeMatcher; + +import java.util.Collection; + +import static java.util.Arrays.asList; + +/** + * @author Steve Freeman 2016 http://www.hamcrest.com + */ +public class ArrayAsIterableMatcher extends TypeSafeMatcher { + protected final TypeSafeDiagnosingMatcher> iterableMatcher; + private final String message; + protected final Collection> matchers; + + public ArrayAsIterableMatcher( + TypeSafeDiagnosingMatcher> iterableMatcher, + Collection> matchers, + String message) + { + this.matchers = matchers; + this.iterableMatcher = iterableMatcher; + this.message = message; + } + + @Override + public boolean matchesSafely(E[] item) { + return iterableMatcher.matches(asList(item)); + } + + @Override + public void describeMismatchSafely(E[] item, Description mismatchDescription) { + iterableMatcher.describeMismatch(asList(item), mismatchDescription); + } + + @Override + public void describeTo(Description description) { + description.appendList("[", ", ", "]", matchers) + .appendText(" ").appendText(message); + } +} diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java new file mode 100644 index 00000000..fc968e0b --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java @@ -0,0 +1,175 @@ +package org.hamcrest.collection; + +import org.hamcrest.Matcher; +import org.hamcrest.internal.NullSafety; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import static java.util.Arrays.asList; +import static org.hamcrest.core.IsEqual.equalTo; + +/** + * @author Steve Freeman 2016 http://www.hamcrest.com + * Collected helper code for converting matchers between lists and iterables. + */ +public class ArrayMatching { + + + /** + * 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: + *
assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
+ * + * @param elementMatcher + * the matcher to apply to elements in examined arrays + */ + public static Matcher hasItemInArray(Matcher elementMatcher) { + return new HasItemInArray<>(elementMatcher); + } + + /** + * A shortcut to the frequently used hasItemInArray(equalTo(x)). + * For example: + *
assertThat(hasItemInArray(x))
+ * instead of: + *
assertThat(hasItemInArray(equalTo(x)))
+ * + * @param element + * the element that should be present in examined arrays + */ + public static Matcher hasItemInArray(T element) { + return hasItemInArray(equalTo(element)); + } + + /** + *

+ * 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. + *

+ *

+ * For example: + *

+ *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by an entry in an examined array + */ + @SafeVarargs + public static Matcher arrayContainingInAnyOrder(Matcher... itemMatchers) { + return arrayContainingInAnyOrder(asList(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. + *

+ *

+ * For example: + *

+ *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by an item provided by an examined array + */ + public static Matcher arrayContainingInAnyOrder(Collection> itemMatchers) { + return new ArrayAsIterableMatcher<>(new IsIterableContainingInAnyOrder<>(itemMatchers), itemMatchers, "in any order"); + } + + /** + *

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. + *

+ *

+ * For example: + *

+ *
assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
+ * + * @param items + * the items that must equal the entries of an examined array, in any order + */ + @SafeVarargs + public static Matcher arrayContainingInAnyOrder(E... items) { + return arrayContainingInAnyOrder(asEqualMatchers(items)); + } + + /** + * 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: + *
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
+ * + * @param items + * the items that must equal the items within an examined array + */ + @SafeVarargs + public static Matcher arrayContaining(E... items) { + return arrayContaining(asEqualMatchers(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: + *
assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))
+ * + * @param itemMatchers + * the matchers that must be satisfied by the items in the examined array + */ + @SafeVarargs + public static Matcher arrayContaining(Matcher... itemMatchers) { + //required for JDK 1.6 + //noinspection RedundantTypeArguments + final List> nullSafeWithExplicitTypeMatchers = NullSafety.nullSafe(itemMatchers); + + return arrayContaining(nullSafeWithExplicitTypeMatchers); + } + + /** + * 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: + *
assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by the corresponding item in an examined array + */ + public static Matcher arrayContaining(List> itemMatchers) { + return new ArrayAsIterableMatcher<>(new IsIterableContainingInOrder<>(itemMatchers), itemMatchers, ""); + } + + public static List> asEqualMatchers(E[] items) { + final List> matchers = new ArrayList<>(); + for (E item : items) { + matchers.add(equalTo(item)); + } + return matchers; + } +} + diff --git a/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java b/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java new file mode 100644 index 00000000..5c0513c1 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java @@ -0,0 +1,40 @@ +package org.hamcrest.collection; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.TypeSafeMatcher; +import org.hamcrest.core.IsIterableContaining; + +import static java.util.Arrays.asList; + +/** + * Matches if an array contains an item satisfying a nested matcher. + */ +public class HasItemInArray extends TypeSafeMatcher { + private final Matcher elementMatcher; + private final TypeSafeDiagnosingMatcher> collectionMatcher; + + public HasItemInArray(Matcher elementMatcher) { + this.elementMatcher = elementMatcher; + this.collectionMatcher = new IsIterableContaining<>(elementMatcher); + } + + @Override + public boolean matchesSafely(T[] actual) { + return collectionMatcher.matches(asList(actual)); + } + + @Override + public void describeMismatchSafely(T[] actual, Description mismatchDescription) { + collectionMatcher.describeMismatch(asList(actual), mismatchDescription); + } + + @Override + public void describeTo(Description description) { + description + .appendText("an array containing ") + .appendDescriptionOf(elementMatcher); + } + +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java similarity index 82% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsArray.java index 9d97f12f..38f5d915 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java @@ -1,12 +1,11 @@ package org.hamcrest.collection; -import java.util.Arrays; - import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; +import java.util.Arrays; + /** * Matcher for array whose elements satisfy a sequence of matchers. * The array size must equal the number of element matchers. @@ -31,19 +30,21 @@ public boolean matchesSafely(T[] array) { @Override public void describeMismatchSafely(T[] actual, Description mismatchDescription) { - if (actual.length != elementMatchers.length) { - mismatchDescription.appendText("array length was " + actual.length); - return; - } - for (int i = 0; i < actual.length; i++) { - if (!elementMatchers[i].matches(actual[i])) { - mismatchDescription.appendText("element " + i + " was ").appendValue(actual[i]); - return; + if (actual.length != elementMatchers.length) { + mismatchDescription.appendText("array length was ").appendValue(actual.length); + return; + } + for (int i = 0; i < actual.length; i++) { + if (!elementMatchers[i].matches(actual[i])) { + mismatchDescription.appendText("element ").appendValue(i).appendText(" "); + elementMatchers[i].describeMismatch(actual[i], mismatchDescription); + return; + } } - } } @Override + @SuppressWarnings("unchecked") public void describeTo(Description description) { description.appendList(descriptionStart(), descriptionSeparator(), descriptionEnd(), Arrays.asList(elementMatchers)); @@ -83,14 +84,12 @@ protected String descriptionEnd() { * 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: *

assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
* * @param elementMatchers * the matchers that the elements of examined arrays should satisfy */ - @Factory public static IsArray array(Matcher... elementMatchers) { return new IsArray(elementMatchers); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java similarity index 89% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index d4e01f00..7e72a622 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -1,17 +1,20 @@ package org.hamcrest.collection; -import static org.hamcrest.core.IsEqual.equalTo; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import org.hamcrest.Description; -import org.hamcrest.Factory; -import org.hamcrest.Matcher; -import org.hamcrest.TypeSafeMatcher; +import static org.hamcrest.core.IsEqual.equalTo; +/** + * @deprecated As of release 2.1, replaced by {@link ArrayMatching}. + */ +@Deprecated public class IsArrayContainingInAnyOrder extends TypeSafeMatcher { private final IsIterableContainingInAnyOrder iterableMatcher; private final Collection> matchers; @@ -42,18 +45,19 @@ public void describeTo(Description description) { * 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. *

* For example: *

assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
- * + * + * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContainingInAnyOrder(Matcher[])}. + * * @param itemMatchers * a list of matchers, each of which must be satisfied by an entry in an examined array */ - @Factory public static Matcher arrayContainingInAnyOrder(Matcher... itemMatchers) { return arrayContainingInAnyOrder(Arrays.asList(itemMatchers)); } @@ -63,18 +67,19 @@ public static Matcher arrayContainingInAnyOrder(Matcher... i * 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. *

* For example: *

assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
- * + * + * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContainingInAnyOrder(Collection)}. + * * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined array */ - @Factory public static Matcher arrayContainingInAnyOrder(Collection> itemMatchers) { return new IsArrayContainingInAnyOrder(itemMatchers); } @@ -84,18 +89,19 @@ public static Matcher arrayContainingInAnyOrder(Collection + *

* 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. *

* For example: *

assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
- * + * + * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContainingInAnyOrder(Object[])}. + * * @param items * the items that must equal the entries of an examined array, in any order */ - @Factory public static Matcher arrayContainingInAnyOrder(E... items) { List> matchers = new ArrayList>(); for (E item : items) { diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java similarity index 88% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index 145f9641..c046914f 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -1,7 +1,6 @@ package org.hamcrest.collection; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; @@ -12,6 +11,9 @@ import static java.util.Arrays.asList; import static org.hamcrest.core.IsEqual.equalTo; +/** + * @deprecated As of release 2.1, replaced by {@link ArrayMatching}. + */ public class IsArrayContainingInOrder extends TypeSafeMatcher { private final Collection> matchers; private final IsIterableContainingInOrder iterableMatcher; @@ -40,14 +42,15 @@ public void describeTo(Description description) { * Creates a matcher for arrays that matcheswhen 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: *

assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
- * + * + * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContaining(Object[])}. + * * @param items * the items that must equal the items within an examined array */ - @Factory public static Matcher arrayContaining(E... items) { List> matchers = new ArrayList>(); for (E item : items) { @@ -60,14 +63,15 @@ public static Matcher arrayContaining(E... 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: *

assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
- * + * + * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContaining(Matcher[])}. + * * @param itemMatchers * the matchers that must be satisfied by the items in the examined array */ - @Factory public static Matcher arrayContaining(Matcher... itemMatchers) { return arrayContaining(asList(itemMatchers)); } @@ -76,14 +80,15 @@ public static Matcher arrayContaining(Matcher... itemMatcher * 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: *

assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
- * + * + * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContaining(List)}. + * * @param itemMatchers * a list of matchers, each of which must be satisfied by the corresponding item in an examined array */ - @Factory public static Matcher arrayContaining(List> itemMatchers) { return new IsArrayContainingInOrder(itemMatchers); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java similarity index 87% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java index 4d78983f..4ae7235e 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java @@ -1,6 +1,5 @@ package org.hamcrest.collection; -import org.hamcrest.Factory; import org.hamcrest.FeatureMatcher; import org.hamcrest.Matcher; @@ -23,29 +22,25 @@ protected Integer featureValueOf(E[] actual) { /** * Creates a matcher for arrays that matches when the length of the array * satisfies the specified matcher. - *

* For example: *

assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
* * @param sizeMatcher * a matcher for the length of an examined array */ - @Factory public static Matcher arrayWithSize(Matcher sizeMatcher) { - return new IsArrayWithSize(sizeMatcher); + return new IsArrayWithSize<>(sizeMatcher); } /** * Creates a matcher for arrays that matches when the length of the array * equals the specified size. - *

* For example: *

assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
* * @param size * the length that an examined array must have for a positive match */ - @Factory public static Matcher arrayWithSize(int size) { return arrayWithSize(equalTo(size)); } @@ -53,14 +48,11 @@ public static Matcher arrayWithSize(int size) { /** * Creates a matcher for arrays that matches when the length of the array * is zero. - *

* For example: *

assertThat(new String[0], emptyArray())
* */ - @Factory public static Matcher emptyArray() { - Matcher isEmpty = arrayWithSize(0); - return describedAs("an empty array", isEmpty); + return describedAs("an empty array", IsArrayWithSize.arrayWithSize(0)); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java similarity index 89% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java index 7e68002b..f79afdc6 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java @@ -1,6 +1,5 @@ package org.hamcrest.collection; -import org.hamcrest.Factory; import org.hamcrest.FeatureMatcher; import org.hamcrest.Matcher; @@ -24,14 +23,12 @@ protected Integer featureValueOf(Collection actual) { /** * Creates a matcher for {@link java.util.Collection}s that matches when the size() method returns * a value that satisfies the specified matcher. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
* * @param sizeMatcher * a matcher for the size of an examined {@link java.util.Collection} */ - @Factory public static Matcher> hasSize(Matcher sizeMatcher) { return new IsCollectionWithSize(sizeMatcher); } @@ -39,17 +36,15 @@ public static Matcher> hasSize(Matchersize() method returns * a value equal to the specified size. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), hasSize(2))
* * @param size * the expected size of an examined {@link java.util.Collection} */ - @Factory + @SuppressWarnings({ "rawtypes", "unchecked" }) public static Matcher> hasSize(int size) { - Matcher matcher = equalTo(size); - return IsCollectionWithSize.hasSize(matcher); + return (Matcher)IsCollectionWithSize.hasSize(equalTo(size)); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java similarity index 85% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java index 0626399c..481b08c3 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java @@ -1,12 +1,11 @@ package org.hamcrest.collection; -import java.util.Collection; - import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; +import java.util.Collection; + /** * Tests if collection is empty. */ @@ -30,12 +29,10 @@ public void describeTo(Description description) { /** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose isEmpty * method returns true. - *

* For example: *

assertThat(new ArrayList<String>(), is(empty()))
* */ - @Factory public static Matcher> empty() { return new IsEmptyCollection(); } @@ -43,17 +40,14 @@ public static Matcher> empty() { /** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose isEmpty * method returns true. - *

* For example: *

assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
* - * @param type + * @param unusedToForceReturnType * the type of the collection's content */ - @Factory - public static Matcher> emptyCollectionOf(Class type) { - @SuppressWarnings({ "rawtypes", "unchecked" }) - final Matcher> result = (Matcher)empty(); - return result; + @SuppressWarnings({"unchecked", "UnusedParameters"}) + public static Matcher> emptyCollectionOf(Class unusedToForceReturnType) { + return (Matcher)empty(); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java similarity index 84% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java index 200e0ec5..047e670c 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java @@ -1,7 +1,6 @@ package org.hamcrest.collection; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; @@ -26,29 +25,24 @@ public void describeTo(Description description) { /** * Creates a matcher for {@link Iterable}s matching examined iterables that yield no items. - *

* For example: *

assertThat(new ArrayList<String>(), is(emptyIterable()))
* */ - @Factory public static Matcher> emptyIterable() { return new IsEmptyIterable(); } /** * Creates a matcher for {@link Iterable}s matching examined iterables that yield no items. - *

* For example: *

assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
* - * @param type + * @param unusedToForceReturnType * the type of the iterable's content */ - @Factory - public static Matcher> emptyIterableOf(Class type) { - @SuppressWarnings({ "rawtypes", "unchecked" }) - final Matcher> result = (Matcher)emptyIterable(); - return result; + @SuppressWarnings({"unchecked", "UnusedParameters"}) + public static Matcher> emptyIterableOf(Class unusedToForceReturnType) { + return (Matcher)emptyIterable(); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIn.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java similarity index 51% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsIn.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsIn.java index 2eb4e83d..84098110 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIn.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java @@ -2,7 +2,6 @@ import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import java.util.Arrays; @@ -19,6 +18,7 @@ public IsIn(T[] elements) { collection = Arrays.asList(elements); } + @SuppressWarnings("SuspiciousMethodCalls") @Override public boolean matches(Object o) { return collection.contains(o); @@ -33,48 +33,95 @@ public void describeTo(Description buffer) { /** * Creates a matcher that matches when the examined object is found within the * specified collection. - *

* For example: *

assertThat("foo", isIn(Arrays.asList("bar", "foo")))
* + * @deprecated use is(in(...)) instead + * * @param collection * the collection in which matching items must be found * */ - @Factory + @Deprecated public static Matcher isIn(Collection collection) { - return new IsIn(collection); + return in(collection); + } + + /** + * Creates a matcher that matches when the examined object is found within the + * specified collection. + * For example: + *
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
+ * + * @param collection + * the collection in which matching items must be found + * + */ + public static Matcher in(Collection collection) { + return new IsIn<>(collection); } /** * Creates a matcher that matches when the examined object is found within the * specified array. - *

* For example: *

assertThat("foo", isIn(new String[]{"bar", "foo"}))
* + * @deprecated use is(in(...)) instead + * * @param elements * the array in which matching items must be found * */ - @Factory + @Deprecated public static Matcher isIn(T[] elements) { - return new IsIn(elements); + return in(elements); + } + + /** + * Creates a matcher that matches when the examined object is found within the + * specified array. + * For example: + *
assertThat("foo", is(in(new String[]{"bar", "foo"})))
+ * + * @param elements + * the array in which matching items must be found + * + */ + public static Matcher in(T[] elements) { + return new IsIn<>(elements); } /** * Creates a matcher that matches when the examined object is equal to one of the * specified elements. - *

* For example: - *

assertThat("foo", isIn("bar", "foo"))
- * + *
assertThat("foo", isOneOf("bar", "foo"))
+ * + * @deprecated use is(oneOf(...)) instead + * * @param elements * the elements amongst which matching items will be found * */ - @Factory + @SafeVarargs + @Deprecated public static Matcher isOneOf(T... elements) { - return isIn(elements); + return oneOf(elements); + } + + /** + * Creates a matcher that matches when the examined object is equal to one of the + * specified elements. + * For example: + *
assertThat("foo", is(oneOf("bar", "foo")))
+ * + * @param elements + * the elements amongst which matching items will be found + * + */ + @SafeVarargs + public static Matcher oneOf(T... elements) { + return in(elements); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java similarity index 73% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index 22fd299d..d6a9a33d 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -1,7 +1,6 @@ package org.hamcrest.collection; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; @@ -10,7 +9,6 @@ import java.util.Collection; import java.util.List; -import static java.util.Arrays.asList; import static org.hamcrest.core.IsEqual.equalTo; public class IsIterableContainingInAnyOrder extends TypeSafeDiagnosingMatcher> { @@ -22,7 +20,7 @@ public IsIterableContainingInAnyOrder(Collection> matchers) { @Override protected boolean matchesSafely(Iterable items, Description mismatchDescription) { - Matching matching = new Matching(matchers, mismatchDescription); + final Matching matching = new Matching<>(matchers, mismatchDescription); for (T item : items) { if (! matching.matches(item)) { return false; @@ -34,7 +32,7 @@ protected boolean matchesSafely(Iterable items, Description mismatc @Override public void describeTo(Description description) { - description.appendText("iterable over ") + description.appendText("iterable with items ") .appendList("[", ", ", "]", matchers) .appendText(" in any order"); } @@ -44,12 +42,16 @@ private static class Matching { private final Description mismatchDescription; public Matching(Collection> matchers, Description mismatchDescription) { - this.matchers = new ArrayList>(matchers); + this.matchers = new ArrayList<>(matchers); this.mismatchDescription = mismatchDescription; } public boolean matches(S item) { - return isNotSurplus(item) && isMatched(item); + if (matchers.isEmpty()) { + mismatchDescription.appendText("no match for: ").appendValue(item); + return false; + } + return isMatched(item); } public boolean isFinished(Iterable items) { @@ -57,18 +59,10 @@ public boolean isFinished(Iterable items) { return true; } mismatchDescription - .appendText("No item matches: ").appendList("", ", ", "", matchers) + .appendText("no item matches: ").appendList("", ", ", "", matchers) .appendText(" in ").appendValueList("[", ", ", "]", items); return false; } - - private boolean isNotSurplus(S item) { - if (matchers.isEmpty()) { - mismatchDescription.appendText("Not matched: ").appendValue(item); - return false; - } - return true; - } private boolean isMatched(S item) { for (Matcher matcher : matchers) { @@ -77,99 +71,86 @@ private boolean isMatched(S item) { return true; } } - mismatchDescription.appendText("Not matched: ").appendValue(item); + mismatchDescription.appendText("not matched: ").appendValue(item); return false; } - - } - - /** - * Creates a matcher for {@link Iterable}s that matches when a single pass over the - * examined {@link Iterable} yields a single item that satisfies the specified matcher. - * For a positive match, the examined iterable must only yield one item. - *

- * For example: - *

assertThat(Arrays.asList("foo"), containsInAnyOrder(equalTo("foo")))
- * - * @deprecated use contains(Matcher itemMatcher) instead - * - * @param itemMatcher - * the matcher that must be satisfied by the single item provided by an - * examined {@link Iterable} - */ - @SuppressWarnings("unchecked") - @Deprecated - @Factory - public static Matcher> containsInAnyOrder(final Matcher itemMatcher) { - return containsInAnyOrder(new ArrayList>(asList(itemMatcher))); } /** + *

* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over * the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere * in the specified matchers. For a positive match, the examined iterable 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 * iterable. - *

+ *

+ *

* For example: + *

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
* * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} */ - @Factory + @SafeVarargs public static Matcher> containsInAnyOrder(Matcher... itemMatchers) { return containsInAnyOrder(Arrays.asList(itemMatchers)); } /** + *

* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over * the examined {@link Iterable} yields a series of items, each logically equal to one item * anywhere in the specified items. For a positive match, the examined iterable * 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 * iterable. - *

+ *

+ *

* For example: + *

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
* * @param items * the items that must equal the items provided by an examined {@link Iterable} in any order */ - @Factory + @SafeVarargs public static Matcher> containsInAnyOrder(T... items) { - List> matchers = new ArrayList>(); + List> matchers = new ArrayList<>(); for (T item : items) { matchers.add(equalTo(item)); } - return new IsIterableContainingInAnyOrder(matchers); + return new IsIterableContainingInAnyOrder<>(matchers); } /** + *

* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over * the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere * in the specified collection of matchers. For a positive match, the examined iterable * 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 iterable. - *

- * For example: + *

+ *

For example:

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
* * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} */ - @Factory public static Matcher> containsInAnyOrder(Collection> itemMatchers) { - return new IsIterableContainingInAnyOrder(itemMatchers); + return new IsIterableContainingInAnyOrder<>(itemMatchers); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java similarity index 77% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java index 8c0552a6..ed62aa29 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java @@ -1,15 +1,15 @@ package org.hamcrest.collection; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.internal.NullSafety; import java.util.ArrayList; import java.util.List; -import static java.util.Arrays.asList; -import static org.hamcrest.core.IsEqual.equalTo; +import static java.util.Collections.singletonList; +import static org.hamcrest.collection.ArrayMatching.asEqualMatchers; public class IsIterableContainingInOrder extends TypeSafeDiagnosingMatcher> { private final List> matchers; @@ -20,7 +20,7 @@ public IsIterableContainingInOrder(List> matchers) { @Override protected boolean matchesSafely(Iterable iterable, Description mismatchDescription) { - MatchSeries matchSeries = new MatchSeries(matchers, mismatchDescription); + final MatchSeries matchSeries = new MatchSeries<>(matchers, mismatchDescription); for (E item : iterable) { if (!matchSeries.matches(item)) { return false; @@ -36,9 +36,9 @@ public void describeTo(Description description) { } private static class MatchSeries { - public final List> matchers; + private final List> matchers; private final Description mismatchDescription; - public int nextMatchIx = 0; + private int nextMatchIx = 0; public MatchSeries(List> matchers, Description mismatchDescription) { this.mismatchDescription = mismatchDescription; @@ -49,19 +49,24 @@ public MatchSeries(List> matchers, Description mismatchDescri } public boolean matches(F item) { - return isNotSurplus(item) && isMatched(item); + if (matchers.size() <= nextMatchIx) { + mismatchDescription.appendText("not matched: ").appendValue(item); + return false; + } + + return isMatched(item); } public boolean isFinished() { if (nextMatchIx < matchers.size()) { - mismatchDescription.appendText("No item matched: ").appendDescriptionOf(matchers.get(nextMatchIx)); + mismatchDescription.appendText("no item was ").appendDescriptionOf(matchers.get(nextMatchIx)); return false; } return true; } private boolean isMatched(F item) { - Matcher matcher = matchers.get(nextMatchIx); + final Matcher matcher = matchers.get(nextMatchIx); if (!matcher.matches(item)) { describeMismatch(matcher, item); return false; @@ -70,15 +75,7 @@ private boolean isMatched(F item) { return true; } - private boolean isNotSurplus(F item) { - if (matchers.size() <= nextMatchIx) { - mismatchDescription.appendText("Not matched: ").appendValue(item); - return false; - } - return true; - } - - private void describeMismatch(Matcher matcher, F item) { + private void describeMismatch(Matcher matcher, F item) { mismatchDescription.appendText("item " + nextMatchIx + ": "); matcher.describeMismatch(item, mismatchDescription); } @@ -89,28 +86,21 @@ private void describeMismatch(Matcher matcher, F item) { * examined {@link Iterable} yields a series of items, each logically equal to the * corresponding item in the specified items. For a positive match, the examined iterable * must be of the same length as the number of specified items. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
* * @param items * the items that must equal the items provided by an examined {@link Iterable} */ - @Factory + @SafeVarargs public static Matcher> contains(E... items) { - List> matchers = new ArrayList>(); - for (E item : items) { - matchers.add(equalTo(item)); - } - - return contains(matchers); + return contains(asEqualMatchers(items)); } /** * Creates a matcher for {@link Iterable}s that matches when a single pass over the * examined {@link Iterable} yields a single item that satisfies the specified matcher. * For a positive match, the examined iterable must only yield one item. - *

* For example: *

assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
* @@ -119,9 +109,8 @@ public static Matcher> contains(E... items) { * examined {@link Iterable} */ @SuppressWarnings("unchecked") - @Factory public static Matcher> contains(final Matcher itemMatcher) { - return contains(new ArrayList>(asList(itemMatcher))); + return contains(new ArrayList>(singletonList(itemMatcher))); } /** @@ -129,16 +118,18 @@ public static Matcher> contains(final Matcher * For example: *
assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
* * @param itemMatchers * the matchers that must be satisfied by the items provided by an examined {@link Iterable} */ - @Factory + @SafeVarargs public static Matcher> contains(Matcher... itemMatchers) { - return contains(asList(itemMatchers)); + // required for JDK 1.6 + //noinspection RedundantTypeArguments + final List> nullSafeWithExplicitTypeMatchers = NullSafety.nullSafe(itemMatchers); + return contains(nullSafeWithExplicitTypeMatchers); } /** @@ -146,7 +137,6 @@ public static Matcher> contains(Matcher... * examined {@link Iterable} yields a series of items, each satisfying the corresponding * matcher in the specified list of matchers. For a positive match, the examined iterable * must be of the same length as the specified list of matchers. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
* @@ -154,8 +144,7 @@ public static Matcher> contains(Matcher... * a list of matchers, each of which must be satisfied by the corresponding item provided by * an examined {@link Iterable} */ - @Factory public static Matcher> contains(List> itemMatchers) { - return new IsIterableContainingInOrder(itemMatchers); + return new IsIterableContainingInOrder<>(itemMatchers); } } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java new file mode 100644 index 00000000..06577685 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java @@ -0,0 +1,119 @@ +package org.hamcrest.collection; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import java.util.ArrayList; +import java.util.List; + +import static java.util.Arrays.asList; +import static org.hamcrest.core.IsEqual.equalTo; + +public class IsIterableContainingInRelativeOrder extends TypeSafeDiagnosingMatcher> { + private final List> matchers; + + public IsIterableContainingInRelativeOrder(List> matchers) { + this.matchers = matchers; + } + + @Override + protected boolean matchesSafely(Iterable iterable, Description mismatchDescription) { + MatchSeriesInRelativeOrder matchSeriesInRelativeOrder = new MatchSeriesInRelativeOrder<>(matchers, mismatchDescription); + matchSeriesInRelativeOrder.processItems(iterable); + return matchSeriesInRelativeOrder.isFinished(); + } + + public void describeTo(Description description) { + description.appendText("iterable containing ").appendList("[", ", ", "]", matchers).appendText(" in relative order"); + } + + private static class MatchSeriesInRelativeOrder { + public final List> matchers; + private final Description mismatchDescription; + private int nextMatchIx = 0; + private F lastMatchedItem = null; + + public MatchSeriesInRelativeOrder(List> matchers, Description mismatchDescription) { + this.mismatchDescription = mismatchDescription; + if (matchers.isEmpty()) { + throw new IllegalArgumentException("Should specify at least one expected element"); + } + this.matchers = matchers; + } + + public void processItems(Iterable iterable) { + for (F item : iterable) { + if (nextMatchIx < matchers.size()) { + Matcher matcher = matchers.get(nextMatchIx); + if (matcher.matches(item)) { + lastMatchedItem = item; + nextMatchIx++; + } + } + } + } + + public boolean isFinished() { + if (nextMatchIx < matchers.size()) { + mismatchDescription.appendDescriptionOf(matchers.get(nextMatchIx)).appendText(" was not found"); + if (lastMatchedItem != null) { + mismatchDescription.appendText(" after ").appendValue(lastMatchedItem); + } + return false; + } + return true; + } + + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, that contains items logically equal to the + * corresponding item in the specified items, in the same relative order + * For example: + *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
+ * + * @param items + * the items that must be contained within items provided by an examined {@link Iterable} in the same relative order + */ + @SafeVarargs + public static Matcher> containsInRelativeOrder(E... items) { + List> matchers = new ArrayList<>(); + for (E item : items) { + matchers.add(equalTo(item)); + } + + return containsInRelativeOrder(matchers); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, that each satisfying the corresponding + * matcher in the specified matchers, in the same relative order. + * For example: + *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
+ * + * @param itemMatchers + * the matchers that must be satisfied by the items provided by an examined {@link Iterable} in the same relative order + */ + @SafeVarargs + public static Matcher> containsInRelativeOrder(Matcher... itemMatchers) { + return containsInRelativeOrder(asList(itemMatchers)); + } + + /** + * Creates a matcher for {@link Iterable}s that matches when a single pass over the + * examined {@link Iterable} yields a series of items, that contains items satisfying the corresponding + * matcher in the specified list of matchers, in the same relative order. + * For example: + *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
+ * + * @param itemMatchers + * a list of matchers, each of which must be satisfied by the items provided by + * an examined {@link Iterable} in the same relative order + */ + public static Matcher> containsInRelativeOrder(List> itemMatchers) { + return new IsIterableContainingInRelativeOrder<>(itemMatchers); + } +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java similarity index 95% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java index 5fbc4bdd..0a1535fe 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java @@ -1,12 +1,11 @@ package org.hamcrest.collection; -import static org.hamcrest.core.IsEqual.equalTo; +import org.hamcrest.FeatureMatcher; +import org.hamcrest.Matcher; import java.util.Iterator; -import org.hamcrest.Factory; -import org.hamcrest.FeatureMatcher; -import org.hamcrest.Matcher; +import static org.hamcrest.core.IsEqual.equalTo; public class IsIterableWithSize extends FeatureMatcher, Integer> { @@ -28,14 +27,12 @@ protected Integer featureValueOf(Iterable actual) { * Creates a matcher for {@link Iterable}s that matches when a single pass over the * examined {@link Iterable} yields an item count that satisfies the specified * matcher. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
* * @param sizeMatcher * a matcher for the number of items that should be yielded by an examined {@link Iterable} */ - @Factory public static Matcher> iterableWithSize(Matcher sizeMatcher) { return new IsIterableWithSize(sizeMatcher); } @@ -44,14 +41,12 @@ public static Matcher> iterableWithSize(Matcher * Creates a matcher for {@link Iterable}s that matches when a single pass over the * examined {@link Iterable} yields an item count that is equal to the specified * size argument. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
* * @param size * the number of items that should be yielded by an examined {@link Iterable} */ - @Factory public static Matcher> iterableWithSize(int size) { return iterableWithSize(equalTo(size)); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java similarity index 88% rename from hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java rename to hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java index 392c554c..4ed45392 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -1,7 +1,6 @@ package org.hamcrest.collection; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; @@ -48,7 +47,6 @@ public void describeTo(Description description) { * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one entry whose key satisfies the specified keyMatcher and whose * value satisfies the specified valueMatcher. - *

* For example: *

assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
* @@ -57,16 +55,14 @@ public void describeTo(Description description) { * @param valueMatcher * the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry */ - @Factory public static Matcher> hasEntry(Matcher keyMatcher, Matcher valueMatcher) { - return new IsMapContaining(keyMatcher, valueMatcher); + return new IsMapContaining<>(keyMatcher, valueMatcher); } /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one entry whose key equals the specified key and whose value equals the * specified value. - *

* For example: *

assertThat(myMap, hasEntry("bar", "foo"))
* @@ -75,68 +71,59 @@ public static Matcher> hasEntry(Matcher Matcher> hasEntry(K key, V value) { - return new IsMapContaining(equalTo(key), equalTo(value)); + return new IsMapContaining<>(equalTo(key), equalTo(value)); } /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one key that satisfies the specified matcher. - *

* For example: *

assertThat(myMap, hasKey(equalTo("bar")))
* * @param keyMatcher * the matcher that must be satisfied by at least one key */ - @Factory public static Matcher> hasKey(Matcher keyMatcher) { - return new IsMapContaining(keyMatcher, anything()); + return new IsMapContaining<>(keyMatcher, anything()); } /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one key that is equal to the specified key. - *

* For example: *

assertThat(myMap, hasKey("bar"))
* * @param key * the key that satisfying maps must contain */ - @Factory public static Matcher> hasKey(K key) { - return new IsMapContaining(equalTo(key), anything()); + return new IsMapContaining<>(equalTo(key), anything()); } /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one value that satisfies the specified valueMatcher. - *

* For example: *

assertThat(myMap, hasValue(equalTo("foo")))
* * @param valueMatcher * the matcher that must be satisfied by at least one value */ - @Factory public static Matcher> hasValue(Matcher valueMatcher) { - return new IsMapContaining(anything(), valueMatcher); + return new IsMapContaining<>(anything(), valueMatcher); } /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one value that is equal to the specified value. - *

* For example: *

assertThat(myMap, hasValue("foo"))
* * @param value * the value that satisfying maps must contain */ - @Factory public static Matcher> hasValue(V value) { - return new IsMapContaining(anything(), equalTo(value)); + return new IsMapContaining<>(anything(), equalTo(value)); } } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java new file mode 100644 index 00000000..966d9ca2 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java @@ -0,0 +1,60 @@ +package org.hamcrest.collection; + +import org.hamcrest.FeatureMatcher; +import org.hamcrest.Matcher; + +import java.util.Map; + +import static org.hamcrest.core.IsEqual.equalTo; + +/** + * Matches if map size satisfies a nested matcher. + */ +public final class IsMapWithSize extends FeatureMatcher, Integer> { + @SuppressWarnings("WeakerAccess") + public IsMapWithSize(Matcher sizeMatcher) { + super(sizeMatcher, "a map with size", "map size"); + } + + @Override + protected Integer featureValueOf(Map actual) { + return actual.size(); + } + + /** + * 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 sizeMatcher + * a matcher for the size of an examined {@link java.util.Map} + */ + public static Matcher> aMapWithSize(Matcher sizeMatcher) { + return new IsMapWithSize<>(sizeMatcher); + } + + /** + * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns + * a value equal to the specified size. + * For example: + *
assertThat(myMap, is(aMapWithSize(2)))
+ * + * @param size + * the expected size of an examined {@link java.util.Map} + */ + public static Matcher> aMapWithSize(int size) { + return IsMapWithSize.aMapWithSize(equalTo(size)); + } + + /** + * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns + * zero. + * For example: + *
assertThat(myMap, is(anEmptyMap()))
+ * + */ + public static Matcher> anEmptyMap() { + return IsMapWithSize.aMapWithSize(equalTo(0)); + } +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/package.html b/hamcrest/src/main/java/org/hamcrest/collection/package.html similarity index 100% rename from hamcrest-library/src/main/java/org/hamcrest/collection/package.html rename to hamcrest/src/main/java/org/hamcrest/collection/package.html diff --git a/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java new file mode 100644 index 00000000..cf522113 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java @@ -0,0 +1,178 @@ +package org.hamcrest.comparator; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +import java.util.Comparator; + +import static java.lang.Integer.signum; + +public final class ComparatorMatcherBuilder { + + private final Comparator comparator; + private final boolean includeComparatorInDescription; + + /** + * Creates a matcher factory for matchers of {@code Comparable}s. + * For example: + *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
+ */ + public static > ComparatorMatcherBuilder usingNaturalOrdering() { + return new ComparatorMatcherBuilder(new Comparator() { + @Override + public int compare(T o1, T o2) { + return o1.compareTo(o2); + } + }, false); + } + + /** + * Creates a matcher factory for matchers of {@code Comparators}s of {@code T}. + * For example: + *
assertThat(5, comparedBy(new Comparator<Integer>() {
+     * public int compare(Integer o1, Integer o2) {
+     * return -o1.compareTo(o2);
+     * }
+     * }).lessThan(4))
+ */ + public static ComparatorMatcherBuilder comparedBy(Comparator comparator) { + return new ComparatorMatcherBuilder(comparator, true); + } + + private ComparatorMatcherBuilder(Comparator comparator, boolean includeComparatorInDescription) { + this.comparator = comparator; + this.includeComparatorInDescription = includeComparatorInDescription; + } + + private static final class ComparatorMatcher extends TypeSafeMatcher { + private static final int LESS_THAN = -1; + private static final int GREATER_THAN = 1; + private static final int EQUAL = 0; + + private final Comparator comparator; + private final T expected; + private final int minCompare; + private final int maxCompare; + private final boolean includeComparatorInDescription; + + private static final String[] comparisonDescriptions = { + "less than", + "equal to", + "greater than" + }; + + private ComparatorMatcher(Comparator comparator, T expected, int minCompare, int maxCompare, boolean includeComparatorInDescription) { + this.comparator = comparator; + this.expected = expected; + this.minCompare = minCompare; + this.maxCompare = maxCompare; + this.includeComparatorInDescription = includeComparatorInDescription; + } + + @Override + public boolean matchesSafely(T actual) { + try { + int compare = signum(comparator.compare(actual, expected)); + return minCompare <= compare && compare <= maxCompare; + } catch (ClassCastException e) { + return false; // type erasure means someone can shonk in a non-T :( + } + } + + @Override + public void describeMismatchSafely(T actual, Description mismatchDescription) { + mismatchDescription.appendValue(actual).appendText(" was ") + .appendText(asText(comparator.compare(actual, expected))) + .appendText(" ").appendValue(expected); + if (includeComparatorInDescription) { + mismatchDescription.appendText(" when compared by ").appendValue(comparator); + } + } + + @Override + public void describeTo(Description description) { + description.appendText("a value ").appendText(asText(minCompare)); + if (minCompare != maxCompare) { + description.appendText(" or ").appendText(asText(maxCompare)); + } + description.appendText(" ").appendValue(expected); + if (includeComparatorInDescription) { + description.appendText(" when compared by ").appendValue(comparator); + } + } + + private static String asText(int comparison) { + return comparisonDescriptions[signum(comparison) + 1]; + } + } + + /** + * Creates a matcher of {@code T} object that matches when the examined object is + * equal to the specified value, as reported by the {@code Comparator} used to + * create this builder. + * For example: + *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().comparesEqualTo(1))
+ * + * @param value the value which, when passed to the Comparator supplied to this builder, should return zero + */ + public Matcher comparesEqualTo(T value) { + return new ComparatorMatcher(comparator, value, ComparatorMatcher.EQUAL, ComparatorMatcher.EQUAL, includeComparatorInDescription); + } + + /** + * Creates a matcher of {@code T} object that matches when the examined object is + * greater than the specified value, as reported by the {@code Comparator} used to + * create this builder. + * For example: + *
assertThat(2, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThan(1))
+ * + * @param value the value which, when passed to the Comparator supplied to this builder, should return greater + * than zero + */ + public Matcher greaterThan(T value) { + return new ComparatorMatcher(comparator, value, ComparatorMatcher.GREATER_THAN, ComparatorMatcher.GREATER_THAN, includeComparatorInDescription); + } + + /** + * Creates a matcher of {@code T} object that matches when the examined object is + * greater than or equal to the specified value, as reported by the {@code Comparator} used to + * create this builder. + * For example: + *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThanOrEqualTo(1))
+ * + * @param value the value which, when passed to the Comparator supplied to this builder, should return greater + * than or equal to zero + */ + public Matcher greaterThanOrEqualTo(T value) { + return new ComparatorMatcher(comparator, value, ComparatorMatcher.EQUAL, ComparatorMatcher.GREATER_THAN, includeComparatorInDescription); + } + + /** + * Creates a matcher of {@code T} object that matches when the examined object is + * less than the specified value, as reported by the {@code Comparator} used to + * create this builder. + * For example: + *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThan(2))
+ * + * @param value the value which, when passed to the Comparator supplied to this builder, should return less + * than zero + */ + public Matcher lessThan(T value) { + return new ComparatorMatcher(comparator, value, ComparatorMatcher.LESS_THAN, ComparatorMatcher.LESS_THAN, includeComparatorInDescription); + } + + /** + * Creates a matcher of {@code T} object that matches when the examined object is + * less than or equal to the specified value, as reported by the {@code Comparator} used to + * create this builder. + * For example: + *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
+ * + * @param value the value which, when passed to the Comparator supplied to this builder, should return less + * than or equal to zero + */ + public Matcher lessThanOrEqualTo(T value) { + return new ComparatorMatcher(comparator, value, ComparatorMatcher.LESS_THAN, ComparatorMatcher.EQUAL, includeComparatorInDescription); + } +} diff --git a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java new file mode 100644 index 00000000..b8c3faad --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java @@ -0,0 +1,61 @@ +package org.hamcrest.core; + +import org.hamcrest.Description; +import org.hamcrest.DiagnosingMatcher; +import org.hamcrest.Matcher; + +import java.util.Arrays; + +/** + * Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so + * subsequent matchers are not called if an earlier matcher returns false. + */ +public class AllOf extends DiagnosingMatcher { + + private final Iterable> matchers; + + @SafeVarargs + public AllOf(Matcher ... matchers) { + this(Arrays.asList(matchers)); + } + + public AllOf(Iterable> matchers) { + this.matchers = matchers; + } + + @Override + public boolean matches(Object o, Description mismatch) { + for (Matcher matcher : matchers) { + if (!matcher.matches(o)) { + mismatch.appendDescriptionOf(matcher).appendText(" "); + matcher.describeMismatch(o, mismatch); + return false; + } + } + return true; + } + + @Override + public void describeTo(Description description) { + description.appendList("(", " " + "and" + " ", ")", matchers); + } + + /** + * Creates a matcher that matches if the examined object matches ALL of the specified matchers. + * For example: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + public static Matcher allOf(Iterable> matchers) { + return new AllOf<>(matchers); + } + + /** + * Creates a matcher that matches if the examined object matches ALL of the specified matchers. + * For example: + *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+ */ + @SafeVarargs + public static Matcher allOf(Matcher... matchers) { + return allOf(Arrays.asList(matchers)); + } +} diff --git a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java new file mode 100644 index 00000000..7a22c22e --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java @@ -0,0 +1,51 @@ +package org.hamcrest.core; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +import java.util.Arrays; + +/** + * Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so + * subsequent matchers are not called if an earlier matcher returns true. + */ +public class AnyOf extends ShortcutCombination { + + @SafeVarargs + public AnyOf(Matcher ... matchers) { + this(Arrays.asList(matchers)); + } + + public AnyOf(Iterable> matchers) { + super(matchers); + } + + @Override + public boolean matches(Object o) { + return matches(o, true); + } + + @Override + public void describeTo(Description description) { + describeTo(description, "or"); + } + + /** + * Creates a matcher that matches if the examined object matches ANY of the specified matchers. + * For example: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + public static AnyOf anyOf(Iterable> matchers) { + return new AnyOf<>(matchers); + } + + /** + * Creates a matcher that matches if the examined object matches ANY of the specified matchers. + * For example: + *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+ */ + @SafeVarargs + public static AnyOf anyOf(Matcher... matchers) { + return anyOf(Arrays.asList(matchers)); + } +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java similarity index 75% rename from hamcrest-core/src/main/java/org/hamcrest/core/CombinableMatcher.java rename to hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java index 52672516..e37efce6 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/CombinableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java @@ -1,6 +1,8 @@ package org.hamcrest.core; -import org.hamcrest.*; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; import java.util.ArrayList; @@ -26,15 +28,15 @@ public void describeTo(Description description) { } public CombinableMatcher and(Matcher other) { - return new CombinableMatcher(new AllOf(templatedListWith(other))); + return new CombinableMatcher<>(new AllOf<>(templatedListWith(other))); } public CombinableMatcher or(Matcher other) { - return new CombinableMatcher(new AnyOf(templatedListWith(other))); + return new CombinableMatcher<>(new AnyOf<>(templatedListWith(other))); } private ArrayList> templatedListWith(Matcher other) { - ArrayList> matchers = new ArrayList>(); + ArrayList> matchers = new ArrayList<>(); matchers.add(matcher); matchers.add(other); return matchers; @@ -42,13 +44,11 @@ private ArrayList> templatedListWith(Matcher other /** * Creates a matcher that matches when both of the specified matchers match the examined object. - *

* For example: *

assertThat("fab", both(containsString("a")).and(containsString("b")))
*/ - @Factory public static CombinableBothMatcher both(Matcher matcher) { - return new CombinableBothMatcher(matcher); + return new CombinableBothMatcher<>(matcher); } public static final class CombinableBothMatcher { @@ -57,19 +57,17 @@ public CombinableBothMatcher(Matcher matcher) { this.first = matcher; } public CombinableMatcher and(Matcher other) { - return new CombinableMatcher(first).and(other); + return new CombinableMatcher<>(first).and(other); } } /** * Creates a matcher that matches when either of the specified matchers match the examined object. - *

* For example: - *

assertThat("fan", either(containsString("a")).and(containsString("b")))
+ *
assertThat("fan", either(containsString("a")).or(containsString("b")))
*/ - @Factory public static CombinableEitherMatcher either(Matcher matcher) { - return new CombinableEitherMatcher(matcher); + return new CombinableEitherMatcher<>(matcher); } public static final class CombinableEitherMatcher { @@ -78,7 +76,7 @@ public CombinableEitherMatcher(Matcher matcher) { this.first = matcher; } public CombinableMatcher or(Matcher other) { - return new CombinableMatcher(first).or(other); + return new CombinableMatcher<>(first).or(other); } } -} \ No newline at end of file +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java similarity index 95% rename from hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java rename to hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java index 3e779b43..23876095 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java +++ b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java @@ -1,10 +1,7 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.core; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import java.util.regex.Pattern; @@ -56,7 +53,6 @@ public void describeMismatch(Object item, Description description) { /** * 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())
* @@ -67,7 +63,6 @@ public void describeMismatch(Object item, Description description) { * @param values * optional values to insert into the tokenised description */ - @Factory public static Matcher describedAs(String description, Matcher matcher, Object... values) { return new DescribedAs(description, matcher, values); } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/Every.java b/hamcrest/src/main/java/org/hamcrest/core/Every.java similarity index 81% rename from hamcrest-core/src/main/java/org/hamcrest/core/Every.java rename to hamcrest/src/main/java/org/hamcrest/core/Every.java index f6e0fbac..988758b1 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/Every.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Every.java @@ -1,11 +1,10 @@ package org.hamcrest.core; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; -public class Every extends TypeSafeDiagnosingMatcher> { +public class Every extends TypeSafeDiagnosingMatcher> { private final Matcher matcher; public Every(Matcher matcher) { @@ -13,7 +12,7 @@ public Every(Matcher matcher) { } @Override - public boolean matchesSafely(Iterable collection, Description mismatchDescription) { + public boolean matchesSafely(Iterable collection, Description mismatchDescription) { for (T t : collection) { if (!matcher.matches(t)) { mismatchDescription.appendText("an item "); @@ -33,15 +32,13 @@ public void describeTo(Description description) { * 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: *

assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
* * @param itemMatcher * the matcher to apply to every item provided by the examined {@link Iterable} */ - @Factory - public static Matcher> everyItem(final Matcher itemMatcher) { - return new Every(itemMatcher); + public static Matcher> everyItem(final Matcher itemMatcher) { + return new Every<>(itemMatcher); } } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/Is.java b/hamcrest/src/main/java/org/hamcrest/core/Is.java similarity index 69% rename from hamcrest-core/src/main/java/org/hamcrest/core/Is.java rename to hamcrest/src/main/java/org/hamcrest/core/Is.java index f9fb9668..5264e89d 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/Is.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Is.java @@ -2,11 +2,9 @@ import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsInstanceOf.instanceOf; /** * Decorates another Matcher, retaining the behaviour but allowing tests @@ -40,61 +38,37 @@ public void describeMismatch(Object item, Description mismatchDescription) { /** * 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))
* */ - @Factory public static Matcher is(Matcher matcher) { - return new Is(matcher); + return new Is<>(matcher); } /** * A shortcut to the frequently used is(equalTo(x)). - *

* For example: *

assertThat(cheese, is(smelly))
* instead of: *
assertThat(cheese, is(equalTo(smelly)))
* */ - @Factory public static Matcher is(T value) { return is(equalTo(value)); } /** * A shortcut to the frequently used is(instanceOf(SomeClass.class)). - *

- * For example: - *

assertThat(cheese, is(Cheddar.class))
- * instead of: - *
assertThat(cheese, is(instanceOf(Cheddar.class)))
- * - * @deprecated use isA(Class type) instead. - */ - @Factory - @Deprecated - public static Matcher is(Class type) { - final Matcher typeMatcher = instanceOf(type); - return is(typeMatcher); - } - - /** - * 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)))
* */ - @Factory - public static Matcher isA(Class type) { - final Matcher typeMatcher = instanceOf(type); - return is(typeMatcher); + public static Matcher isA(Class type) { + return is(IsInstanceOf.instanceOf(type)); } } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsAnything.java b/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java similarity index 80% rename from hamcrest-core/src/main/java/org/hamcrest/core/IsAnything.java rename to hamcrest/src/main/java/org/hamcrest/core/IsAnything.java index 1049f504..94943dc0 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsAnything.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java @@ -1,11 +1,8 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.core; +import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; -import org.hamcrest.Factory; -import org.hamcrest.BaseMatcher; /** @@ -36,10 +33,7 @@ public void describeTo(Description description) { /** * Creates a matcher that always matches, regardless of the examined object. */ - @Factory - public static Matcher anything() { - return new IsAnything(); - } + public static Matcher anything() { return new IsAnything<>(); } /** * Creates a matcher that always matches, regardless of the examined object, but describes @@ -48,8 +42,7 @@ public static Matcher anything() { * @param description * a meaningful {@link String} used when describing itself */ - @Factory public static Matcher anything(String description) { - return new IsAnything(description); + return new IsAnything<>(description); } } diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java new file mode 100644 index 00000000..b54b6aa9 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java @@ -0,0 +1,100 @@ +package org.hamcrest.core; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +/** + * @deprecated As of release 2.1, replaced by {@link IsIterableContaining}. + */ +@Deprecated +public class IsCollectionContaining extends TypeSafeDiagnosingMatcher> { + private final IsIterableContaining delegate; + + public IsCollectionContaining(Matcher elementMatcher) { + this.delegate = new IsIterableContaining<>(elementMatcher); + } + + @Override + protected boolean matchesSafely(Iterable collection, Description mismatchDescription) { + return delegate.matchesSafely(collection, mismatchDescription); + } + + @Override + public void describeTo(Description description) { + delegate.describeTo(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: + *
assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
+ * + * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItem(Matcher)}. + * + * @param itemMatcher + * the matcher to apply to items provided by the examined {@link Iterable} + */ + public static Matcher> hasItem(Matcher 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: + *
assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
+ * + * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItem(Object)}. + * + * @param item + * the item to compare against the items provided by the examined {@link Iterable} + */ + public static Matcher> hasItem(T item) { + // Doesn't forward to hasItem() method so compiler can sort out generics. + 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: + *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
+ * + * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItems(Matcher[])}}. + * + * @param itemMatchers + * the matchers to apply to items provided by the examined {@link Iterable} + */ + @SafeVarargs + public static Matcher> hasItems(Matcher... 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: + *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
+ * + * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItems(Object[])}}. + * + * @param items + * the items to compare against the items provided by the examined {@link Iterable} + */ + @SafeVarargs + public static Matcher> hasItems(T... items) { + return IsIterableContaining.hasItems(items); + } + +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java similarity index 90% rename from hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java rename to hamcrest/src/main/java/org/hamcrest/core/IsEqual.java index 290fd9d7..582c630f 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java @@ -1,10 +1,7 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.core; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import java.lang.reflect.Array; @@ -79,7 +76,6 @@ private static boolean isArray(Object o) { * 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.

- *

* For example: *

      * assertThat("foo", equalTo("foo"));
@@ -87,8 +83,15 @@ private static boolean isArray(Object o) {
      * 
* */ - @Factory public static Matcher equalTo(T operand) { - return new IsEqual(operand); + return new IsEqual<>(operand); + } + + /** + * Creates an {@link org.hamcrest.core.IsEqual} matcher that does not enforce the values being + * compared to be of the same static type. + */ + public static Matcher equalToObject(Object operand) { + return new IsEqual<>(operand); } } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java similarity index 95% rename from hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java rename to hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java index a1fdf368..5a508c9b 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java @@ -1,10 +1,7 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.core; import org.hamcrest.Description; import org.hamcrest.DiagnosingMatcher; -import org.hamcrest.Factory; import org.hamcrest.Matcher; @@ -65,13 +62,11 @@ public void describeTo(Description description) { * the examined object. * *

The created matcher assumes no relationship between specified type and the examined object.

- *

- * For example: + * For example: *

assertThat(new Canoe(), instanceOf(Paddlable.class));
* */ @SuppressWarnings("unchecked") - @Factory public static Matcher instanceOf(Class type) { return (Matcher) new IsInstanceOf(type); } @@ -84,13 +79,11 @@ public static Matcher instanceOf(Class type) { *

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: + * For example: *

assertThat(new Canoe(), instanceOf(Canoe.class));
* */ @SuppressWarnings("unchecked") - @Factory public static Matcher any(Class type) { return (Matcher) new IsInstanceOf(type); } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java similarity index 79% rename from hamcrest-core/src/main/java/org/hamcrest/core/IsCollectionContaining.java rename to hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java index 09a04682..67e776b0 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsCollectionContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java @@ -1,39 +1,52 @@ package org.hamcrest.core; -import static org.hamcrest.core.AllOf.allOf; -import static org.hamcrest.core.IsEqual.equalTo; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; import java.util.ArrayList; import java.util.List; -import org.hamcrest.Description; -import org.hamcrest.Factory; -import org.hamcrest.Matcher; -import org.hamcrest.TypeSafeDiagnosingMatcher; +import static org.hamcrest.core.AllOf.allOf; +import static org.hamcrest.core.IsEqual.equalTo; -public class IsCollectionContaining extends TypeSafeDiagnosingMatcher> { +public class IsIterableContaining extends TypeSafeDiagnosingMatcher> { private final Matcher elementMatcher; - public IsCollectionContaining(Matcher elementMatcher) { + public IsIterableContaining(Matcher elementMatcher) { this.elementMatcher = elementMatcher; } @Override protected boolean matchesSafely(Iterable collection, Description mismatchDescription) { - boolean isPastFirst = false; + if (isEmpty(collection)) { + mismatchDescription.appendText("was empty"); + return false; + } + for (Object item : collection) { - if (elementMatcher.matches(item)){ + if (elementMatcher.matches(item)) { return true; } + } + + mismatchDescription.appendText("mismatches were: ["); + boolean isPastFirst = false; + for (Object item : collection) { if (isPastFirst) { mismatchDescription.appendText(", "); } elementMatcher.describeMismatch(item, mismatchDescription); isPastFirst = true; } + mismatchDescription.appendText("]"); return false; } + private boolean isEmpty(Iterable iterable) { + return ! iterable.iterator().hasNext(); + } + @Override public void describeTo(Description description) { description @@ -47,16 +60,14 @@ public void describeTo(Description description) { * 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: *

assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
* * @param itemMatcher * the matcher to apply to items provided by the examined {@link Iterable} */ - @Factory public static Matcher> hasItem(Matcher itemMatcher) { - return new IsCollectionContaining(itemMatcher); + return new IsIterableContaining<>(itemMatcher); } /** @@ -64,17 +75,15 @@ public static Matcher> hasItem(Matcher itemMa * 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: *

assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
* * @param item * the item to compare against the items provided by the examined {@link Iterable} */ - @Factory public static Matcher> hasItem(T item) { // Doesn't forward to hasItem() method so compiler can sort out generics. - return new IsCollectionContaining(equalTo(item)); + return new IsIterableContaining<>(equalTo(item)); } /** @@ -82,20 +91,19 @@ public static Matcher> hasItem(T item) { * 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: *

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
* * @param itemMatchers * the matchers to apply to items provided by the examined {@link Iterable} */ - @Factory + @SafeVarargs public static Matcher> hasItems(Matcher... itemMatchers) { - List>> all = new ArrayList>>(itemMatchers.length); + List>> all = new ArrayList<>(itemMatchers.length); for (Matcher elementMatcher : itemMatchers) { // Doesn't forward to hasItem() method so compiler can sort out generics. - all.add(new IsCollectionContaining(elementMatcher)); + all.add(new IsIterableContaining<>(elementMatcher)); } return allOf(all); @@ -106,18 +114,17 @@ public static Matcher> hasItems(Matcher... itemMatche * 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: *

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
* * @param items * the items to compare against the items provided by the examined {@link Iterable} */ - @Factory + @SafeVarargs public static Matcher> hasItems(T... items) { - List>> all = new ArrayList>>(items.length); - for (T element : items) { - all.add(hasItem(element)); + List>> all = new ArrayList<>(items.length); + for (T item : items) { + all.add(hasItem(item)); } return allOf(all); diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java similarity index 92% rename from hamcrest-core/src/main/java/org/hamcrest/core/IsNot.java rename to hamcrest/src/main/java/org/hamcrest/core/IsNot.java index 39d19892..d5cf9c06 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsNot.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java @@ -1,10 +1,7 @@ -/* Copyright (c) 2000-2009 hamcrest.org - */ package org.hamcrest.core; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import static org.hamcrest.core.IsEqual.equalTo; @@ -34,21 +31,18 @@ public void describeTo(Description description) { /** * 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 matcher * the matcher whose sense should be inverted */ - @Factory public static Matcher not(Matcher matcher) { return new IsNot(matcher); } /** * A shortcut to the frequently used not(equalTo(x)). - *

* For example: *

assertThat(cheese, is(not(smelly)))
* instead of: @@ -57,7 +51,6 @@ public static Matcher not(Matcher matcher) { * @param value * the value that any examined object should not equal */ - @Factory public static Matcher not(T value) { return not(equalTo(value)); } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsNull.java b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java similarity index 92% rename from hamcrest-core/src/main/java/org/hamcrest/core/IsNull.java rename to hamcrest/src/main/java/org/hamcrest/core/IsNull.java index 6666ef90..9ebf080f 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsNull.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java @@ -1,12 +1,10 @@ -/* Copyright (c) 2000-2010 hamcrest.org - */ package org.hamcrest.core; -import static org.hamcrest.core.IsNot.not; +import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; -import org.hamcrest.Factory; -import org.hamcrest.BaseMatcher; + +import static org.hamcrest.core.IsNot.not; /** * Is the value null? @@ -24,26 +22,22 @@ public void describeTo(Description description) { /** * Creates a matcher that matches if examined object is null. - *

* For example: *

assertThat(cheese, is(nullValue())
* */ - @Factory public static Matcher nullValue() { return new IsNull(); } /** * A shortcut to the frequently used not(nullValue()). - *

* For example: *

assertThat(cheese, is(notNullValue()))
* instead of: *
assertThat(cheese, is(not(nullValue())))
* */ - @Factory public static Matcher notNullValue() { return not(nullValue()); } @@ -51,14 +45,12 @@ public static Matcher notNullValue() { /** * 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 type * dummy parameter used to infer the generic type of the returned matcher */ - @Factory public static Matcher nullValue(Class type) { return new IsNull(); } @@ -66,7 +58,6 @@ public static Matcher nullValue(Class type) { /** * 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: @@ -76,7 +67,6 @@ public static Matcher nullValue(Class type) { * dummy parameter used to infer the generic type of the returned matcher * */ - @Factory public static Matcher notNullValue(Class type) { return not(nullValue(type)); } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsSame.java b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java similarity index 92% rename from hamcrest-core/src/main/java/org/hamcrest/core/IsSame.java rename to hamcrest/src/main/java/org/hamcrest/core/IsSame.java index b3641dc6..cbc3971b 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsSame.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java @@ -1,10 +1,7 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.core; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; @@ -37,7 +34,6 @@ public void describeTo(Description description) { * @param target * the target instance against which others should be assessed */ - @Factory public static Matcher sameInstance(T target) { return new IsSame(target); } @@ -49,7 +45,6 @@ public static Matcher sameInstance(T target) { * @param target * the target instance against which others should be assessed */ - @Factory public static Matcher theInstance(T target) { return new IsSame(target); } diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/ShortcutCombination.java b/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/core/ShortcutCombination.java rename to hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringContains.java b/hamcrest/src/main/java/org/hamcrest/core/StringContains.java new file mode 100644 index 00000000..050fd159 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/core/StringContains.java @@ -0,0 +1,48 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; + +/** + * Tests if the argument is a string that contains a specific substring. + */ +public class StringContains extends SubstringMatcher { + public StringContains(String substring) { this(false, substring); } + + public StringContains(boolean ignoringCase, String substring) { + super("containing", ignoringCase, substring); + } + + @Override + protected boolean evalSubstringOf(String s) { + return converted(s).contains(converted(substring)); + } + + /** + * Creates a matcher that matches if the examined {@link String} contains the specified + * {@link String} anywhere. + * For example: + *
assertThat("myStringOfNote", containsString("ring"))
+ * + * @param substring + * the substring that the returned matcher will expect to find within any examined string + * + */ + public static Matcher containsString(String substring) { + return new StringContains(false, substring); + } + + /** + * Creates a matcher that matches if the examined {@link String} contains the specified + * {@link String} anywhere, ignoring case. + * For example: + *
assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))
+ * + * @param substring + * the substring that the returned matcher will expect to find within any examined string + * + */ + public static Matcher containsStringIgnoringCase(String substring) { + return new StringContains(true, substring); + } + +} diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java b/hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java new file mode 100644 index 00000000..48ffd923 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java @@ -0,0 +1,44 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; + +/** + * Tests if the argument is a string that ends with a specific substring. + */ +public class StringEndsWith extends SubstringMatcher { + public StringEndsWith(String substring) { this(false, substring); } + + public StringEndsWith(boolean ignoringCase, String substring) { super("ending with", ignoringCase, substring); } + + @Override + protected boolean evalSubstringOf(String s) { + return converted(s).endsWith(converted(substring)); + } + + /** + * 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 + */ + public static Matcher endsWith(String suffix) { + return new StringEndsWith(false, suffix); + } + + /** + * Creates a matcher that matches if the examined {@link String} ends with the specified + * {@link String}, ignoring case. + * For example: + *
assertThat("myStringOfNote", endsWithIgnoringCase("note"))
+ * + * @param suffix + * the substring that the returned matcher will expect at the end of any examined string + */ + public static Matcher endsWithIgnoringCase(String suffix) { + return new StringEndsWith(true, suffix); + } + +} diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java b/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java new file mode 100644 index 00000000..b893ff0e --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java @@ -0,0 +1,68 @@ +/** + * + */ +package org.hamcrest.core; + +import java.util.regex.Pattern; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +/** + * @author borettim + * @author sf105 + * + */ +public class StringRegularExpression extends TypeSafeDiagnosingMatcher { + + protected StringRegularExpression(Pattern pattern) { + this.pattern = pattern; + } + + private Pattern pattern; + + @Override + public void describeTo(Description description) { + description.appendText("a string matching the pattern ").appendValue(pattern); + } + + @Override + protected boolean matchesSafely(String actual, Description mismatchDescription) { + if (!pattern.matcher(actual).matches()) { + mismatchDescription.appendText("the string was ").appendValue(actual); + return false; + } + return true; + } + + /** + * Creates a matcher that checks if the examined string matches a specified {@link java.util.regex.Pattern}. + * + *
+   * assertThat("abc", matchesRegex(Pattern.compile("ˆ[a-z]$"));
+   * 
+ * + * @param pattern + * the pattern to be used. + * @return The matcher. + */ + public static Matcher matchesRegex(Pattern pattern) { + return new StringRegularExpression(pattern); + } + + /** + * Creates a matcher that checks if the examined string matches a specified regex. + * + *
+   * assertThat("abc", matchesRegex("ˆ[a-z]+$"));
+   * 
+ * + * @param regex + * The regex to be used for the validation. + * @return The matcher. + */ + public static Matcher matchesRegex(String regex) { + return matchesRegex(Pattern.compile(regex)); + } +} diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java b/hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java new file mode 100644 index 00000000..fa49b793 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java @@ -0,0 +1,42 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; + +/** + * Tests if the argument is a string that starts with a specific substring. + */ +public class StringStartsWith extends SubstringMatcher { + public StringStartsWith(String substring) { this(false, substring); } + + public StringStartsWith(boolean ignoringCase, String substring) { super("starting with", ignoringCase, substring); } + + @Override + protected boolean evalSubstringOf(String s) { return converted(s).startsWith(converted(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 + */ + public static Matcher startsWith(String prefix) { return new StringStartsWith(false, prefix); } + + /** + *

+ * Creates a matcher that matches if the examined {@link String} starts with the specified + * {@link String}, ignoring case + *

+ * For example: + *
assertThat("myStringOfNote", startsWithIgnoringCase("My"))
+ * + * @param prefix + * the substring that the returned matcher will expect at the start of any examined string + */ + public static Matcher startsWithIgnoringCase(String prefix) { return new StringStartsWith(true, prefix); } + +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/SubstringMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/SubstringMatcher.java similarity index 56% rename from hamcrest-core/src/main/java/org/hamcrest/core/SubstringMatcher.java rename to hamcrest/src/main/java/org/hamcrest/core/SubstringMatcher.java index 5655388e..f2b7cff0 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/SubstringMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/core/SubstringMatcher.java @@ -5,18 +5,25 @@ public abstract class SubstringMatcher extends TypeSafeMatcher { - // TODO: Replace String with CharSequence to allow for easy interopability between + // TODO: Replace String with CharSequence to allow for easy interoperability between // String, StringBuffer, StringBuilder, CharBuffer, etc (joe). + private final String relationship; + private final boolean ignoringCase; protected final String substring; - protected SubstringMatcher(final String substring) { + protected SubstringMatcher(String relationship, boolean ignoringCase, String substring) { + this.relationship = relationship; + this.ignoringCase = ignoringCase; this.substring = substring; + if (null == substring) { + throw new IllegalArgumentException("missing substring"); + } } @Override public boolean matchesSafely(String item) { - return evalSubstringOf(item); + return evalSubstringOf(ignoringCase ? item.toLowerCase() :item); } @Override public void describeMismatchSafely(String item, Description mismatchDescription) { @@ -26,12 +33,15 @@ public void describeMismatchSafely(String item, Description mismatchDescription) @Override public void describeTo(Description description) { description.appendText("a string ") - .appendText(relationship()) + .appendText(relationship) .appendText(" ") .appendValue(substring); + if (ignoringCase) { + description.appendText(" ignoring case"); + } } + protected String converted(String arg) { return ignoringCase ? arg.toLowerCase() : arg; } protected abstract boolean evalSubstringOf(String string); - protected abstract String relationship(); -} \ No newline at end of file +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/package.html b/hamcrest/src/main/java/org/hamcrest/core/package.html similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/core/package.html rename to hamcrest/src/main/java/org/hamcrest/core/package.html diff --git a/hamcrest-core/src/main/java/org/hamcrest/internal/ArrayIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/internal/ArrayIterator.java rename to hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java diff --git a/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java new file mode 100644 index 00000000..9310abfc --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java @@ -0,0 +1,18 @@ +package org.hamcrest.internal; + +import org.hamcrest.Matcher; +import org.hamcrest.core.IsNull; + +import java.util.ArrayList; +import java.util.List; + +public class NullSafety { + @SuppressWarnings("unchecked") + public static List> nullSafe(Matcher[] itemMatchers) { + final List> matchers = new ArrayList>(itemMatchers.length); + for (final Matcher itemMatcher : itemMatchers) { + matchers.add((Matcher) (itemMatcher == null ? IsNull.nullValue() : itemMatcher)); + } + return matchers; + } +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java similarity index 91% rename from hamcrest-core/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java rename to hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java index 69d82935..b06df48c 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java @@ -12,8 +12,8 @@ * finder will return String.class. * * A FeatureMatcher is an abstract subclass of TypeSafeDiagnosingMatcher. - * Although it has a templated implementation of matchesSafely(<T>, Decription);, the - * actualy run-time signature of this is matchesSafely(Object, Description);. Instead, + * Although it has a templated implementation of matchesSafely(<T>, Description);, the + * actual run-time signature of this is matchesSafely(Object, Description);. Instead, * we must find the type by reflecting on the concrete implementation of *
protected abstract U featureValueOf(T actual);
* a method which is declared in FeatureMatcher. @@ -53,7 +53,7 @@ public Class findExpectedType(Class fromClass) { * @param method The method to examine. * @return true if this method references the relevant type */ - protected boolean canObtainExpectedTypeFrom(Method method) { + private boolean canObtainExpectedTypeFrom(Method method) { return method.getName().equals(methodName) && method.getParameterTypes().length == expectedNumberOfParameters && !method.isSynthetic(); @@ -64,7 +64,7 @@ protected boolean canObtainExpectedTypeFrom(Method method) { * @param method The method from which to extract * @return The type we're looking for */ - protected Class expectedTypeFrom(Method method) { + private Class expectedTypeFrom(Method method) { return method.getParameterTypes()[typedParameter]; } -} \ No newline at end of file +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/internal/SelfDescribingValue.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/internal/SelfDescribingValue.java rename to hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java diff --git a/hamcrest-core/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java similarity index 100% rename from hamcrest-core/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java rename to hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java index c69da699..bc8f8f43 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java @@ -1,9 +1,9 @@ package org.hamcrest.internal; -import java.util.Iterator; - import org.hamcrest.SelfDescribing; +import java.util.Iterator; + public class SelfDescribingValueIterator implements Iterator { private Iterator values; diff --git a/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java b/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java new file mode 100644 index 00000000..88288b07 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java @@ -0,0 +1,107 @@ +package org.hamcrest.io; + +import org.hamcrest.Description; +import org.hamcrest.FeatureMatcher; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import java.io.File; +import java.io.IOException; + +import static org.hamcrest.core.IsEqual.equalTo; + +public final class FileMatchers { + + public static Matcher anExistingDirectory() { + return fileChecker(IS_DIRECTORY, "an existing directory", "is not a directory"); + } + + public static Matcher anExistingFileOrDirectory() { + return fileChecker(EXISTS, "an existing file or directory", "does not exist"); + } + + public static Matcher anExistingFile() { + return fileChecker(IS_FILE, "an existing File", "is not a file"); + } + + public static Matcher aReadableFile() { + return fileChecker(CAN_READ, "a readable File", "cannot be read"); + } + + public static Matcher aWritableFile() { + return fileChecker(CAN_WRITE, "a writable File", "cannot be written to"); + } + + public static Matcher aFileWithSize(long size) { + return aFileWithSize(equalTo(size)); + } + + public static Matcher aFileWithSize(final Matcher expected) { + return new FeatureMatcher(expected, "A file with size", "size") { + @Override protected Long featureValueOf(File actual) { return actual.length(); } + }; + } + + public static Matcher aFileNamed(final Matcher expected) { + return new FeatureMatcher(expected, "A file with name", "name") { + @Override protected String featureValueOf(File actual) { return actual.getName(); } + }; + } + + public static Matcher aFileWithCanonicalPath(final Matcher expected) { + return new FeatureMatcher(expected, "A file with canonical path", "path") { + @Override protected String featureValueOf(File actual) { + try { + return actual.getCanonicalPath(); + } catch (IOException e) { + return "Exception: " + e.getMessage(); + } + } + }; + } + + public static Matcher aFileWithAbsolutePath(final Matcher expected) { + return new FeatureMatcher(expected, "A file with absolute path", "path") { + @Override protected String featureValueOf(File actual) { return actual.getAbsolutePath(); } + }; + } + + public static interface FileStatus { + boolean check(File actual); + } + + public static final FileStatus CAN_WRITE = new FileStatus() { + @Override public boolean check(File actual) { return actual.canWrite(); } + }; + public static final FileStatus CAN_READ = new FileStatus() { + @Override public boolean check(File actual) { return actual.canRead(); } + }; + + public static final FileStatus IS_FILE = new FileStatus() { + @Override public boolean check(File actual) { return actual.isFile(); } + }; + + public static final FileStatus IS_DIRECTORY = new FileStatus() { + @Override public boolean check(File actual) { return actual.isDirectory(); } + }; + + public static final FileStatus EXISTS = new FileStatus() { + @Override public boolean check(File actual) { return actual.exists(); } + }; + + private static Matcher fileChecker(final FileStatus fileStatus, final String successDescription, final String failureDescription) { + return new TypeSafeDiagnosingMatcher() { + public boolean matchesSafely(File actual, Description mismatchDescription) { + final boolean result = fileStatus.check(actual); + if (!result) { + mismatchDescription.appendText(failureDescription); + } + return result; + } + + public void describeTo(Description description) { + description.appendText(successDescription); + } + }; + } +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java b/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java similarity index 93% rename from hamcrest-library/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java rename to hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java index 27224064..d9cb0264 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java +++ b/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java @@ -1,13 +1,12 @@ package org.hamcrest.number; -import java.math.BigDecimal; -import java.math.MathContext; - import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; +import java.math.BigDecimal; +import java.math.MathContext; + public class BigDecimalCloseTo extends TypeSafeMatcher { private final BigDecimal delta; @@ -27,7 +26,9 @@ public boolean matchesSafely(BigDecimal item) { public void describeMismatchSafely(BigDecimal item, Description mismatchDescription) { mismatchDescription.appendValue(item) .appendText(" differed by ") - .appendValue(actualDelta(item)); + .appendValue(actualDelta(item)) + .appendText(" more than delta ") + .appendValue(delta); } @Override @@ -46,7 +47,6 @@ private BigDecimal actualDelta(BigDecimal item) { * Creates a matcher of {@link java.math.BigDecimal}s that matches when an examined BigDecimal is equal * to the specified operand, within a range of +/- error. The comparison for equality * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method. - *

* For example: *

assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
* @@ -55,7 +55,6 @@ private BigDecimal actualDelta(BigDecimal item) { * @param error * the delta (+/-) within which matches will be allowed */ - @Factory public static Matcher closeTo(BigDecimal operand, BigDecimal error) { return new BigDecimalCloseTo(operand, error); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/IsCloseTo.java b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java similarity index 87% rename from hamcrest-library/src/main/java/org/hamcrest/number/IsCloseTo.java rename to hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java index ac06871f..3b6967dc 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/number/IsCloseTo.java +++ b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java @@ -1,12 +1,11 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.number; import org.hamcrest.Description; import org.hamcrest.Matcher; -import org.hamcrest.Factory; import org.hamcrest.TypeSafeMatcher; +import static java.lang.Math.abs; + /** * Is the value a number equal to a value within some range of @@ -30,7 +29,9 @@ public boolean matchesSafely(Double item) { public void describeMismatchSafely(Double item, Description mismatchDescription) { mismatchDescription.appendValue(item) .appendText(" differed by ") - .appendValue(actualDelta(item)); + .appendValue(actualDelta(item)) + .appendText(" more than delta ") + .appendValue(delta); } @Override @@ -42,13 +43,12 @@ public void describeTo(Description description) { } private double actualDelta(Double item) { - return (Math.abs((item - value)) - delta); + return abs(item - value) - delta; } /** * Creates a matcher of {@link Double}s that matches when an examined double is equal * to the specified operand, within a range of +/- error. - *

* For example: *

assertThat(1.03, is(closeTo(1.0, 0.03)))
* @@ -57,7 +57,6 @@ private double actualDelta(Double item) { * @param error * the delta (+/-) within which matches will be allowed */ - @Factory public static Matcher closeTo(double operand, double error) { return new IsCloseTo(operand, error); } diff --git a/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java b/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java new file mode 100644 index 00000000..415a9a2b --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java @@ -0,0 +1,38 @@ +package org.hamcrest.number; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + + +/** + * Is the value a number actually not a number (NaN)? + */ +public final class IsNaN extends TypeSafeMatcher { + + private IsNaN() { } + + @Override + public boolean matchesSafely(Double item) { + return Double.isNaN(item); + } + + @Override + public void describeMismatchSafely(Double item, Description mismatchDescription) { + mismatchDescription.appendText("was ").appendValue(item); + } + + @Override + public void describeTo(Description description) { + description.appendText("a double value of NaN"); + } + + /** + * Creates a matcher of {@link Double}s that matches when an examined double is not a number. + * For example: + *
assertThat(Double.NaN, is(notANumber()))
+ */ + public static Matcher notANumber() { + return new IsNaN(); + } +} diff --git a/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java b/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java new file mode 100644 index 00000000..8a77713d --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java @@ -0,0 +1,79 @@ +package org.hamcrest.number; + +import org.hamcrest.Matcher; +import org.hamcrest.comparator.ComparatorMatcherBuilder; + +public class OrderingComparison { + + private OrderingComparison() { + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * equal to the specified value, as reported by the compareTo method of the + * examined object. + * For example: + *
assertThat(1, comparesEqualTo(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return zero + */ + public static > Matcher comparesEqualTo(T value) { + return ComparatorMatcherBuilder.usingNaturalOrdering().comparesEqualTo(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * greater than the specified value, as reported by the compareTo method of the + * examined object. + * For example: + *
assertThat(2, greaterThan(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return greater + * than zero + */ + public static > Matcher greaterThan(T value) { + return ComparatorMatcherBuilder.usingNaturalOrdering().greaterThan(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * greater than or equal to the specified value, as reported by the compareTo method + * of the examined object. + * For example: + *
assertThat(1, greaterThanOrEqualTo(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return greater + * than or equal to zero + */ + public static > Matcher greaterThanOrEqualTo(T value) { + return ComparatorMatcherBuilder.usingNaturalOrdering().greaterThanOrEqualTo(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * less than the specified value, as reported by the compareTo method of the + * examined object. + * For example: + *
assertThat(1, lessThan(2))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return less + * than zero + */ + public static > Matcher lessThan(T value) { + return ComparatorMatcherBuilder.usingNaturalOrdering().lessThan(value); + } + + /** + * Creates a matcher of {@link Comparable} object that matches when the examined object is + * less than or equal to the specified value, as reported by the compareTo method + * of the examined object. + * For example: + *
assertThat(1, lessThanOrEqualTo(1))
+ * + * @param value the value which, when passed to the compareTo method of the examined object, should return less + * than or equal to zero + */ + public static > Matcher lessThanOrEqualTo(T value) { + return ComparatorMatcherBuilder.usingNaturalOrdering().lessThanOrEqualTo(value); + } +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/package.html b/hamcrest/src/main/java/org/hamcrest/number/package.html similarity index 100% rename from hamcrest-library/src/main/java/org/hamcrest/number/package.html rename to hamcrest/src/main/java/org/hamcrest/number/package.html diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java b/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java new file mode 100644 index 00000000..cffea890 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java @@ -0,0 +1,86 @@ +package org.hamcrest.object; + +import org.hamcrest.Description; +import org.hamcrest.DiagnosingMatcher; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.core.IsEqual; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + +import static java.lang.String.format; + +public class HasEqualValues extends TypeSafeDiagnosingMatcher { + private final T expectedObject; + private final List fieldMatchers; + + public HasEqualValues(T expectedObject) { + super(expectedObject.getClass()); + this.expectedObject = expectedObject; + this.fieldMatchers = fieldMatchers(expectedObject); + } + + @Override + protected boolean matchesSafely(T item, Description mismatch) { + for (FieldMatcher fieldMatcher : fieldMatchers) { + if (!fieldMatcher.matches(item, mismatch)) { + return false; + } + } + return true; + } + + @Override + public void describeTo(Description description) { + description.appendText(expectedObject.getClass().getSimpleName()) + .appendText(" has values ") + .appendList("[", ", ", "]", fieldMatchers); + } + + private static class FieldMatcher extends DiagnosingMatcher { + private final Field field; + private final Matcher matcher; + + public FieldMatcher(Field field, Object expectedObject) { + this.field = field; + this.matcher = IsEqual.equalTo(uncheckedGet(field, expectedObject)); + } + @Override + protected boolean matches(Object item, Description mismatch) { + final Object actual = uncheckedGet(field, item); + if (!matcher.matches(actual)) { + mismatch.appendText("'").appendText(field.getName()).appendText("' "); + matcher.describeMismatch(actual, mismatch); + return false; + } + return true; + } + + @Override + public void describeTo(Description description) { + description.appendText(field.getName()) + .appendText(": ") + .appendDescriptionOf(matcher); + } + } + + private static List fieldMatchers(Object expectedObject) { + final List result = new ArrayList<>(); + for (Field field : expectedObject.getClass().getFields()) { + result.add(new FieldMatcher(field, expectedObject)); + } + return result; + } + + private static Object uncheckedGet(Field field, Object object) { + try { + return field.get(object); + } catch (Exception e) { + throw new AssertionError(format("IllegalAccess, reading field '%s' from %s", field.getName(), object)); + } + } + + +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/object/HasToString.java b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java similarity index 94% rename from hamcrest-library/src/main/java/org/hamcrest/object/HasToString.java rename to hamcrest/src/main/java/org/hamcrest/object/HasToString.java index 7e8dd577..2dab9de4 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/object/HasToString.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java @@ -1,6 +1,5 @@ package org.hamcrest.object; -import org.hamcrest.Factory; import org.hamcrest.FeatureMatcher; import org.hamcrest.Matcher; @@ -19,14 +18,12 @@ protected String featureValueOf(T actual) { /** * Creates a matcher that matches any examined object whose toString method * returns a value that satisfies the specified matcher. - *

* For example: *

assertThat(true, hasToString(equalTo("TRUE")))
* * @param toStringMatcher * the matcher used to verify the toString result */ - @Factory public static Matcher hasToString(Matcher toStringMatcher) { return new HasToString(toStringMatcher); } @@ -34,14 +31,12 @@ public static Matcher hasToString(Matcher toStringMatcher /** * Creates a matcher that matches any examined object whose toString method * returns a value equalTo the specified string. - *

* For example: *

assertThat(true, hasToString("TRUE"))
* * @param expectedToString * the expected toString result */ - @Factory public static Matcher hasToString(String expectedToString) { return new HasToString(equalTo(expectedToString)); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/object/IsCompatibleType.java b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java similarity index 95% rename from hamcrest-library/src/main/java/org/hamcrest/object/IsCompatibleType.java rename to hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java index 85620249..e1410a47 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/object/IsCompatibleType.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java @@ -2,7 +2,6 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; -import org.hamcrest.Factory; import org.hamcrest.TypeSafeMatcher; public class IsCompatibleType extends TypeSafeMatcher> { @@ -30,14 +29,12 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link Class} that matches when the specified baseType is * assignable from the examined class. - *

* For example: *

assertThat(Integer.class, typeCompatibleWith(Number.class))
* * @param baseType * the base class to examine classes against */ - @Factory public static Matcher> typeCompatibleWith(Class baseType) { return new IsCompatibleType(baseType); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/object/IsEventFrom.java b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java similarity index 94% rename from hamcrest-library/src/main/java/org/hamcrest/object/IsEventFrom.java rename to hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java index ea3b0000..43b64d46 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/object/IsEventFrom.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java @@ -1,14 +1,11 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.object; -import java.util.EventObject; - import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; +import java.util.EventObject; + /** * Tests if the value is an event announced by a specific object. @@ -52,7 +49,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link java.util.EventObject} that matches any object * derived from eventClass announced by source. - *

* For example: *
assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
* @@ -61,7 +57,6 @@ public void describeTo(Description description) { * @param source * the source of the event */ - @Factory public static Matcher eventFrom(Class eventClass, Object source) { return new IsEventFrom(eventClass, source); } @@ -69,14 +64,12 @@ public static Matcher eventFrom(Class eventC /** * Creates a matcher of {@link java.util.EventObject} that matches any EventObject * announced by source. - *

* For example: *
assertThat(myEvent, is(eventFrom(myBean)))
* * @param source * the source of the event */ - @Factory public static Matcher eventFrom(Object source) { return eventFrom(EventObject.class, source); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/object/package.html b/hamcrest/src/main/java/org/hamcrest/object/package.html similarity index 100% rename from hamcrest-library/src/main/java/org/hamcrest/object/package.html rename to hamcrest/src/main/java/org/hamcrest/object/package.html diff --git a/hamcrest/src/main/java/org/hamcrest/text/CharSequenceLength.java b/hamcrest/src/main/java/org/hamcrest/text/CharSequenceLength.java new file mode 100644 index 00000000..e5e3d466 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/text/CharSequenceLength.java @@ -0,0 +1,57 @@ +package org.hamcrest.text; + +import org.hamcrest.FeatureMatcher; +import org.hamcrest.Matcher; + +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * @author Marco Leichsenring + * @author Steve Freeman + */ +public class CharSequenceLength extends FeatureMatcher { + + /** + * @param lengthMatcher The matcher to apply to the feature + */ + @SuppressWarnings("WeakerAccess") + public CharSequenceLength(Matcher lengthMatcher) { + super(lengthMatcher, "a CharSequence with length", "length"); + } + + @Override + protected Integer featureValueOf(CharSequence actual) { + return actual.length(); + } + + /** + * Creates a matcher of {@link CharSequence} that matches when a char sequence has the given length + * For example: + * + *
+     * assertThat("text", hasLength(4))
+     * 
+ * + * @param length the expected length of the string + */ + public static Matcher hasLength(int length) { + return new CharSequenceLength(equalTo(length)); + } + + /** + * Creates a matcher of {@link CharSequence} that matches when a char sequence has the given length + * For example: + * + *
+      * assertThat("text", hasLength(lessThan(4)))
+      * 
+ * + * @param lengthMatcher the expected length of the string + */ + @SuppressWarnings("WeakerAccess") + public static Matcher hasLength(Matcher lengthMatcher) { + return new CharSequenceLength(lengthMatcher); + } +} + + diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java new file mode 100644 index 00000000..b168541b --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java @@ -0,0 +1,55 @@ + +package org.hamcrest.text; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +import java.util.regex.Pattern; + +import static org.hamcrest.core.AnyOf.anyOf; +import static org.hamcrest.core.IsNull.nullValue; + +/** + * Matches blank Strings (and null). + */ +public final class IsBlankString extends TypeSafeMatcher { + private static final IsBlankString BLANK_INSTANCE = new IsBlankString(); + @SuppressWarnings("unchecked") + private static final Matcher NULL_OR_BLANK_INSTANCE = anyOf(nullValue(), BLANK_INSTANCE); + + private static final Pattern REGEX_WHITESPACE = Pattern.compile("\\s*"); + + private IsBlankString() { } + + @Override + public boolean matchesSafely(String item) { + return REGEX_WHITESPACE.matcher(item).matches(); + } + + @Override + public void describeTo(Description description) { + description.appendText("a blank string"); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string contains + * zero or more whitespace characters and nothing else. + * For example: + *
assertThat("  ", is(blankString()))
+ */ + public static Matcher blankString() { + return BLANK_INSTANCE; + } + + /** + * Creates a matcher of {@link String} that matches when the examined string is null, or + * contains zero or more whitespace characters and nothing else. + * For example: + *
assertThat(((String)null), is(blankOrNullString()))
+ * + */ + public static Matcher blankOrNullString() { + return NULL_OR_BLANK_INSTANCE; + } +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/IsEmptyString.java b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java similarity index 51% rename from hamcrest-library/src/main/java/org/hamcrest/text/IsEmptyString.java rename to hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java index 0e6a0e4f..bbe56814 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/IsEmptyString.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java @@ -1,25 +1,26 @@ package org.hamcrest.text; -import static org.hamcrest.core.AnyOf.anyOf; -import static org.hamcrest.core.IsNull.nullValue; - -import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +import static org.hamcrest.core.AnyOf.anyOf; +import static org.hamcrest.core.IsNull.nullValue; /** * Matches empty Strings (and null). */ -public final class IsEmptyString extends BaseMatcher { +public final class IsEmptyString extends TypeSafeMatcher { private static final IsEmptyString INSTANCE = new IsEmptyString(); @SuppressWarnings("unchecked") private static final Matcher NULL_OR_EMPTY_INSTANCE = anyOf(nullValue(), INSTANCE); + private IsEmptyString() { } + @Override - public boolean matches(Object item) { - return item != null && item instanceof String && ((String) item).equals(""); + public boolean matchesSafely(String item) { + return item.equals(""); } @Override @@ -29,26 +30,48 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link String} that matches when the examined string has zero length. - *

* For example: *

assertThat("", isEmptyString())
* + * @deprecated use is(emptyString()) instead */ - @Factory + @Deprecated public static Matcher isEmptyString() { + return emptyString(); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string has zero length. + * For example: + *
assertThat("", is(emptyString()))
+ * + */ + public static Matcher emptyString() { return INSTANCE; } /** * Creates a matcher of {@link String} that matches when the examined string is null, or * has zero length. - *

* For example: - *

assertThat(((String)null), isEmptyString())
+ *
assertThat(((String)null), isEmptyOrNullString())
+ * + * @deprecated use is(emptyOrNullString()) instead * */ - @Factory + @Deprecated public static Matcher isEmptyOrNullString() { + return emptyOrNullString(); + } + + /** + * Creates a matcher of {@link String} that matches when the examined string is null, or + * has zero length. + * For example: + *
assertThat(((String)null), is(emptyOrNullString()))
+ * + */ + public static Matcher emptyOrNullString() { return NULL_OR_EMPTY_INSTANCE; } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java similarity index 53% rename from hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java rename to hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java index 5e1fd5e8..c3e0d7b1 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java @@ -1,64 +1,56 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.text; import org.hamcrest.Description; import org.hamcrest.Matcher; -import org.hamcrest.Factory; import org.hamcrest.TypeSafeMatcher; import static java.lang.Character.isWhitespace; /** - * Tests if a string is equal to another string, ignoring any changes in whitespace. + * Tests if a string is equal to another string, compressing any changes in whitespace. */ -public class IsEqualIgnoringWhiteSpace extends TypeSafeMatcher { +public class IsEqualCompressingWhiteSpace extends TypeSafeMatcher { - // TODO: Replace String with CharSequence to allow for easy interopability between + // TODO: Replace String with CharSequence to allow for easy interoperability between // String, StringBuffer, StringBuilder, CharBuffer, etc (joe). private final String string; - public IsEqualIgnoringWhiteSpace(String string) { + public IsEqualCompressingWhiteSpace(String string) { if (string == null) { - throw new IllegalArgumentException("Non-null value required by IsEqualIgnoringCase()"); + throw new IllegalArgumentException("Non-null value required"); } this.string = string; } @Override public boolean matchesSafely(String item) { - return stripSpace(string).equalsIgnoreCase(stripSpace(item)); + return stripSpaces(string).equals(stripSpaces(item)); } @Override public void describeMismatchSafely(String item, Description mismatchDescription) { - mismatchDescription.appendText("was ").appendText(stripSpace(item)); + mismatchDescription.appendText("was ").appendValue(item); } @Override public void describeTo(Description description) { - description.appendText("equalToIgnoringWhiteSpace(") + description.appendText("a string equal to ") .appendValue(string) - .appendText(")"); + .appendText(" compressing white space"); } - public String stripSpace(String toBeStripped) { - final StringBuilder result = new StringBuilder(); - boolean lastWasSpace = true; - for (int i = 0; i < toBeStripped.length(); i++) { - char c = toBeStripped.charAt(i); - if (isWhitespace(c)) { - if (!lastWasSpace) { - result.append(' '); - } - lastWasSpace = true; - } else { - result.append(c); - lastWasSpace = false; - } - } - return result.toString().trim(); + public String stripSpaces(String toBeStripped) { + return toBeStripped.replaceAll("\\s+", " ").trim(); + } + + /** + * @deprecated {@link #equalToCompressingWhiteSpace(String)} + * @param expectedString + * the expected value of matched strings + */ + public static Matcher equalToIgnoringWhiteSpace(String expectedString) { + return new IsEqualCompressingWhiteSpace(expectedString); } /** @@ -69,16 +61,14 @@ public String stripSpace(String toBeStripped) { *
  • all leading and trailing whitespace of both the expectedString and the examined string are ignored
  • *
  • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
  • * - *

    * For example: - *

    assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
    - * + *
    assertThat("   my\tfoo  bar ", equalToCompressingWhiteSpace(" my  foo bar"))
    + * * @param expectedString * the expected value of matched strings */ - @Factory - public static Matcher equalToIgnoringWhiteSpace(String expectedString) { - return new IsEqualIgnoringWhiteSpace(expectedString); + public static Matcher equalToCompressingWhiteSpace(String expectedString) { + return new IsEqualCompressingWhiteSpace(expectedString); } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java b/hamcrest/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java similarity index 82% rename from hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java rename to hamcrest/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java index 822dd27e..defa6123 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java @@ -1,10 +1,7 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.text; import org.hamcrest.Description; import org.hamcrest.Matcher; -import org.hamcrest.Factory; import org.hamcrest.TypeSafeMatcher; /** @@ -12,14 +9,14 @@ */ public class IsEqualIgnoringCase extends TypeSafeMatcher { - // TODO: Replace String with CharSequence to allow for easy interopability between + // TODO: Replace String with CharSequence to allow for easy interoperability between // String, StringBuffer, StringBuilder, CharBuffer, etc (joe). private final String string; public IsEqualIgnoringCase(String string) { if (string == null) { - throw new IllegalArgumentException("Non-null value required by IsEqualIgnoringCase()"); + throw new IllegalArgumentException("Non-null value required"); } this.string = string; } @@ -31,27 +28,25 @@ public boolean matchesSafely(String item) { @Override public void describeMismatchSafely(String item, Description mismatchDescription) { - mismatchDescription.appendText("was ").appendText(item); + mismatchDescription.appendText("was ").appendValue(item); } @Override public void describeTo(Description description) { - description.appendText("equalToIgnoringCase(") + description.appendText("a string equal to ") .appendValue(string) - .appendText(")"); + .appendText(" ignoring case"); } /** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. - *

    * For example: *

    assertThat("Foo", equalToIgnoringCase("FOO"))
    * * @param expectedString * the expected value of matched strings */ - @Factory public static Matcher equalToIgnoringCase(String expectedString) { return new IsEqualIgnoringCase(expectedString); } diff --git a/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java new file mode 100644 index 00000000..e0eda0a8 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java @@ -0,0 +1,41 @@ +package org.hamcrest.text; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +import java.util.regex.Pattern; + +public class MatchesPattern extends TypeSafeMatcher { + private final Pattern pattern; + + public MatchesPattern(Pattern pattern) { + this.pattern = pattern; + } + + @Override + protected boolean matchesSafely(String item) { + return pattern.matcher(item).matches(); + } + + @Override + public void describeTo(Description description) { + description.appendText("a string matching the pattern '" + pattern + "'"); + } + + /** + * Creates a matcher of {@link java.lang.String} that matches when the examined string + * exactly matches the given {@link java.util.regex.Pattern}. + */ + public static Matcher matchesPattern(Pattern pattern) { + return new MatchesPattern(pattern); + } + + /** + * Creates a matcher of {@link java.lang.String} that matches when the examined string + * exactly matches the given regular expression, treated as a {@link java.util.regex.Pattern}. + */ + public static Matcher matchesPattern(String regex) { + return new MatchesPattern(Pattern.compile(regex)); + } +} diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/StringContainsInOrder.java b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java similarity index 66% rename from hamcrest-library/src/main/java/org/hamcrest/text/StringContainsInOrder.java rename to hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java index a4f29366..6df9a531 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/StringContainsInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java @@ -1,17 +1,18 @@ package org.hamcrest.text; import org.hamcrest.Description; -import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; +import java.util.Arrays; + public class StringContainsInOrder extends TypeSafeMatcher { private final Iterable substrings; public StringContainsInOrder(Iterable substrings) { this.substrings = substrings; } - + @Override public boolean matchesSafely(String s) { int fromIndex = 0; @@ -21,6 +22,7 @@ public boolean matchesSafely(String s) { if (fromIndex == -1) { return false; } + fromIndex++; } return true; @@ -40,16 +42,29 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link String} that matches when the examined string contains all of - * the specified substrings, regardless of the order of their appearance. - *

    + * the specified substrings, considering the order of their appearance. * For example: *

    assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
    + * fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * @param substrings * the substrings that must be contained within matching strings */ - @Factory public static Matcher stringContainsInOrder(Iterable substrings) { return new StringContainsInOrder(substrings); } + + /** + * Creates a matcher of {@link String} that matches when the examined string contains all of + * the specified substrings, considering the order of their appearance. + * For example: + *
    assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
    + * fails as "foo" occurs before "bar" in the string "myfoobarbaz" + * + * @param substrings + * the substrings that must be contained within matching strings + */ + public static Matcher stringContainsInOrder(String... substrings) { + return new StringContainsInOrder(Arrays.asList(substrings)); + } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/package.html b/hamcrest/src/main/java/org/hamcrest/text/package.html similarity index 100% rename from hamcrest-library/src/main/java/org/hamcrest/text/package.html rename to hamcrest/src/main/java/org/hamcrest/text/package.html diff --git a/hamcrest-library/src/main/java/org/hamcrest/xml/HasXPath.java b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java similarity index 97% rename from hamcrest-library/src/main/java/org/hamcrest/xml/HasXPath.java rename to hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java index 54398245..30ed081a 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/xml/HasXPath.java +++ b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java @@ -1,6 +1,9 @@ package org.hamcrest.xml; -import org.hamcrest.*; +import org.hamcrest.Condition; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; import org.hamcrest.core.IsAnything; import org.w3c.dom.Node; @@ -106,7 +109,6 @@ private static XPathExpression compiledXPath(String xPathExpression, NamespaceCo /** * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the * specified xPath that satisfies the specified valueMatcher. - *

    * For example: *

    assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
    * @@ -115,7 +117,6 @@ private static XPathExpression compiledXPath(String xPathExpression, NamespaceCo * @param valueMatcher * matcher for the value at the specified xpath */ - @Factory public static Matcher hasXPath(String xPath, Matcher valueMatcher) { return hasXPath(xPath, NO_NAMESPACE_CONTEXT, valueMatcher); } @@ -124,7 +125,6 @@ public static Matcher hasXPath(String xPath, Matcher valueMatcher) * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the * specified xPath, within the specified namespaceContext, that satisfies * the specified valueMatcher. - *

    * For example: *

    assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
    * @@ -135,7 +135,6 @@ public static Matcher hasXPath(String xPath, Matcher valueMatcher) * @param valueMatcher * matcher for the value at the specified xpath */ - @Factory public static Matcher hasXPath(String xPath, NamespaceContext namespaceContext, Matcher valueMatcher) { return new HasXPath(xPath, namespaceContext, valueMatcher, STRING); } @@ -143,14 +142,12 @@ public static Matcher hasXPath(String xPath, NamespaceContext namespaceCon /** * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node * at the specified xPath, with any content. - *

    * For example: *

    assertThat(xml, hasXPath("/root/something[2]/cheese"))
    * * @param xPath * the target xpath */ - @Factory public static Matcher hasXPath(String xPath) { return hasXPath(xPath, NO_NAMESPACE_CONTEXT); } @@ -158,7 +155,6 @@ public static Matcher hasXPath(String xPath) { /** * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node * at the specified xPath within the specified namespace context, with any content. - *

    * For example: *

    assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
    * @@ -167,7 +163,6 @@ public static Matcher hasXPath(String xPath) { * @param namespaceContext * the namespace for matching nodes */ - @Factory public static Matcher hasXPath(String xPath, NamespaceContext namespaceContext) { return new HasXPath(xPath, namespaceContext, WITH_ANY_CONTENT, XPathConstants.NODE); } diff --git a/hamcrest-library/src/main/java/org/hamcrest/xml/package.html b/hamcrest/src/main/java/org/hamcrest/xml/package.html similarity index 100% rename from hamcrest-library/src/main/java/org/hamcrest/xml/package.html rename to hamcrest/src/main/java/org/hamcrest/xml/package.html diff --git a/hamcrest/src/test/java/org/hamcrest/AbstractMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/AbstractMatcherTest.java new file mode 100644 index 00000000..f11dec3b --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/AbstractMatcherTest.java @@ -0,0 +1,77 @@ +package org.hamcrest; + +import junit.framework.TestCase; +import org.junit.Assert; + +public abstract class AbstractMatcherTest extends TestCase { + + /** + * Create an instance of the Matcher so some generic safety-net tests can be run on it. + */ + protected abstract Matcher createMatcher(); + + public static void assertMatches(Matcher matcher, T arg) { + assertMatches("Expected match, but mismatched", matcher, arg); + } + + public static void assertMatches(String message, Matcher matcher, Object arg) { + if (!matcher.matches(arg)) { + Assert.fail(message + " because: '" + mismatchDescription(matcher, arg) + "'"); + } + } + + public static void assertDoesNotMatch(Matcher c, T arg) { + assertDoesNotMatch("Unexpected match", c, arg); + } + + public static void assertDoesNotMatch(String message, Matcher c, T arg) { + Assert.assertFalse(message, c.matches(arg)); + } + + public static void assertDescription(String expected, Matcher matcher) { + Description description = new StringDescription(); + description.appendDescriptionOf(matcher); + Assert.assertEquals("Expected description", expected, description.toString().trim()); + } + + public static void assertMismatchDescription(String expected, Matcher matcher, Object arg) { + Assert.assertFalse("Precondition: Matcher should not match item.", matcher.matches(arg)); + Assert.assertEquals("Expected mismatch description", expected, mismatchDescription(matcher, arg)); + } + + public static void assertNullSafe(Matcher matcher) { + try { + matcher.matches(null); + } + catch (Exception e) { + Assert.fail("Matcher was not null safe"); + } + } + + public static void assertUnknownTypeSafe(Matcher matcher) { + try { + matcher.matches(new UnknownType()); + } catch (Exception e) { + Assert.fail("Matcher was not unknown type safe, because: " + e); + } + } + + public void testIsNullSafe() { + assertNullSafe(createMatcher()); + } + + public void testCopesWithUnknownTypes() { + createMatcher().matches(new UnknownType()); + } + + private static String mismatchDescription(Matcher matcher, Object arg) { + Description description = new StringDescription(); + matcher.describeMismatch(arg, description); + return description.toString().trim(); + } + + @SuppressWarnings("WeakerAccess") + public static class UnknownType { + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java b/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java new file mode 100644 index 00000000..afbdd65f --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java @@ -0,0 +1,114 @@ +package org.hamcrest; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public final class BaseDescriptionTest { + + private final StringBuilder result = new StringBuilder(); + + private final BaseDescription baseDescription = new BaseDescription() { + @Override protected void append(char c) { + result.append(c); + } + }; + + @Test public void + describesAppendedNullValue() { + baseDescription.appendValue(null); + assertEquals("null", result.toString()); + } + + @Test public void + quotesAppendedStringValue() { + baseDescription.appendValue("foo"); + assertEquals("\"foo\"", result.toString()); + } + + @Test public void + quotesAppendedCharacterValue() { + baseDescription.appendValue('f'); + assertEquals("\"f\"", result.toString()); + } + + @Test public void + quotesAppendedTab() { + baseDescription.appendValue('\t'); + assertEquals("\"\\t\"", result.toString()); + } + + @Test public void + quotesAppendedNewLine() { + baseDescription.appendValue('\n'); + assertEquals("\"\\n\"", result.toString()); + } + + @Test public void + quotesAppendedLineReturn() { + baseDescription.appendValue('\r'); + assertEquals("\"\\r\"", result.toString()); + } + + @Test public void + quotesAppendedBackslash() { + baseDescription.appendValue('\\'); + assertEquals("\"\\\\\"", result.toString()); + } + + @Test public void + quotesAppendedDoubleQuotes() { + baseDescription.appendValue('"'); + assertEquals("\"\\\"\"", result.toString()); + } + + @Test public void + bracketsAppendedByteValue() { + baseDescription.appendValue(Byte.valueOf("2")); + assertEquals("<2b>", result.toString()); + } + + @Test public void + bracketsAppendedShortValue() { + baseDescription.appendValue(Short.valueOf("2")); + assertEquals("<2s>", result.toString()); + } + + @Test public void + bracketsAppendedLongValue() { + baseDescription.appendValue(Long.valueOf("2")); + assertEquals("<2L>", result.toString()); + } + + @Test public void + bracketsAppendedFloatValue() { + baseDescription.appendValue(Float.valueOf("1.2")); + assertEquals("<1.2F>", result.toString()); + } + + @Test public void + describesAppendedArrayValue() { + baseDescription.appendValue(new String[] {"2", "3"}); + assertEquals("[\"2\", \"3\"]", result.toString()); + } + + @Test public void + bracketsAppendedObjectValue() { + final Object value = new Object(); + baseDescription.appendValue(value); + assertEquals("<" + value.toString() + ">", result.toString()); + } + + @Test public void + safelyDescribesAppendedValueOfObjectWhoseToStringThrowsAnException() { + final Object value = new Object() { + @Override public String toString() { + throw new UnsupportedOperationException(); + } + }; + + final String expected = value.getClass().getName() + "@" + Integer.toHexString(value.hashCode()); + baseDescription.appendValue(value); + assertEquals("<" + expected + ">", result.toString()); + } +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/BaseMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java similarity index 73% rename from hamcrest-unit-test/src/main/java/org/hamcrest/BaseMatcherTest.java rename to hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java index 839a0158..e663f041 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/BaseMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java @@ -1,10 +1,14 @@ package org.hamcrest; -import junit.framework.TestCase; +import org.junit.Test; -public class BaseMatcherTest extends TestCase { +import static org.junit.Assert.assertEquals; - public void testDescribesItselfWithToStringMethod() { +public final class BaseMatcherTest { + + @Test + public void + describesItselfWithToStringMethod() { Matcher someMatcher = new BaseMatcher() { @Override public boolean matches(Object item) { diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/CustomMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java similarity index 72% rename from hamcrest-unit-test/src/main/java/org/hamcrest/CustomMatcherTest.java rename to hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java index 7aa6ec7b..08649f7a 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/CustomMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java @@ -1,11 +1,13 @@ package org.hamcrest; +import org.junit.Test; + import static org.hamcrest.AbstractMatcherTest.assertDescription; -import junit.framework.TestCase; -public class CustomMatcherTest extends TestCase { +public final class CustomMatcherTest { - public void testUsesStaticDescription() throws Exception { + @Test public void + usesStaticDescription() throws Exception { Matcher matcher = new CustomMatcher("I match strings") { @Override public boolean matches(Object item) { diff --git a/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java new file mode 100644 index 00000000..2c867126 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java @@ -0,0 +1,41 @@ +package org.hamcrest; + +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; + +public final class CustomTypeSafeMatcherTest { + private static final String STATIC_DESCRIPTION = "I match non empty strings"; + + private final Matcher customMatcher = new CustomTypeSafeMatcher(STATIC_DESCRIPTION) { + @Override + public boolean matchesSafely(String item) { + return false; + } + + @Override + public void describeMismatchSafely(String item, Description mismatchDescription) { + mismatchDescription.appendText("an " + item); + } + }; + + @Test public void + usesStaticDescription() throws Exception { + assertDescription(STATIC_DESCRIPTION, customMatcher); + } + + @Test public void + reportsMismatch() { + assertMismatchDescription("an item", customMatcher, "item"); + } + + @Test public void + isNullSafe() { + assertNullSafe(customMatcher); + } + + @Test public void + copesWithUnknownTypes() { + assertUnknownTypeSafe(customMatcher); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java new file mode 100644 index 00000000..8d864eb8 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java @@ -0,0 +1,68 @@ +package org.hamcrest; + +import org.hamcrest.core.IsEqual; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.junit.Assert.assertEquals; + +public final class FeatureMatcherTest { + private final FeatureMatcher resultMatcher = resultMatcher(); + + @Test public void + matchesPartOfAnObject() { + assertMatches("feature", resultMatcher, new Thingy("bar")); + assertDescription("Thingy with result \"bar\"", resultMatcher); + } + + @Test public void + mismatchesPartOfAnObject() { + assertMismatchDescription("result mismatch-description", resultMatcher, new Thingy("foo")); + } + + @Test public void + doesNotThrowNullPointerException() { + assertMismatchDescription("was null", resultMatcher, null); + } + + @Test public void + doesNotThrowClassCastException() { + resultMatcher.matches(new ShouldNotMatch()); + StringDescription mismatchDescription = new StringDescription(); + resultMatcher.describeMismatch(new ShouldNotMatch(), mismatchDescription); + assertEquals("was ShouldNotMatch ", mismatchDescription.toString()); + } + + public static class Match extends IsEqual { + public Match(String equalArg) { super(equalArg); } + @Override public void describeMismatch(Object item, Description description) { + description.appendText("mismatch-description"); + } + } + + public static class Thingy { + private final String result; + + public Thingy(String result) { + this.result = result; + } + + public String getResult() { + return result; + } + } + + public static class ShouldNotMatch { + @Override public String toString() { return "ShouldNotMatch"; } + } + + private static FeatureMatcher resultMatcher() { + return new FeatureMatcher(new Match("bar"), "Thingy with result", "result") { + @Override + public String featureValueOf(Thingy actual) { + return actual.getResult(); + } + }; + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java b/hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java new file mode 100644 index 00000000..8d88daa8 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java @@ -0,0 +1,99 @@ +package org.hamcrest; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.*; + +public final class MatcherAssertTest { + + @Test public void + includesDescriptionOfTestedValueInErrorMessage() { + String expected = "expected"; + String actual = "actual"; + String endLine = System.lineSeparator(); + + String expectedMessage = "identifier" + endLine + "Expected: \"expected\"" + endLine + " but: was \"actual\""; + + try { + assertThat("identifier", actual, equalTo(expected)); + } + catch (AssertionError e) { + assertTrue(e.getMessage().startsWith(expectedMessage)); + return; + } + + fail("should have failed"); + } + + @Test public void + descriptionCanBeElided() { + String expected = "expected"; + String actual = "actual"; + String endLine = System.lineSeparator(); + + String expectedMessage = endLine + "Expected: \"expected\"" + endLine + " but: was \"actual\""; + + try { + assertThat(actual, equalTo(expected)); + } + catch (AssertionError e) { + assertTrue(e.getMessage().startsWith(expectedMessage)); + return; + } + + fail("should have failed"); + } + + @Test public void + canTestBooleanDirectly() { + assertThat("success reason message", true); + + try { + assertThat("failing reason message", false); + } + catch (AssertionError e) { + assertEquals("failing reason message", e.getMessage()); + return; + } + + fail("should have failed"); + } + + @Test public void + includesMismatchDescription() { + Matcher matcherWithCustomMismatchDescription = new BaseMatcher() { + @Override + public boolean matches(Object item) { + return false; + } + + @Override + public void describeTo(Description description) { + description.appendText("Something cool"); + } + + @Override + public void describeMismatch(Object item, Description mismatchDescription) { + mismatchDescription.appendText("Not cool"); + } + }; + + String endLine = System.lineSeparator(); + String expectedMessage = endLine + "Expected: Something cool" + endLine + " but: Not cool"; + + try { + assertThat("Value", matcherWithCustomMismatchDescription); + fail("should have failed"); + } + catch (AssertionError e) { + assertEquals(expectedMessage, e.getMessage()); + } + } + + @Test public void + canAssertSubtypes() { + assertThat(1, equalTo((Number) 1)); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/NullDescriptionTest.java b/hamcrest/src/test/java/org/hamcrest/NullDescriptionTest.java new file mode 100644 index 00000000..cccece0a --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/NullDescriptionTest.java @@ -0,0 +1,18 @@ +package org.hamcrest; + +import org.hamcrest.Description.NullDescription; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public final class NullDescriptionTest { + + private final NullDescription nullDescription = new Description.NullDescription(); + + @Test public void + isUnchangedByAppendedText() { + nullDescription.appendText("myText"); + assertEquals("", nullDescription.toString()); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/TypeSafeDiagnosingMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/TypeSafeDiagnosingMatcherTest.java new file mode 100644 index 00000000..0b001391 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/TypeSafeDiagnosingMatcherTest.java @@ -0,0 +1,81 @@ +package org.hamcrest; + +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; + +/** + * @author Steve Freeman 2016 http://www.hamcrest.com + */ +@SuppressWarnings("WeakerAccess") +public class TypeSafeDiagnosingMatcherTest { + + @Test public void + describesMismatches() { + assertMismatchDescription("was null", STRING_MATCHER, null); + assertMismatchDescription("was Character \"c\"", STRING_MATCHER, 'c'); + assertMismatchDescription("mismatching", STRING_MATCHER, "other"); + } + + @Test public void + detects_non_builtin_types() { + final Matcher matcher = new TypeSafeDiagnosingMatcher() { + @Override + protected boolean matchesSafely(NotBuiltIn item, Description mismatchDescription) { + return true; + } + + @Override public void describeTo(Description description) { description.appendText("a not builtin"); } + }; + + assertMatches("not built in", matcher, new NotBuiltIn()); + assertDoesNotMatch("other not built in", (Matcher)matcher, new OtherNotBuiltIn()); + } + + @Test public void + filters_type_for_subclassed_matcher_when_expected_type_passed_in() { + final Matcher matcher = new SubMatcher<>(new NotBuiltIn()); + + assertMatches("not built in", matcher, new NotBuiltIn()); + assertDoesNotMatch("other not built in", (Matcher)matcher, new OtherNotBuiltIn()); + } + + @Test public void + but_cannot_detect_generic_type_in_subclassed_matcher_using_reflection() { + final Matcher matcher = new SubMatcher<>(); + + assertMatches("not built in", matcher, new NotBuiltIn()); + assertMatches("other not built in", (Matcher)matcher, new OtherNotBuiltIn()); + } + + private static final TypeSafeDiagnosingMatcher STRING_MATCHER = new TypeSafeDiagnosingMatcher() { + @Override + protected boolean matchesSafely(String item, Description mismatchDescription) { + mismatchDescription.appendText("mismatching"); + return false; + } + + @Override + public void describeTo(Description description) { } + }; + + public static class SubMatcher extends TypeSafeDiagnosingMatcher { + public SubMatcher() { + super(); + } + public SubMatcher(T expectedObject) { + super(expectedObject.getClass()); + } + @Override protected boolean matchesSafely(T item, Description mismatchDescription) { return true; } + @Override public void describeTo(Description description) { description.appendText("sub type"); } + } + + public static class NotBuiltIn { + public final String value = "not built in"; + @Override public String toString() { return "NotBuiltIn"; } + } + + public static class OtherNotBuiltIn { // empty + } + +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/TypeSafeMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java similarity index 53% rename from hamcrest-unit-test/src/main/java/org/hamcrest/TypeSafeMatcherTest.java rename to hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java index 7c4baaa5..5563fabc 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/TypeSafeMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java @@ -1,8 +1,12 @@ package org.hamcrest; -import junit.framework.TestCase; +import org.junit.Test; -public class TypeSafeMatcherTest extends TestCase { +import static org.hamcrest.AbstractMatcherTest.assertMismatchDescription; +import static org.junit.Assert.assertFalse; + +@SuppressWarnings("WeakerAccess") +public final class TypeSafeMatcherTest { private final Matcher matcher = new TypeSafeMatcherSubclass(); public static class TypeSafeMatcherSubclass extends TypeSafeMatcher { @@ -19,23 +23,19 @@ public void describeMismatchSafely(String item, Description mismatchDescription) @Override public void describeTo(Description description) { } - } - - public void testCanDetermineMatcherTypeFromProtectedMatchesSafelyMethod() { + + @Test public void + canDetermineMatcherTypeFromProtectedMatchesSafelyMethod() { assertFalse(matcher.matches(null)); assertFalse(matcher.matches(10)); } - - public void testDescribesMismatches() { - assertMismatchDescription("was null", null); - assertMismatchDescription("was a java.lang.Integer (<3>)", new Integer(3)); - assertMismatchDescription("The mismatch", "a string"); - } - private void assertMismatchDescription(String expectedDescription, Object actual) { - StringDescription description = new StringDescription(); - matcher.describeMismatch(actual, description); - assertEquals(expectedDescription, description.toString()); + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Test public void + describesMismatches() { + assertMismatchDescription("was null", matcher, null); + assertMismatchDescription("was a java.lang.Integer (<3>)", (Matcher)matcher, 3); + assertMismatchDescription("The mismatch", matcher, "a string"); } } diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java new file mode 100644 index 00000000..11813106 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java @@ -0,0 +1,48 @@ +package org.hamcrest.beans; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.beans.HasProperty.hasProperty; + +/** + * @author Iain McGinniss + * @author Nat Pryce + * @author Steve Freeman + * @author Tom Denley + * @since 1.1.0 + */ +public final class HasPropertyTest { + + private final HasPropertyWithValueTest.BeanWithoutInfo bean = new HasPropertyWithValueTest.BeanWithoutInfo("a bean", false); + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = hasProperty("irrelevant"); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesWhenThePropertyExists() { + assertMatches(hasProperty("writeOnlyProperty"), bean); + } + + @Test public void + doesNotMatchIfPropertyDoesNotExist() { + assertDoesNotMatch(hasProperty("aNonExistentProp"), bean); + } + + @Test public void + describesItself() { + assertDescription("hasProperty(\"property\")", hasProperty("property")); + } + + @Test public void + describesAMismatch() { + assertMismatchDescription("no \"aNonExistentProp\" in <[Person: a bean]>", + hasProperty("aNonExistentProp"), bean); + } +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/beans/HasPropertyWithValueTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java similarity index 51% rename from hamcrest-unit-test/src/main/java/org/hamcrest/beans/HasPropertyWithValueTest.java rename to hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java index ad277153..d5f427e6 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/beans/HasPropertyWithValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java @@ -1,21 +1,18 @@ -/* Copyright (c) 2000-20010 hamcrest.org - */ package org.hamcrest.beans; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.beans.HasPropertyWithValue.hasProperty; -import static org.hamcrest.core.IsAnything.anything; -import static org.hamcrest.core.IsEqual.equalTo; +import org.hamcrest.*; +import org.hamcrest.core.IsEqual; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.beans.SimpleBeanInfo; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Description; -import org.hamcrest.Matcher; -import org.hamcrest.StringDescription; -import org.hamcrest.core.IsEqual; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.beans.HasPropertyWithValue.hasProperty; +import static org.hamcrest.beans.HasPropertyWithValue.hasPropertyAtPath; +import static org.hamcrest.core.IsAnything.anything; +import static org.hamcrest.core.IsEqual.equalTo; /** * @author Iain McGinniss @@ -23,9 +20,10 @@ * @author Steve Freeman * @since 1.1.0 */ +@SuppressWarnings("UnusedDeclaration") public class HasPropertyWithValueTest extends AbstractMatcherTest { - private final BeanWithoutInfo shouldMatch = new BeanWithoutInfo("is expected"); - private final BeanWithoutInfo shouldNotMatch = new BeanWithoutInfo("not expected"); + private final BeanWithoutInfo shouldMatch = new BeanWithoutInfo("is expected", true); + private final BeanWithoutInfo shouldNotMatch = new BeanWithoutInfo("not expected", false); private final BeanWithInfo beanWithInfo = new BeanWithInfo("with info"); @@ -34,10 +32,18 @@ protected Matcher createMatcher() { return hasProperty("irrelevant", anything()); } - public void testMatchesInfolessBeanWithMatchedNamedProperty() { - assertMatches("with property", hasProperty("property", equalTo("is expected")), shouldMatch); - assertMismatchDescription("property 'property' was \"not expected\"", - hasProperty("property", equalTo("is expected")), shouldNotMatch); + public void testMatchesBeanWithoutInfoWithMatchedNamedProperty() { + final Matcher propertyMatcher = hasProperty("property", equalTo("is expected")); + + assertMatches("with property", propertyMatcher, shouldMatch); + assertMismatchDescription("property 'property' was \"not expected\"", propertyMatcher, shouldNotMatch); + } + + public void testMatchesBeanWithoutInfoWithMatchedNamedBooleanProperty() { + final Matcher booleanPropertyMatcher = hasProperty("booleanProperty", is(true)); + + assertMatches("with property", booleanPropertyMatcher, shouldMatch); + assertMismatchDescription("property 'booleanProperty' was ", booleanPropertyMatcher, shouldNotMatch); } public void testMatchesBeanWithInfoWithMatchedNamedProperty() { @@ -46,7 +52,7 @@ public void testMatchesBeanWithInfoWithMatchedNamedProperty() { hasProperty("property", equalTo("without info")), beanWithInfo); } - public void testDoesNotMatchInfolessBeanWithoutMatchedNamedProperty() { + public void testDoesNotMatchBeanWithoutInfoOrMatchedNamedProperty() { assertMismatchDescription("No property \"nonExistentProperty\"", hasProperty("nonExistentProperty", anything()), shouldNotMatch); } @@ -56,12 +62,21 @@ public void testDoesNotMatchWriteOnlyProperty() { hasProperty("writeOnlyProperty", anything()), shouldNotMatch); } + public void testMatchesPath() { + assertMatches("1-step path", hasPropertyAtPath("property", equalTo("is expected")), shouldMatch); + assertMatches("2-step path", hasPropertyAtPath("inner.property", equalTo("is expected")), new BeanWithInner(shouldMatch)); + assertMatches("3-step path", hasPropertyAtPath("inner.inner.property", equalTo("is expected")), new BeanWithInner(new BeanWithInner(shouldMatch))); + + assertMismatchDescription("inner.No property \"wrong\"", hasPropertyAtPath("inner.wrong.property", anything()), new BeanWithInner(new BeanWithInner(shouldMatch))); + assertMismatchDescription("inner.inner.property.was \"not expected\"", hasPropertyAtPath("inner.inner.property", equalTo("something")), new BeanWithInner(new BeanWithInner(shouldNotMatch))); + } + public void testDescribeTo() { assertDescription("hasProperty(\"property\", )", hasProperty("property", equalTo(true))); } public void testMatchesPropertyAndValue() { - assertMatches("property with value", hasProperty( "property", anything()), beanWithInfo); + assertMatches("property with value", hasProperty("property", anything()), beanWithInfo); } public void testDoesNotWriteMismatchIfPropertyMatches() { @@ -71,9 +86,17 @@ public void testDoesNotWriteMismatchIfPropertyMatches() { } public void testDescribesMissingPropertyMismatch() { - assertMismatchDescription("No property \"honk\"", hasProperty( "honk", anything()), shouldNotMatch); + assertMismatchDescription("No property \"honk\"", hasProperty("honk", anything()), shouldNotMatch); + } + + public void testExceptionsInBeanMethodsShouldBeReportedCorrectly() { + assertMismatchDescription( + "Calling 'public java.lang.String org.hamcrest.beans.HasPropertyWithValueTest$BeanWithBug.getBroken()': \"bean failed\"", + hasProperty("broken", anything()), + new BeanWithBug()); } + public void testCanAccessAnAnonymousInnerClass() { class X implements IX { @Override @@ -89,11 +112,14 @@ interface IX { int getTest(); } + @SuppressWarnings("WeakerAccess") public static class BeanWithoutInfo { private String property; + private final boolean booleanProperty; - public BeanWithoutInfo(String property) { + public BeanWithoutInfo(String property, boolean booleanProperty) { this.property = property; + this.booleanProperty = booleanProperty; } public String getProperty() { @@ -104,6 +130,8 @@ public void setProperty(String property) { this.property = property; } + public boolean isBooleanProperty() { return booleanProperty; } + public void setWriteOnlyProperty(@SuppressWarnings("unused") float property) { } @@ -113,16 +141,20 @@ public String toString() { } } + @SuppressWarnings("WeakerAccess") + public static class BeanWithInner { + private final Object inner; + + public BeanWithInner(Object inner) { this.inner = inner; } + public Object getInner() { return inner; } + } + + @SuppressWarnings("WeakerAccess") public static class BeanWithInfo { private final String propertyValue; - public BeanWithInfo(String propertyValue) { - this.propertyValue = propertyValue; - } - - public String property() { - return propertyValue; - } + public BeanWithInfo(String propertyValue) { this.propertyValue = propertyValue; } + public String property() { return propertyValue; } } public static class BeanWithInfoBeanInfo extends SimpleBeanInfo { @@ -133,8 +165,20 @@ public PropertyDescriptor[] getPropertyDescriptors() { new PropertyDescriptor("property", BeanWithInfo.class, "property", null) }; } catch (IntrospectionException e) { - throw new RuntimeException("Introspection exception: " + e.getMessage()); + throw new AssertionError("Introspection exception", e); } } } + + @SuppressWarnings("WeakerAccess") + public static class BeanWithBug { + public String getBroken() { + throw new BeanFailed(); + } + } + + @SuppressWarnings("WeakerAccess") + public static class BeanFailed extends RuntimeException { + public BeanFailed() { super("bean failed"); } + } } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/beans/SamePropertyValuesAsTest.java b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java similarity index 52% rename from hamcrest-unit-test/src/main/java/org/hamcrest/beans/SamePropertyValuesAsTest.java rename to hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java index 373c1a1d..caecb684 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/beans/SamePropertyValuesAsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java @@ -1,12 +1,11 @@ -/* Copyright (c) 2000-2008 hamcrest.org - */ package org.hamcrest.beans; -import static org.hamcrest.beans.SamePropertyValuesAs.samePropertyValuesAs; - import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; +import static org.hamcrest.beans.SamePropertyValuesAs.samePropertyValuesAs; + +@SuppressWarnings("WeakerAccess") public class SamePropertyValuesAsTest extends AbstractMatcherTest { private static final Value aValue = new Value("expected"); private static final ExampleBean expectedBean = new ExampleBean("same", 1, aValue); @@ -18,36 +17,65 @@ protected Matcher createMatcher() { return samePropertyValuesAs(expectedBean); } - public void testReportsMatchWhenAllPropertiesMatch() { + public void test_reports_match_when_all_properties_match() { assertMatches("matched properties", samePropertyValuesAs(expectedBean), actualBean); } - public void testReportsMismatchWhenActualTypeIsNotAssignableToExpectedType() { + public void test_reports_mismatch_when_actual_type_is_not_assignable_to_expected_type() { assertMismatchDescription("is incompatible type: ExampleBean", samePropertyValuesAs((Object)aValue), actualBean); } - public void testReportsMisatchOnFirstPropertyDifference() { - assertMismatchDescription("string was \"different\"", + public void test_reports_mismatch_on_first_property_difference() { + assertMismatchDescription("stringProperty was \"different\"", samePropertyValuesAs(expectedBean), new ExampleBean("different", 1, aValue)); - assertMismatchDescription("int was <2>", + assertMismatchDescription("intProperty was <2>", samePropertyValuesAs(expectedBean), new ExampleBean("same", 2, aValue)); - assertMismatchDescription("value was ", + assertMismatchDescription("valueProperty was ", samePropertyValuesAs(expectedBean), new ExampleBean("same", 1, new Value("other"))); } - public void testMatchesBeansWithInheritanceButNoExtraProperties() { + public void test_matches_beans_with_inheritance_but_no_extra_properties() { assertMatches("sub type with same properties", samePropertyValuesAs(expectedBean), new SubBeanWithNoExtraProperties("same", 1, aValue)); } - public void testRejectsSubTypeThatHasExtraProperties() { - assertMismatchDescription("has extra properties called [extra]", + public void test_rejects_subtype_that_has_extra_properties() { + assertMismatchDescription("has extra properties called [extraProperty]", samePropertyValuesAs(expectedBean), new SubBeanWithExtraProperty("same", 1, aValue)); } - + + public void test_ignores_extra_subtype_properties() { + final SubBeanWithExtraProperty withExtraProperty = new SubBeanWithExtraProperty("same", 1, aValue); + assertMatches("extra property", samePropertyValuesAs(expectedBean, "extraProperty"), withExtraProperty); + } + + public void test_ignores_different_properties() { + final ExampleBean differentBean = new ExampleBean("different", 1, aValue); + assertMatches("different property", samePropertyValuesAs(expectedBean, "stringProperty"), differentBean); + } + + public void test_accepts_missing_properties_to_ignore() { + assertMatches("ignored property", samePropertyValuesAs(expectedBean, "notAProperty"), actualBean); + } + + public void test_can_ignore_all_properties() { + final ExampleBean differentBean = new ExampleBean("different", 2, new Value("not expected")); + assertMatches( + "different property", + samePropertyValuesAs(expectedBean, "stringProperty", "intProperty", "valueProperty"), + differentBean); + } + + public void testDescribesItself() { - assertDescription("same property values as ExampleBean [int: <1>, string: \"same\", value: ]", samePropertyValuesAs(expectedBean)); + assertDescription( + "same property values as ExampleBean [intProperty: <1>, stringProperty: \"same\", valueProperty: ]", + samePropertyValuesAs(expectedBean)); + + assertDescription( + "same property values as ExampleBean [intProperty: <1>, stringProperty: \"same\", valueProperty: ] ignoring [\"ignored1\", \"ignored2\"]", + samePropertyValuesAs(expectedBean, "ignored1", "ignored2")); } public static class Value { @@ -62,6 +90,7 @@ public String toString() { } } + @SuppressWarnings("unused") public static class ExampleBean { private String stringProperty; private int intProperty; @@ -73,15 +102,17 @@ public ExampleBean(String stringProperty, int intProperty, Value valueProperty) this.valueProperty = valueProperty; } - public String getString() { + public String getStringProperty() { return stringProperty; } - public int getInt() { + public int getIntProperty() { return intProperty; } - public Value getValue() { + public Value getValueProperty() { return valueProperty; } + + @Override public String toString() { return "an ExampleBean"; } } public static class SubBeanWithNoExtraProperties extends ExampleBean { @@ -94,6 +125,7 @@ public static class SubBeanWithExtraProperty extends ExampleBean { public SubBeanWithExtraProperty(String stringProperty, int intProperty, Value valueProperty) { super(stringProperty, intProperty, valueProperty); } - public String getExtra() { return "extra"; } + @SuppressWarnings("unused") + public String getExtraProperty() { return "extra"; } } } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java new file mode 100644 index 00000000..572bf63d --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java @@ -0,0 +1,43 @@ +package org.hamcrest.collection; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.collection.ArrayMatching.arrayContainingInAnyOrder; +import static org.hamcrest.core.IsEqual.equalTo; + +public class ArrayMatchingInAnyOrderTest extends AbstractMatcherTest { + + @SuppressWarnings("unchecked") + @Override + protected Matcher createMatcher() { + return ArrayMatching.arrayContainingInAnyOrder(equalTo(1), equalTo(2)); + } + + @SuppressWarnings("unchecked") + public void testHasAReadableDescription() { + assertDescription("[<1>, <2>] in any order", ArrayMatching.arrayContainingInAnyOrder(equalTo(1), equalTo(2))); + assertDescription("[<1>, <2>] in any order", ArrayMatching.arrayContainingInAnyOrder(1, 2)); + } + + public void testMatchesItemsInAnyOrder() { + assertMatches("in order", ArrayMatching.arrayContainingInAnyOrder(1, 2, 3), new Integer[] {1, 2, 3}); + assertMatches("out of order", ArrayMatching.arrayContainingInAnyOrder(1, 2, 3), new Integer[] {3, 2, 1}); + assertMatches("single", ArrayMatching.arrayContainingInAnyOrder(1), new Integer[] {1}); + } + + @SuppressWarnings("unchecked") + public void testAppliesMatchersInAnyOrder() { + assertMatches("in order", ArrayMatching.arrayContainingInAnyOrder(equalTo(1), equalTo(2), equalTo(3)), new Integer[] {1, 2, 3}); + assertMatches("out of order", ArrayMatching.arrayContainingInAnyOrder(equalTo(1), equalTo(2), equalTo(3)), new Integer[] {3, 2, 1}); + assertMatches("single", ArrayMatching.arrayContainingInAnyOrder(equalTo(1)), new Integer[] {1}); + } + + public void testMismatchesItemsInAnyOrder() { + Matcher matcher = ArrayMatching.arrayContainingInAnyOrder(1, 2, 3); + assertMismatchDescription("was null", matcher, null); + assertMismatchDescription("no item matches: <1>, <2>, <3> in []", matcher, new Integer[] {}); + assertMismatchDescription("no item matches: <2>, <3> in [<1>]", matcher, new Integer[] {1}); + assertMismatchDescription("not matched: <4>", matcher, new Integer[] {4,3,2,1}); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java new file mode 100644 index 00000000..784817a0 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java @@ -0,0 +1,45 @@ +package org.hamcrest.collection; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.collection.ArrayMatching.arrayContaining; +import static org.hamcrest.core.IsEqual.equalTo; + +public class ArrayMatchingInOrderTest extends AbstractMatcherTest { + + @SuppressWarnings("unchecked") + @Override + protected Matcher createMatcher() { + return arrayContaining(equalTo(1), equalTo(2)); + } + + @SuppressWarnings("unchecked") + public void testHasAReadableDescription() { + assertDescription("[<1>, <2>]", arrayContaining(equalTo(1), equalTo(2))); + } + + public void testMatchesItemsInOrder() { + assertMatches("in order", arrayContaining(1, 2, 3), new Integer[] {1, 2, 3}); + assertMatches("single", arrayContaining(1), new Integer[] {1}); + } + + @SuppressWarnings("unchecked") + public void testAppliesMatchersInOrder() { + assertMatches("in order", arrayContaining(equalTo(1), equalTo(2), equalTo(3)), new Integer[] {1, 2, 3}); + assertMatches("single", arrayContaining(equalTo(1)), new Integer[] {1}); + } + + public void testMismatchesItemsInOrder() { + Matcher matcher = arrayContaining(1, 2, 3); + assertMismatchDescription("was null", matcher, null); + assertMismatchDescription("no item was <1>", matcher, new Integer[] {}); + assertMismatchDescription("no item was <2>", matcher, new Integer[] {1}); + assertMismatchDescription("item 0: was <4>", matcher, new Integer[] {4,3,2,1}); + assertMismatchDescription("item 2: was <4>", matcher, new Integer[] {1,2, 4}); + } + + public void testCanHandleNullValuesInAnArray() { + assertMatches("with nulls", arrayContaining(null, null), new Object[]{null, null}); + } +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingTest.java b/hamcrest/src/test/java/org/hamcrest/collection/HasItemInArrayTest.java similarity index 85% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/HasItemInArrayTest.java index dca448ec..c4d7e34a 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/HasItemInArrayTest.java @@ -2,9 +2,11 @@ import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; -import static org.hamcrest.collection.IsArrayContaining.hasItemInArray; -public class IsArrayContainingTest extends AbstractMatcherTest { +import static org.hamcrest.Matchers.lessThan; +import static org.hamcrest.collection.ArrayMatching.hasItemInArray; + +public class HasItemInArrayTest extends AbstractMatcherTest { @Override protected Matcher createMatcher() { @@ -21,6 +23,9 @@ public void testDoesNotMatchAnArrayThatDoesntContainAnElementMatchingTheGivenMat hasItemInArray("a"), new String[]{"b", "c"}); assertDoesNotMatch("should not matches empty array", hasItemInArray("a"), new String[0]); + assertMismatchDescription( + "mismatches were: [<3> was greater than <2>, <4> was greater than <2>, <5> was greater than <2>]", + hasItemInArray(lessThan(2)), new Integer[] {3, 4, 5}); } public void testDoesNotMatchNull() { @@ -29,7 +34,7 @@ public void testDoesNotMatchNull() { } public void testHasAReadableDescription() { - assertDescription("an array containing \"a\"", hasItemInArray("a")); + assertDescription("an array containing a value less than <2>", hasItemInArray(lessThan(2))); } // Remaining code no longer compiles, thanks to generics. I think that's a good thing, but diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java similarity index 90% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java index a29e99b2..01d9e3de 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java @@ -36,8 +36,8 @@ public void testAppliesMatchersInAnyOrder() { public void testMismatchesItemsInAnyOrder() { Matcher matcher = arrayContainingInAnyOrder(1, 2, 3); assertMismatchDescription("was null", matcher, null); - assertMismatchDescription("No item matches: <1>, <2>, <3> in []", matcher, new Integer[] {}); - assertMismatchDescription("No item matches: <2>, <3> in [<1>]", matcher, new Integer[] {1}); - assertMismatchDescription("Not matched: <4>", matcher, new Integer[] {4,3,2,1}); + assertMismatchDescription("no item matches: <1>, <2>, <3> in []", matcher, new Integer[] {}); + assertMismatchDescription("no item matches: <2>, <3> in [<1>]", matcher, new Integer[] {1}); + assertMismatchDescription("not matched: <4>", matcher, new Integer[] {4,3,2,1}); } } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java similarity index 89% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java index ac651b1f..b719dd14 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java @@ -33,8 +33,8 @@ public void testAppliesMatchersInOrder() { public void testMismatchesItemsInOrder() { Matcher matcher = arrayContaining(1, 2, 3); assertMismatchDescription("was null", matcher, null); - assertMismatchDescription("No item matched: <1>", matcher, new Integer[] {}); - assertMismatchDescription("No item matched: <2>", matcher, new Integer[] {1}); + assertMismatchDescription("no item was <1>", matcher, new Integer[] {}); + assertMismatchDescription("no item was <2>", matcher, new Integer[] {1}); assertMismatchDescription("item 0: was <4>", matcher, new Integer[] {4,3,2,1}); assertMismatchDescription("item 2: was <4>", matcher, new Integer[] {1,2, 4}); } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java similarity index 63% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java index a6b2ac28..4135d9f5 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java @@ -1,11 +1,13 @@ package org.hamcrest.collection; -import static org.hamcrest.collection.IsArray.array; -import static org.hamcrest.core.IsEqual.equalTo; - import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; import org.hamcrest.Matcher; +import static org.hamcrest.collection.IsArray.array; +import static org.hamcrest.core.IsEqual.equalTo; + @SuppressWarnings("unchecked") public class IsArrayTest extends AbstractMatcherTest { @@ -39,4 +41,19 @@ public void testDoesNotMatchNull() { public void testHasAReadableDescription() { assertDescription("[\"a\", \"b\"]", array(equalTo("a"), equalTo("b"))); } + + public void testHasAReadableMismatchDescriptionUsing() { + assertMismatchDescription("element <0> was \"c\"", array(equalTo("a"), equalTo("b")), new String[]{"c", "b"}); + } + + public void testHasAReadableMismatchDescriptionUsingCustomMatchers() { + final BaseMatcher m = new BaseMatcher() { + @Override public boolean matches(Object item) { return false; } + @Override public void describeTo(Description description) { description.appendText("c"); } + @Override public void describeMismatch(Object item, Description description) { + description.appendText("didn't match"); + } + }; + assertMismatchDescription("element <0> didn't match", array(m, equalTo("b")), new String[]{"c", "b"}); + } } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayWithSizeTest.java similarity index 100% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayWithSizeTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsArrayWithSizeTest.java index eee7a626..18f607ec 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayWithSizeTest.java @@ -1,12 +1,12 @@ package org.hamcrest.collection; +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + import static org.hamcrest.collection.IsArrayWithSize.arrayWithSize; import static org.hamcrest.collection.IsArrayWithSize.emptyArray; import static org.hamcrest.core.IsEqual.equalTo; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; - public class IsArrayWithSizeTest extends AbstractMatcherTest { @Override diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsCollectionWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java similarity index 99% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsCollectionWithSizeTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java index bcaa0e31..b04a0c5c 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsCollectionWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java @@ -1,18 +1,17 @@ package org.hamcrest.collection; -import static java.util.Arrays.asList; +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; import java.util.ArrayList; -import java.util.List; import java.util.Collection; +import java.util.List; +import static java.util.Arrays.asList; import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.core.IsEqual.equalTo; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; -import org.hamcrest.MatcherAssert; - public class IsCollectionWithSizeTest extends AbstractMatcherTest { @Override diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsEmptyCollectionTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java similarity index 99% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsEmptyCollectionTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java index 277805c3..ea875e8a 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsEmptyCollectionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java @@ -1,11 +1,11 @@ package org.hamcrest.collection; -import java.util.ArrayList; -import java.util.Collection; - import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; +import java.util.ArrayList; +import java.util.Collection; + import static java.util.Arrays.asList; import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.hamcrest.core.Is.is; @@ -42,4 +42,4 @@ private static Collection collectionOfValues() { private static Collection emptyCollection() { return new ArrayList(); } -} \ No newline at end of file +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsEmptyIterableTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java similarity index 100% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsEmptyIterableTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java index c0c21746..600b5760 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsEmptyIterableTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java @@ -1,11 +1,11 @@ package org.hamcrest.collection; -import java.util.ArrayList; -import java.util.Collection; - import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; +import java.util.ArrayList; +import java.util.Collection; + import static java.util.Arrays.asList; import static org.hamcrest.collection.IsEmptyIterable.emptyIterable; diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsInTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java similarity index 100% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsInTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java index 5860d6e1..e9fcbdcb 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsInTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java @@ -1,12 +1,12 @@ package org.hamcrest.collection; -import java.util.Arrays; -import java.util.Collection; - import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; import org.hamcrest.StringDescription; +import java.util.Arrays; +import java.util.Collection; + public class IsInTest extends AbstractMatcherTest { String[] elements = {"a", "b", "c"}; diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java similarity index 71% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java index bd83b836..091c3475 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java @@ -23,7 +23,7 @@ public void testMatchesSingleItemIterable() { } public void testDoesNotMatchEmpty() { - assertMismatchDescription("No item matches: <1>, <2> in []", containsInAnyOrder(1, 2), Collections.emptyList()); + assertMismatchDescription("no item matches: <1>, <2> in []", containsInAnyOrder(1, 2), Collections.emptyList()); } public void testMatchesIterableOutOfOrder() { @@ -35,26 +35,20 @@ public void testMatchesIterableInOrder() { } public void testDoesNotMatchIfOneOfMultipleElementsMismatches() { - assertMismatchDescription("Not matched: <4>", containsInAnyOrder(1, 2, 3), asList(1, 2, 4)); + assertMismatchDescription("not matched: <4>", containsInAnyOrder(1, 2, 3), asList(1, 2, 4)); } @SuppressWarnings("unchecked") public void testDoesNotMatchIfThereAreMoreElementsThanMatchers() { - Matcher> helpTheCompilerOut = containsInAnyOrder(value(1), value(3)); - assertMismatchDescription("Not matched: ", helpTheCompilerOut, asList(make(1), make(2), make(3))); + final Matcher> helpTheCompilerOut = containsInAnyOrder(value(1), value(3)); + assertMismatchDescription("not matched: ", helpTheCompilerOut, asList(make(1), make(2), make(3))); } public void testDoesNotMatchIfThereAreMoreMatchersThanElements() { - assertMismatchDescription("No item matches: <4> in [<1>, <2>, <3>]", containsInAnyOrder(1, 2, 3, 4), asList(1, 2, 3)); + assertMismatchDescription("no item matches: <4> in [<1>, <2>, <3>]", containsInAnyOrder(1, 2, 3, 4), asList(1, 2, 3)); } public void testHasAReadableDescription() { - assertDescription("iterable over [<1>, <2>] in any order", containsInAnyOrder(1, 2)); + assertDescription("iterable with items [<1>, <2>] in any order", containsInAnyOrder(1, 2)); } - - public void testDoesNotMatchIfSingleItemMismatches() throws Exception { - assertMismatchDescription("Not matched: ", containsInAnyOrder(value(4)), asList(make(3))); - } - - } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java similarity index 80% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java index 6c1fd5c9..e71abbfd 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java @@ -8,6 +8,7 @@ import java.util.List; import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.hamcrest.core.IsEqual.equalTo; @@ -22,7 +23,7 @@ protected Matcher createMatcher() { } public void testMatchingSingleItemIterable() throws Exception { - assertMatches("Single item iterable", contains(1), asList(1)); + assertMatches("Single item iterable", contains(1), singletonList(1)); } public void testMatchingMultipleItemIterable() throws Exception { @@ -30,16 +31,15 @@ public void testMatchingMultipleItemIterable() throws Exception { } public void testDoesNotMatchWithMoreElementsThanExpected() throws Exception { - assertMismatchDescription("Not matched: <4>", contains(1, 2, 3), asList(1, 2, 3, 4)); + assertMismatchDescription("not matched: <4>", contains(1, 2, 3), asList(1, 2, 3, 4)); } public void testDoesNotMatchWithFewerElementsThanExpected() throws Exception { - List valueList = asList(make(1), make(2)); - assertMismatchDescription("No item matched: value with <3>", contains123, valueList); + assertMismatchDescription("no item was value with <3>", contains123, asList(make(1), make(2))); } public void testDoesNotMatchIfSingleItemMismatches() throws Exception { - assertMismatchDescription("item 0: value was <3>", contains(value(4)), asList(make(3))); + assertMismatchDescription("item 0: value was <3>", contains(value(4)), singletonList(make(3))); } public void testDoesNotMatchIfOneOfMultipleItemsMismatch() throws Exception { @@ -47,12 +47,16 @@ public void testDoesNotMatchIfOneOfMultipleItemsMismatch() throws Exception { } public void testDoesNotMatchEmptyIterable() throws Exception { - assertMismatchDescription("No item matched: value with <4>", contains(value(4)), new ArrayList()); + assertMismatchDescription("no item was value with <4>", contains(value(4)), new ArrayList()); } public void testHasAReadableDescription() { assertDescription("iterable containing [<1>, <2>]", contains(1, 2)); } + + public void testCanHandleNullMatchers() { + assertMatches(contains(null, null), asList(null, null)); + } public static class WithValue { private final int value; diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java new file mode 100644 index 00000000..8192c8bf --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java @@ -0,0 +1,93 @@ +package org.hamcrest.collection; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.FeatureMatcher; +import org.hamcrest.Matcher; + +import java.util.ArrayList; +import java.util.List; + +import static java.util.Arrays.asList; +import static org.hamcrest.collection.IsIterableContainingInRelativeOrder.containsInRelativeOrder; +import static org.hamcrest.core.IsEqual.equalTo; + +@SuppressWarnings("unchecked") +public class IsIterableContainingInRelativeOrderTest extends AbstractMatcherTest { + // temporary hack until the Java type system works + private final Matcher> contains123 = containsInRelativeOrder(value(1), value(2), value(3)); + + @Override + protected Matcher createMatcher() { + return containsInRelativeOrder(1, 2); + } + + public void testMatchingSingleItemIterable() throws Exception { + assertMatches("Single item iterable", containsInRelativeOrder(1), asList(1)); + } + + public void testMatchingMultipleItemIterable() throws Exception { + assertMatches("Multiple item iterable", containsInRelativeOrder(1, 2, 3), asList(1, 2, 3)); + } + + public void testMatchesWithMoreElementsThanExpectedAtBeginning() throws Exception { + assertMatches("More elements at beginning", containsInRelativeOrder(2, 3, 4), asList(1, 2, 3, 4)); + } + + public void testMatchesWithMoreElementsThanExpectedAtEnd() throws Exception { + assertMatches("More elements at end", containsInRelativeOrder(1, 2, 3), asList(1, 2, 3, 4)); + } + + public void testMatchesWithMoreElementsThanExpectedInBetween() throws Exception { + assertMatches("More elements in between", containsInRelativeOrder(1, 3), asList(1, 2, 3)); + } + + public void testMatchesSubSection() throws Exception { + assertMatches("Sub section of iterable", containsInRelativeOrder(2, 3), asList(1, 2, 3, 4)); + } + + public void testMatchesWithSingleGapAndNotFirstOrLast() throws Exception { + assertMatches("Sub section with single gaps without a first or last match", containsInRelativeOrder(2, 4), asList(1, 2, 3, 4, 5)); + } + + public void testMatchingSubSectionWithManyGaps() throws Exception { + assertMatches("Sub section with many gaps iterable", containsInRelativeOrder(2, 4, 6), asList(1, 2, 3, 4, 5, 6, 7)); + } + + public void testDoesNotMatchWithFewerElementsThanExpected() throws Exception { + List valueList = asList(make(1), make(2)); + assertMismatchDescription("value with <3> was not found after ", contains123, valueList); + } + + public void testDoesNotMatchIfSingleItemNotFound() throws Exception { + assertMismatchDescription("value with <4> was not found", containsInRelativeOrder(value(4)), asList(make(3))); + } + + public void testDoesNotMatchIfOneOfMultipleItemsNotFound() throws Exception { + assertMismatchDescription("value with <3> was not found after ", contains123, asList(make(1), make(2), make(4))); + } + + public void testDoesNotMatchEmptyIterable() throws Exception { + assertMismatchDescription("value with <4> was not found", containsInRelativeOrder(value(4)), new ArrayList()); + } + + public void testHasAReadableDescription() { + assertDescription("iterable containing [<1>, <2>] in relative order", containsInRelativeOrder(1, 2)); + } + + public static class WithValue { + private final int value; + public WithValue(int value) { this.value = value; } + public int getValue() { return value; } + @Override public String toString() { return "WithValue " + value; } + } + + public static WithValue make(int value) { + return new WithValue(value); + } + + public static Matcher value(int value) { + return new FeatureMatcher(equalTo(value), "value with", "value") { + @Override protected Integer featureValueOf(WithValue actual) { return actual.getValue(); } + }; + } +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableWithSizeTest.java similarity index 99% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableWithSizeTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsIterableWithSizeTest.java index 6da871e8..8bf65d14 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsIterableWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableWithSizeTest.java @@ -1,11 +1,12 @@ package org.hamcrest.collection; -import static org.hamcrest.collection.IsIterableWithSize.iterableWithSize; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; import java.util.Arrays; import java.util.Collections; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; +import static org.hamcrest.collection.IsIterableWithSize.iterableWithSize; public class IsIterableWithSizeTest extends AbstractMatcherTest { diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingKeyTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java similarity index 97% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingKeyTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java index 9bd5d2bc..13f067c8 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingKeyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java @@ -51,7 +51,7 @@ public void testMatchesMapContainingKeyWithIntegerKeys() throws Exception { map.put(1, "A"); map.put(2, "B"); - assertThat(map, hasKey(Integer.valueOf(1))); + assertThat(map, hasKey(1)); } public void testMatchesMapContainingKeyWithNumberKeys() throws Exception { diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java similarity index 55% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java index 9c14983b..3eed3463 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java @@ -1,15 +1,16 @@ package org.hamcrest.collection; -import static org.hamcrest.collection.IsMapContaining.hasEntry; -import static org.hamcrest.core.IsAnything.anything; -import static org.hamcrest.core.IsEqual.equalTo; - import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; +import java.util.HashMap; import java.util.Map; import java.util.TreeMap; +import static org.hamcrest.collection.IsMapContaining.hasEntry; +import static org.hamcrest.core.IsAnything.anything; +import static org.hamcrest.core.IsEqual.equalTo; + public class IsMapContainingTest extends AbstractMatcherTest { @Override @@ -18,7 +19,7 @@ protected Matcher createMatcher() { } public void testMatchesMapContainingMatchingKeyAndValue() { - Map map = new TreeMap(); + Map map = new TreeMap<>(); map.put("a", 1); map.put("b", 2); @@ -27,17 +28,17 @@ public void testMatchesMapContainingMatchingKeyAndValue() { assertMismatchDescription("map was [, ]", hasEntry(equalTo("c"), equalTo(3)), map); } -// no longer compiles. SF -// public void testMatchesMapContainingMatchingKeyAndValueWithoutGenerics() { -// Map map = new HashMap(); -// map.put("a", 1); -// map.put("b", 2); -// -// assertMatches("matcherA", hasEntry(equalTo("a"), equalTo(1)), map); -// assertMatches("matcherB", hasEntry(equalTo("b"), equalTo(2)), map); -// assertDoesNotMatch("matcherC", hasEntry(equalTo("c"), equalTo(3)), map); -// } -// + @SuppressWarnings("unchecked") + public void testMatchesMapContainingMatchingKeyAndValueWithoutGenerics() { + Map map = new HashMap(); + map.put("a", 1); + map.put("b", 2); + + assertMatches("matcherA", hasEntry(equalTo("a"), equalTo(1)), map); + assertMatches("matcherB", hasEntry(equalTo("b"), equalTo(2)), map); + assertFalse("matcherC", hasEntry(equalTo("c"), equalTo(3)).matches(map)); // working around generics problem + } + public void testDoesNotMatchNull() { assertMismatchDescription("was null", hasEntry(anything(), anything()), null); } @@ -45,14 +46,4 @@ public void testDoesNotMatchNull() { public void testHasReadableDescription() { assertDescription("map containing [\"a\"-><2>]", hasEntry(equalTo("a"), (equalTo(2)))); } - - // Remaining code no longer compiles, thanks to generics. I think that's a good thing, but - // I still need to investigate how this behaves with code that doesn't use generics. - // I expect ClassCastExceptions will be thrown. - // -Joe. - -// public void testDoesNotMatchAnObjectThatIsNotAMap() { -// assertDoesNotMatch("should not matches a string", -// mapContaining(ANYTHING, ANYTHING), "not a map"); -// } } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingValueTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java similarity index 100% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsMapContainingValueTest.java rename to hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java new file mode 100644 index 00000000..c050924c --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java @@ -0,0 +1,82 @@ +package org.hamcrest.collection; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; + +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.collection.IsMapWithSize.aMapWithSize; +import static org.hamcrest.core.IsEqual.equalTo; + +public final class IsMapWithSizeTest extends AbstractMatcherTest { + + @Override + protected Matcher createMatcher() { + return aMapWithSize(7); + } + + public void testMatchesWhenSizeIsCorrect() { + assertMatches("correct size", aMapWithSize(equalTo(2)), mapWithKeys("a", "b")); + assertMismatchDescription("map size was <3>", aMapWithSize(equalTo(2)), mapWithKeys("a", "b", "c")); + } + + public void testMatchesMapWhenSizeIsCorrectUsingObjectElementType() { + Map map = mapWithKeys(new Object(), new Object()); + assertMatches("correct size", aMapWithSize(equalTo(2)), map); + assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + } + + public void testMatchesMapWhenSizeIsCorrectUsingStringElementType() { + Map map = mapWithKeys("a", "b"); + assertMatches("correct size", aMapWithSize(equalTo(2)), map); + assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + } + + public void testMatchesMapWhenSizeIsCorrectUsingWildcardElementType() { + Map map = mapWithKeys("a", "b"); + assertMatches("correct size", aMapWithSize(equalTo(2)), map); + assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + } + + public void testMatchesListWhenSizeIsCorrectUsingObjectElementType() { + Map map = mapWithKeys(new Object(), new Object()); + assertMatches("correct size", aMapWithSize(equalTo(2)), map); + assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + } + + public void testMatchesListWhenSizeIsCorrectUsingStringElementType() { + Map list = mapWithKeys("a", "b"); + assertMatches("correct size", aMapWithSize(equalTo(2)), list); + assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), list); + } + + public void testMatchesListWhenSizeIsCorrectUsingWildcardElementType() { + Map list = mapWithKeys("a", "b"); + assertMatches("correct size", aMapWithSize(equalTo(2)), list); + assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), list); + } + + public void testProvidesConvenientShortcutForHasSizeEqualTo() { + assertMatches("correct size", aMapWithSize(2), mapWithKeys(new Object(), new Object())); + assertMismatchDescription("map size was <3>", aMapWithSize(2), mapWithKeys(new Object(), new Object(), new Object())); + } + + public void testHasAReadableDescription() { + assertDescription("a map with size <3>", aMapWithSize(equalTo(3))); + } + + public void testCompilesWithATypedMap() { + Map arrayList = new HashMap(); + MatcherAssert.assertThat(arrayList, aMapWithSize(0)); + } + + private static Map mapWithKeys(K... keys) { + final Map result = new HashMap(); + for (K key : keys) { + result.put(key, null); + } + return result; + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java new file mode 100644 index 00000000..a5fdb4ac --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java @@ -0,0 +1,128 @@ +package org.hamcrest.comparator; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import java.math.BigDecimal; +import java.util.Comparator; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.comparator.ComparatorMatcherBuilder.comparedBy; +import static org.hamcrest.core.IsNot.not; + +public class ComparatorMatcherBuilderTest extends AbstractMatcherTest { + + private final ComparatorMatcherBuilder integerComparatorMatcherBuilder = ComparatorMatcherBuilder.usingNaturalOrdering(); + private final ComparatorMatcherBuilder doubleComparatorMatcherBuilder = ComparatorMatcherBuilder.usingNaturalOrdering(); + private final ComparatorMatcherBuilder stringComparatorMatcherBuilder = ComparatorMatcherBuilder.usingNaturalOrdering(); + private final ComparatorMatcherBuilder bigDecimalComparatorMatcherBuilder = ComparatorMatcherBuilder.usingNaturalOrdering(); + private final Comparator backwardsIntegerComparator = new Comparator() { + @Override + public int compare(Integer o1, Integer o2) { + return -o1.compareTo(o2); + } + + @Override + public String toString() { + return "backwards integer comparator"; + } + }; + + @Override + protected Matcher createMatcher() { + return integerComparatorMatcherBuilder.greaterThan(1); + } + + public void testDescription() { + assertDescription("a value greater than <1>", integerComparatorMatcherBuilder.greaterThan(1)); + assertDescription("a value equal to or greater than <1>", integerComparatorMatcherBuilder.greaterThanOrEqualTo(1)); + assertDescription("a value equal to <1>", integerComparatorMatcherBuilder.comparesEqualTo(1)); + assertDescription("a value less than or equal to <1>", integerComparatorMatcherBuilder.lessThanOrEqualTo(1)); + assertDescription("a value less than <1>", integerComparatorMatcherBuilder.lessThan(1)); + + assertDescription("a value greater than <1> when compared by ", comparedBy(backwardsIntegerComparator).greaterThan(1)); + assertDescription("a value equal to or greater than <1> when compared by ", comparedBy(backwardsIntegerComparator).greaterThanOrEqualTo(1)); + assertDescription("a value equal to <1> when compared by ", comparedBy(backwardsIntegerComparator).comparesEqualTo(1)); + assertDescription("a value less than or equal to <1> when compared by ", comparedBy(backwardsIntegerComparator).lessThanOrEqualTo(1)); + assertDescription("a value less than <1> when compared by ", comparedBy(backwardsIntegerComparator).lessThan(1)); + } + + public void testMismatchDescriptions() { + assertMismatchDescription("<0> was less than <1>", integerComparatorMatcherBuilder.greaterThan(1), 0); + assertMismatchDescription("<1> was equal to <1>", integerComparatorMatcherBuilder.greaterThan(1), 1); + assertMismatchDescription("<1> was greater than <0>", integerComparatorMatcherBuilder.lessThan(0), 1); + assertMismatchDescription("<2> was equal to <2>", integerComparatorMatcherBuilder.lessThan(2), 2); + + assertMismatchDescription("<1> was less than <0> when compared by ", comparedBy(backwardsIntegerComparator).greaterThan(0), 1); + assertMismatchDescription("<1> was equal to <1> when compared by ", comparedBy(backwardsIntegerComparator).greaterThan(1), 1); + assertMismatchDescription("<0> was greater than <1> when compared by ", comparedBy(backwardsIntegerComparator).lessThan(1), 0); + assertMismatchDescription("<2> was equal to <2> when compared by ", comparedBy(backwardsIntegerComparator).lessThan(2), 2); + } + + public void testComparesObjectsForGreaterThan() { + assertThat(2, integerComparatorMatcherBuilder.greaterThan(1)); + assertThat(0, not(integerComparatorMatcherBuilder.greaterThan(1))); + } + + public void testComparesObjectsForLessThan() { + assertThat(2, integerComparatorMatcherBuilder.lessThan(3)); + assertThat(0, integerComparatorMatcherBuilder.lessThan(1)); + } + + + public void testComparesObjectsForEquality() { + assertThat(3, integerComparatorMatcherBuilder.comparesEqualTo(3)); + assertThat("aa", stringComparatorMatcherBuilder.comparesEqualTo("aa")); + } + + public void testAllowsForInclusiveComparisons() { + assertThat("less", 1, integerComparatorMatcherBuilder.lessThanOrEqualTo(1)); + assertThat("greater", 1, integerComparatorMatcherBuilder.greaterThanOrEqualTo(1)); + } + + public void testSupportsDifferentTypesOfComparableObjects() { + assertThat(1.1, doubleComparatorMatcherBuilder.greaterThan(1.0)); + assertThat("cc", stringComparatorMatcherBuilder.greaterThan("bb")); + } + + public void testComparesBigDecimalsWithDifferentScalesCorrectlyForIssue20() { + assertThat(new BigDecimal("10.0"), bigDecimalComparatorMatcherBuilder.greaterThanOrEqualTo(new BigDecimal("10"))); + assertThat(new BigDecimal(10), bigDecimalComparatorMatcherBuilder.greaterThanOrEqualTo(new BigDecimal("10.0"))); + assertThat(new BigDecimal("2"), bigDecimalComparatorMatcherBuilder.comparesEqualTo(new BigDecimal("2.000"))); + } + + public void testComparesCustomTypesWhoseCompareToReturnsValuesGreaterThatOne() { + assertThat(new CustomInt(5), ComparatorMatcherBuilder.usingNaturalOrdering().lessThan(new CustomInt(10))); + } + + public void testComparesByCustomComparator() { + assertThat(5, comparedBy(backwardsIntegerComparator).lessThan(4)); + } + + public void testJavadocExamples() { + assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().comparesEqualTo(1)); + assertThat(2, ComparatorMatcherBuilder.usingNaturalOrdering().greaterThan(1)); + assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().greaterThanOrEqualTo(1)); + assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThan(2)); + assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThanOrEqualTo(1)); + assertThat(5, comparedBy(new Comparator() { + @Override + public int compare(Integer o1, Integer o2) { + return -o1.compareTo(o2); + } + }).lessThan(4)); + } + + private static final class CustomInt implements Comparable { + private final int value; + + public CustomInt(int value) { + this.value = value; + } + + @Override + public int compareTo(CustomInt other) { + return value - other.value; + } + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java new file mode 100644 index 00000000..2bc53d4c --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java @@ -0,0 +1,87 @@ +package org.hamcrest.comparator; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import java.math.BigDecimal; +import java.util.Comparator; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.IsNot.not; +import static org.hamcrest.number.OrderingComparison.*; + +public class ComparatorMatcherTest extends AbstractMatcherTest { + + @Override + protected Matcher createMatcher() { + return ComparatorMatcherBuilder.comparedBy(new Comparator() { + @Override + public int compare(Integer o1, Integer o2) { + return o1.compareTo(o2); + } + }).greaterThan(1); + } + + public void testDescription() { + assertDescription("a value greater than <1>", greaterThan(1)); + assertDescription("a value equal to or greater than <1>", greaterThanOrEqualTo(1)); + assertDescription("a value equal to <1>", comparesEqualTo(1)); + assertDescription("a value less than or equal to <1>", lessThanOrEqualTo(1)); + assertDescription("a value less than <1>", lessThan(1)); + } + + public void testMismatchDescriptions() { + assertMismatchDescription("<0> was less than <1>", greaterThan(1), 0); + assertMismatchDescription("<1> was equal to <1>", greaterThan(1), 1); + assertMismatchDescription("<1> was greater than <0>", lessThan(0), 1); + assertMismatchDescription("<2> was equal to <2>", lessThan(2), 2); + } + + public void testComparesObjectsForGreaterThan() { + assertThat(2, greaterThan(1)); + assertThat(0, not(greaterThan(1))); + } + + public void testComparesObjectsForLessThan() { + assertThat(2, lessThan(3)); + assertThat(0, lessThan(1)); + } + + + public void testComparesObjectsForEquality() { + assertThat(3, comparesEqualTo(3)); + assertThat("aa", comparesEqualTo("aa")); + } + + public void testAllowsForInclusiveComparisons() { + assertThat("less", 1, lessThanOrEqualTo(1)); + assertThat("greater", 1, greaterThanOrEqualTo(1)); + } + + public void testSupportsDifferentTypesOfComparableObjects() { + assertThat(1.1, greaterThan(1.0)); + assertThat("cc", greaterThan("bb")); + } + + public void testComparesBigDecimalsWithDifferentScalesCorrectlyForIssue20() { + assertThat(new BigDecimal("10.0"), greaterThanOrEqualTo(new BigDecimal("10"))); + assertThat(new BigDecimal(10), greaterThanOrEqualTo(new BigDecimal("10.0"))); + assertThat(new BigDecimal("2"), comparesEqualTo(new BigDecimal("2.000"))); + } + + public void testComparesCustomTypesWhoseCompareToReturnsValuesGreaterThatOne() { + assertThat(new CustomInt(5), lessThan(new CustomInt(10))); + } + + private static final class CustomInt implements Comparable { + private final int value; + + public CustomInt(int value) { + this.value = value; + } + + public int compareTo(CustomInt other) { + return value - other.value; + } + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java new file mode 100644 index 00000000..0387207c --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java @@ -0,0 +1,70 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.AllOf.allOf; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsNull.notNullValue; +import static org.hamcrest.core.StringContains.containsString; +import static org.hamcrest.core.StringEndsWith.endsWith; +import static org.hamcrest.core.StringStartsWith.startsWith; + +public final class AllOfTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = allOf(equalTo("irrelevant"), startsWith("irr")); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + evaluatesToTheTheLogicalConjunctionOfTwoOtherMatchers() { + Matcher matcher = allOf(startsWith("goo"), endsWith("ood")); + + assertMatches("didn't pass both sub-matchers", matcher, "good"); + assertDoesNotMatch("didn't fail first sub-matcher", matcher, "mood"); + assertDoesNotMatch("didn't fail second sub-matcher", matcher, "goon"); + assertDoesNotMatch("didn't fail both sub-matchers", matcher, "fred"); + } + + @Test public void + evaluatesToTheTheLogicalConjunctionOfManyOtherMatchers() { + Matcher matcher = allOf(startsWith("g"), startsWith("go"), endsWith("d"), startsWith("go"), startsWith("goo")); + + assertMatches("didn't pass all sub-matchers", matcher, "good"); + assertDoesNotMatch("didn't fail middle sub-matcher", matcher, "goon"); + } + + @Test public void + supportsMixedTypes() { + final Matcher matcher = allOf( + equalTo(new SampleBaseClass("bad")), + is(notNullValue()), + equalTo(new SampleBaseClass("good")), + equalTo(new SampleSubClass("ugly"))); + + assertDoesNotMatch("didn't fail last sub-matcher", matcher, new SampleSubClass("good")); + } + + @Test public void + hasAReadableDescription() { + assertDescription("(\"good\" and \"bad\" and \"ugly\")", + allOf(equalTo("good"), equalTo("bad"), equalTo("ugly"))); + } + + @Test public void + hasAMismatchDescriptionDescribingTheFirstFailingMatch() { + assertMismatchDescription("\"good\" was \"bad\"", allOf(equalTo("bad"), equalTo("good")), "bad"); + } + + @Test public void + varargs(){ + assertThat("the text!", new AllOf<>(startsWith("the"), containsString("text"), endsWith("!"))); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java new file mode 100644 index 00000000..e2d9a9ee --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java @@ -0,0 +1,62 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.AnyOf.anyOf; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.StringEndsWith.endsWith; +import static org.hamcrest.core.StringStartsWith.startsWith; + +public final class AnyOfTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = anyOf(equalTo("irrelevant"), startsWith("irr")); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + evaluatesToTheTheLogicalDisjunctionOfTwoOtherMatchers() { + Matcher matcher = anyOf(startsWith("goo"), endsWith("ood")); + + assertMatches("didn't pass both sub-matchers", matcher, "good"); + assertMatches("didn't pass second sub-matcher", matcher, "mood"); + assertMatches("didn't pass first sub-matcher", matcher, "goon"); + assertDoesNotMatch("didn't fail both sub-matchers", matcher, "flan"); + } + + @Test public void + evaluatesToTheTheLogicalDisjunctionOfManyOtherMatchers() { + Matcher matcher = anyOf(startsWith("g"), startsWith("go"), endsWith("d"), startsWith("go"), startsWith("goo")); + + assertMatches("didn't pass middle sub-matcher", matcher, "vlad"); + assertDoesNotMatch("didn't fail all sub-matchers", matcher, "flan"); + } + + @SuppressWarnings("unchecked") + @Test public void + supportsMixedTypes() { + final Matcher matcher = anyOf( + equalTo(new SampleBaseClass("bad")), + equalTo(new SampleBaseClass("good")), + equalTo(new SampleSubClass("ugly"))); + + assertMatches("didn't pass middle sub-matcher", matcher, new SampleSubClass("good")); + } + + @Test public void + hasAReadableDescription() { + assertDescription("(\"good\" or \"bad\" or \"ugly\")", + anyOf(equalTo("good"), equalTo("bad"), equalTo("ugly"))); + } + + @Test public void + varargs(){ + assertThat("the text!", new AnyOf<>(startsWith("the"), endsWith("."))); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java new file mode 100644 index 00000000..7a209b62 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java @@ -0,0 +1,68 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsNot.not; +import static org.hamcrest.core.IsNull.notNullValue; + +public final class CombinableTest { + private static final CombinableMatcher EITHER_3_OR_4 = CombinableMatcher.either(equalTo(3)).or(equalTo(4)); + private static final CombinableMatcher NOT_3_AND_NOT_4 = CombinableMatcher.both(not(equalTo(3))).and(not(equalTo(4))); + + @Test public void + copesWithNullsAndUnknownTypes() { + assertNullSafe(EITHER_3_OR_4); + assertNullSafe(NOT_3_AND_NOT_4); + assertUnknownTypeSafe(EITHER_3_OR_4); + assertUnknownTypeSafe(NOT_3_AND_NOT_4); + } + + @Test public void + bothAcceptsAndRejects() { + assertMatches("both didn't pass", NOT_3_AND_NOT_4, 2); + assertDoesNotMatch("both didn't fail", NOT_3_AND_NOT_4, 3); + } + + @Test public void + acceptsAndRejectsThreeAnds() { + CombinableMatcher tripleAnd = NOT_3_AND_NOT_4.and(equalTo(2)); + + assertMatches("tripleAnd didn't pass", tripleAnd, 2); + assertDoesNotMatch("tripleAnd didn't fail", tripleAnd, 3); + } + + @Test public void + bothDescribesItself() { + assertDescription("(not <3> and not <4>)", NOT_3_AND_NOT_4); + assertMismatchDescription("not <3> was <3>", NOT_3_AND_NOT_4, 3); + } + + @Test public void + eitherAcceptsAndRejects() { + assertMatches("either didn't pass", EITHER_3_OR_4, 3); + assertDoesNotMatch("either didn't fail", EITHER_3_OR_4, 6); + } + + @Test public void + acceptsAndRejectsThreeOrs() { + final CombinableMatcher tripleOr = EITHER_3_OR_4.or(equalTo(11)); + + assertMatches("tripleOr didn't pass", tripleOr, 11); + assertDoesNotMatch("tripleOr didn't fail", tripleOr, 9); + } + + @Test public void + eitherDescribesItself() { + assertDescription("(<3> or <4>)", EITHER_3_OR_4); + assertMismatchDescription("was <6>", EITHER_3_OR_4, 6); + } + + @Test public void + picksUpTypeFromLeftHandSideOfExpression() { + @SuppressWarnings("unused") + Matcher matcher = CombinableMatcher.both(equalTo("yellow")).and(notNullValue(String.class)); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java b/hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java new file mode 100644 index 00000000..5c76af90 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java @@ -0,0 +1,49 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.DescribedAs.describedAs; +import static org.hamcrest.core.IsAnything.anything; +import static org.hamcrest.core.IsEqual.equalTo; + +public final class DescribedAsTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = describedAs("irrelevant", anything()); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + overridesDescriptionOfOtherMatcherWithThatPassedToConstructor() { + Matcher matcher = describedAs("my description", anything()); + + assertDescription("my description", matcher); + } + + @Test public void + appendsValuesToDescription() { + Matcher matcher = describedAs("value 1 = %0, value 2 = %1", anything(), 33, 97); + + assertDescription("value 1 = <33>, value 2 = <97>", matcher); + } + + @Test public void + celegatesMatchingToAnotherMatcher() { + Matcher matcher = describedAs("irrelevant", equalTo("hi")); + + assertMatches(matcher, "hi"); + assertDoesNotMatch("matched", matcher, "oi"); + } + + @Test public void + delegatesMismatchDescriptionToAnotherMatcher() { + Matcher matcher = describedAs("irrelevant", equalTo(2)); + + assertMismatchDescription("was <1>", matcher, 1); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/EveryTest.java b/hamcrest/src/test/java/org/hamcrest/core/EveryTest.java new file mode 100644 index 00000000..ff9f1772 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/EveryTest.java @@ -0,0 +1,44 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import java.util.ArrayList; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.StringContains.containsString; + +public final class EveryTest { + + private final Matcher> matcher = Every.everyItem(containsString("a")); + + @Test public void + copesWithNullsAndUnknownTypes() { + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesOnlyWhenEveryItemMatches() { + assertMatches(matcher, asList("AaA", "BaB", "CaC")); + assertDoesNotMatch(matcher, asList("AaA", "BXB", "CaC")); + } + + @Test public void + matchesEmptyLists() { + assertMatches("didn't match empty list", matcher, new ArrayList()); + } + + @Test public void + describesItself() { + assertDescription("every item is a string containing \"a\"", matcher); + } + + @Test public void + describesAMismatch() { + assertMismatchDescription("an item was \"BXB\"", matcher, singletonList("BXB")); + } +} + diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsAnythingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsAnythingTest.java new file mode 100644 index 00000000..80a8444c --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsAnythingTest.java @@ -0,0 +1,44 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.assertDescription; +import static org.hamcrest.AbstractMatcherTest.assertMatches; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsAnything.anything; + +public final class IsAnythingTest { + + private final Matcher matcher = anything(); + + private static class CustomThing { + } + + @Test + public void + alwaysEvaluatesToTrue() { + assertMatches("didn't match null", matcher, null); + assertMatches("didn't match Object", matcher, new Object()); + assertMatches("didn't match custom object", matcher, new CustomThing()); + assertMatches("didn't match String", matcher, "hi"); + } + + @Test + public void compilesWithoutTypeWarnings() { + assertThat(new CustomThing(), is(anything())); + } + + @Test public void + hasUsefulDefaultDescription() { + assertDescription("ANYTHING", matcher); + } + + @Test public void + canOverrideDescription() { + String description = "description"; + assertDescription(description, anything(description)); + } + +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsCollectionContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java similarity index 93% rename from hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsCollectionContainingTest.java rename to hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java index f272c9f9..db76bb1d 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsCollectionContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java @@ -1,21 +1,19 @@ -package org.hamcrest.collection; +package org.hamcrest.core; -import static java.util.Arrays.asList; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsCollectionContaining.hasItem; -import static org.hamcrest.core.IsCollectionContaining.hasItems; -import static org.hamcrest.core.IsEqual.equalTo; +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Description; -import org.hamcrest.Matcher; -import org.hamcrest.TypeSafeDiagnosingMatcher; -import org.hamcrest.core.IsCollectionContaining; -import org.hamcrest.core.IsEqual; +import static java.util.Arrays.asList; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.IsCollectionContaining.hasItem; +import static org.hamcrest.core.IsCollectionContaining.hasItems; +import static org.hamcrest.core.IsEqual.equalTo; public class IsCollectionContainingTest extends AbstractMatcherTest { @Override @@ -32,11 +30,11 @@ public void testMatchesACollectionThatContainsAnElementMatchingTheGivenMatcher() public void testDoesNotMatchCollectionThatDoesntContainAnElementMatchingTheGivenMatcher() { final Matcher> matcher1 = hasItem(mismatchable("a")); - assertMismatchDescription("mismatched: b, mismatched: c", matcher1, asList("b", "c")); + assertMismatchDescription("mismatches were: [mismatched: b, mismatched: c]", matcher1, asList("b", "c")); final Matcher> matcher2 = hasItem(equalTo("a")); - assertMismatchDescription("", matcher2, new ArrayList()); + assertMismatchDescription("was empty", matcher2, new ArrayList()); } public void testDoesNotMatchNull() { diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java new file mode 100644 index 00000000..d3ff21c5 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java @@ -0,0 +1,157 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsEqual.equalToObject; + +public final class IsEqualTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = equalTo("irrelevant"); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + comparesObjectsUsingEqualsMethod() { + final Matcher matcher1 = equalTo("hi"); + assertMatches(matcher1, "hi"); + assertDoesNotMatch(matcher1, "bye"); + assertDoesNotMatch(matcher1, null); + + final Matcher matcher2 = equalTo(1); + assertMatches(matcher2, 1); + assertDoesNotMatch(matcher2, 2); + assertDoesNotMatch(matcher2, null); + } + + @Test public void + canCompareNullValues() { + final Matcher matcher = equalTo(null); + + assertMatches(matcher, null); + assertDoesNotMatch(matcher, 2); + assertDoesNotMatch(matcher, "hi"); + assertDoesNotMatch(matcher, new String[] {"a", "b"}); + } + + @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") + @Test public void + honoursIsEqualImplementationEvenWithNullValues() { + Object alwaysEqual = new Object() { + @Override + public boolean equals(Object obj) { + return true; + } + }; + Object neverEqual = new Object() { + @Override + public boolean equals(Object obj) { + return false; + } + }; + + Matcher matcher = equalTo(null); + + assertMatches(matcher, alwaysEqual); + assertDoesNotMatch(matcher, neverEqual); + } + + @Test public void + comparesTheElementsOfAnObjectArray() { + String[] s1 = {"a", "b"}; + String[] s2 = {"a", "b"}; + String[] s3 = {"c", "d"}; + String[] s4 = {"a", "b", "c", "d"}; + + final Matcher matcher = equalTo(s1); + assertMatches(matcher, s1); + assertMatches(matcher, s2); + assertDoesNotMatch(matcher, s3); + assertDoesNotMatch(matcher, s4); + assertDoesNotMatch(matcher, null); + } + + @Test public void + comparesTheElementsOfArraysWithNulls() { + String[] s1 = {"a", null, "b"}; + String[] s2 = {"a", null, "b"}; + String[] s3 = {"c", "d"}; + String[] s4 = {"a", "b", "c", "d"}; + + final Matcher matcher = equalTo(s1); + assertMatches(matcher, s1); + assertMatches(matcher, s2); + assertDoesNotMatch(matcher, s3); + assertDoesNotMatch(matcher, s4); + } + + @Test public void + comparesTheElementsOfAnArrayOfPrimitiveTypes() { + int[] i1 = new int[]{1, 2}; + int[] i2 = new int[]{1, 2}; + int[] i3 = new int[]{3, 4}; + int[] i4 = new int[]{1, 2, 3, 4}; + + final Matcher matcher = equalTo(i1); + assertMatches(matcher, i1); + assertMatches(matcher, i2); + assertDoesNotMatch(matcher, i3); + assertDoesNotMatch(matcher, i4); + assertDoesNotMatch(matcher, null); + } + + @Test public void + recursivelyTestsElementsOfArrays() { + int[][] i1 = new int[][]{{1, 2}, {3, 4}}; + int[][] i2 = new int[][]{{1, 2}, {3, 4}}; + int[][] i3 = new int[][]{{5, 6}, {7, 8}}; + int[][] i4 = new int[][]{{1, 2, 3, 4}, {3, 4}}; + + final Matcher matcher = equalTo(i1); + assertMatches(matcher, i1); + assertMatches(matcher, i2); + assertDoesNotMatch(matcher, i3); + assertDoesNotMatch(matcher, i4); + assertDoesNotMatch(matcher, null); + } + + @Test public void + hasUntypedVariant() { + Object original = 10; + + assertMatches(equalToObject(10), original); + assertDoesNotMatch(equalToObject(0), original); + assertDoesNotMatch(equalToObject("10"), original); + assertDoesNotMatch(equalToObject(10), "10"); + } + + @Test public void + includesTheResultOfCallingToStringOnItsArgumentInTheDescription() { + final String argumentDescription = "ARGUMENT DESCRIPTION"; + Object argument = new Object() { + @Override + public String toString() { + return argumentDescription; + } + }; + assertDescription("<" + argumentDescription + ">", equalTo(argument)); + } + + @Test public void + returnsAnObviousDescriptionIfCreatedWithANestedMatcherByMistake() { + Matcher innerMatcher = equalTo("NestedMatcher"); + assertDescription("<" + innerMatcher.toString() + ">", equalTo(innerMatcher)); + } + + @Test public void + returnsGoodDescriptionIfCreatedWithNullReference() { + assertDescription("null", equalTo(null)); + } +} + diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java new file mode 100644 index 00000000..8dd85af1 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java @@ -0,0 +1,69 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsInstanceOf.any; +import static org.hamcrest.core.IsInstanceOf.instanceOf; + +public final class IsInstanceOfTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = instanceOf(Number.class); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + evaluatesToTrueIfArgumentIsInstanceOfASpecificClass() { + final Matcher matcher = instanceOf(Number.class); + + assertMatches(matcher, 1); + assertMatches(matcher, 1.1); + assertDoesNotMatch(matcher, null); + assertDoesNotMatch(matcher, new Object()); + } + + @Test public void + hasAReadableDescription() { + assertDescription("an instance of java.lang.Number", instanceOf(Number.class)); + } + + @Test public void + describesActualClassInMismatchMessage() { + assertMismatchDescription("\"some text\" is a java.lang.String", instanceOf(Number.class), "some text"); + } + + @Test public void + matchesPrimitiveTypes() { + assertMatches(any(boolean.class), true); + assertMatches(any(byte.class), (byte)1); + assertMatches(any(char.class), 'x'); + assertMatches(any(double.class), 5.0); + assertMatches(any(float.class), 5.0f); + assertMatches(any(int.class), 2); + assertMatches(any(long.class), 4L); + assertMatches(any(short.class), (short)1); + } + + @Test public void + instanceOfRequiresACastToReturnTheCorrectTypeForUseInJMock() { + @SuppressWarnings("unused") + Integer anInteger = (Integer)with(instanceOf(Integer.class)); + } + + @Test public void + anyWillReturnTheCorrectTypeForUseInJMock() { + @SuppressWarnings("unused") + Integer anInteger = with(any(Integer.class)); + } + + + private static T with(@SuppressWarnings("unused") Matcher matcher) { + return null; + } +} + diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java new file mode 100644 index 00000000..02148b81 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java @@ -0,0 +1,107 @@ +package org.hamcrest.core; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +import static java.util.Arrays.asList; +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsIterableContaining.hasItem; +import static org.hamcrest.core.IsIterableContaining.hasItems; +import static org.hamcrest.core.IsEqual.equalTo; + +public final class IsIterableContainingTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = hasItem(equalTo("irrelevant")); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesACollectionThatContainsAnElementForTheGivenMatcher() { + final Matcher> itemMatcher = hasItem(equalTo("a")); + + assertMatches("list containing 'a'", itemMatcher, asList("a", "b", "c")); + } + + @Test public void + doesNotMatchCollectionWithoutAnElementForGivenMatcher() { + final Matcher> matcher = hasItem(mismatchable("a")); + + assertMismatchDescription("mismatches were: [mismatched: b, mismatched: c]", matcher, asList("b", "c")); + assertMismatchDescription("was empty", matcher, new ArrayList()); + } + + @Test public void + doesNotMatchNull() { + assertDoesNotMatch("doesn't match null", hasItem(equalTo("a")), null); + } + + @Test public void + hasAReadableDescription() { + assertDescription("a collection containing mismatchable: a", hasItem(mismatchable("a"))); + } + + @Test public void + canMatchItemWhenCollectionHoldsSuperclass() { // Issue 24 + final Set s = new HashSet<>(); + s.add(2); + + assertMatches(new IsIterableContaining<>(new IsEqual(2)), s); + assertMatches(IsIterableContaining.hasItem(2), s); + } + + @SuppressWarnings("unchecked") + @Test public void + matchesMultipleItemsInCollection() { + final Matcher> matcher1 = hasItems(equalTo("a"), equalTo("b"), equalTo("c")); + assertMatches("list containing all items", matcher1, asList("a", "b", "c")); + + final Matcher> matcher2 = hasItems("a", "b", "c"); + assertMatches("list containing all items (without matchers)", matcher2, asList("a", "b", "c")); + + final Matcher> matcher3 = hasItems(equalTo("a"), equalTo("b"), equalTo("c")); + assertMatches("list containing all items in any order", matcher3, asList("c", "b", "a")); + + final Matcher> matcher4 = hasItems(equalTo("a"), equalTo("b"), equalTo("c")); + assertMatches("list containing all items plus others", matcher4, asList("e", "c", "b", "a", "d")); + + final Matcher> matcher5 = hasItems(equalTo("a"), equalTo("b"), equalTo("c")); + assertDoesNotMatch("not match list unless it contains all items", matcher5, asList("e", "c", "b", "d")); // 'a' missing + } + + @Test public void + reportsMismatchWithAReadableDescriptionForMultipleItems() { + final Matcher> matcher = hasItems(3, 4); + + assertMismatchDescription("a collection containing <4> mismatches were: [was <1>, was <2>, was <3>]", + matcher, asList(1, 2, 3)); + } + + private static Matcher mismatchable(final String string) { + return new TypeSafeDiagnosingMatcher() { + @Override + protected boolean matchesSafely(String item, Description mismatchDescription) { + if (string.equals(item)) + return true; + + mismatchDescription.appendText("mismatched: " + item); + return false; + } + + @Override + public void describeTo(Description description) { + description.appendText("mismatchable: " + string); + } + }; + } +} + diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java new file mode 100644 index 00000000..79f46837 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java @@ -0,0 +1,42 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsInstanceOf.instanceOf; +import static org.hamcrest.core.IsNot.not; + +public final class IsNotTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = not("something"); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + evaluatesToTheTheLogicalNegationOfAnotherMatcher() { + final Matcher matcher = not(equalTo("A")); + + assertMatches(matcher, "B"); + assertDoesNotMatch(matcher, "A"); + } + + @Test public void + providesConvenientShortcutForNotEqualTo() { + final Matcher matcher = not("A"); + + assertMatches(matcher, "B"); + assertDoesNotMatch(matcher, "A"); + } + + @Test public void + usesDescriptionOfNegatedMatcherWithPrefix() { + assertDescription("not an instance of java.lang.String", not(instanceOf(String.class))); + assertDescription("not \"A\"", not("A")); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java new file mode 100644 index 00000000..74b046b5 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java @@ -0,0 +1,43 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsNull.notNullValue; +import static org.hamcrest.core.IsNull.nullValue; + + +public final class IsNullTest { + + private final Matcher nullMatcher = nullValue(); + private final Matcher notNullMatcher = notNullValue(); + + @Test public void + copesWithNullsAndUnknownTypes() { + assertNullSafe(nullMatcher); + assertUnknownTypeSafe(nullMatcher); + + assertNullSafe(notNullMatcher); + assertUnknownTypeSafe(notNullMatcher); + } + + @Test public void + evaluatesToTrueIfArgumentIsNull() { + assertMatches(nullMatcher, null); + assertDoesNotMatch(nullMatcher, new Object()); + + assertMatches(notNullMatcher, new Object()); + assertDoesNotMatch(notNullMatcher, null); + } + + @Test public void + supportsStaticTyping() { + requiresStringMatcher(nullValue(String.class)); + requiresStringMatcher(notNullValue(String.class)); + } + + private void requiresStringMatcher(@SuppressWarnings("unused") Matcher arg) { + // no-op + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java new file mode 100644 index 00000000..a4a20105 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java @@ -0,0 +1,48 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsSame.sameInstance; +import static org.hamcrest.core.IsSame.theInstance; + + +public final class IsSameTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = sameInstance("irrelevant"); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + evaluatesToTrueIfArgumentIsReferenceToASpecifiedObject() { + Object o1 = new Object(); + Matcher matcher = sameInstance(o1); + + assertMatches(matcher, o1); + assertDoesNotMatch(matcher, new Object()); + } + + @Test public void + alternativeFactoryMethodAlsoMatchesOnlyIfArgumentIsReferenceToASpecifiedObject() { + Object o1 = new Object(); + Matcher matcher = theInstance(o1); + + assertMatches(matcher, o1); + assertDoesNotMatch(matcher, new Object()); + } + + @Test public void + returnsReadableDescriptionFromToString() { + assertDescription("sameInstance(\"ARG\")", sameInstance("ARG")); + } + + @Test public void + returnsReadableDescriptionFromToStringWhenInitialisedWithNull() { + assertDescription("sameInstance(null)", sameInstance(null)); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsTest.java new file mode 100644 index 00000000..d5220bde --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/IsTest.java @@ -0,0 +1,51 @@ +package org.hamcrest.core; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.Is.isA; +import static org.hamcrest.core.IsEqual.equalTo; + +public final class IsTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = is("something"); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesTheSameWayTheUnderlyingMatcherDoes() { + final Matcher matcher = is(equalTo(true)); + + assertMatches(matcher, true); + assertDoesNotMatch(matcher, false); + } + + @Test public void + generatesIsPrefixInDescription() { + assertDescription("is ", is(equalTo(true))); + assertDescription("is \"A\"", is("A")); + } + + @Test public void + providesConvenientShortcutForIsEqualTo() { + final Matcher matcher = is("A"); + + assertMatches(matcher, "A"); + assertDoesNotMatch(is("A"), "B"); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Test public void + providesConvenientShortcutForIsInstanceOf() { + final Matcher matcher = isA(Number.class); + assertMatches(matcher, 1); + assertDoesNotMatch(matcher, new Object()); + assertDoesNotMatch(matcher, null); + } +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/SampleBaseClass.java b/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java similarity index 100% rename from hamcrest-unit-test/src/main/java/org/hamcrest/core/SampleBaseClass.java rename to hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/core/SampleSubClass.java b/hamcrest/src/test/java/org/hamcrest/core/SampleSubClass.java similarity index 100% rename from hamcrest-unit-test/src/main/java/org/hamcrest/core/SampleSubClass.java rename to hamcrest/src/test/java/org/hamcrest/core/SampleSubClass.java diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java new file mode 100644 index 00000000..1fc269ef --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java @@ -0,0 +1,45 @@ +package org.hamcrest.core; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.core.StringContains.containsString; +import static org.hamcrest.core.StringContains.containsStringIgnoringCase; + + +public class StringContainsTest extends AbstractMatcherTest { + static final String EXCERPT = "EXCERPT"; + final Matcher stringContains = containsString(EXCERPT); + + @Override + protected Matcher createMatcher() { + return stringContains; + } + + public void testMatchesSubstrings() { + assertMatches(stringContains, EXCERPT + "END"); + assertMatches(stringContains, "START" + EXCERPT); + assertMatches(stringContains, "START" + EXCERPT + "END"); + assertMatches(stringContains, EXCERPT); + assertDoesNotMatch(stringContains, EXCERPT.toLowerCase()); + assertMatches(stringContains, EXCERPT + EXCERPT); + assertDoesNotMatch(stringContains, "XC"); + + assertMismatchDescription("was \"Something else\"", stringContains, "Something else"); + assertDescription("a string containing \"EXCERPT\"", stringContains); + } + + public void testMatchesSubstringsIgnoringCase() { + final Matcher ignoringCase = containsStringIgnoringCase("ExCert"); + assertMatches(ignoringCase, "eXcERT" + "END"); + assertMatches(ignoringCase, "START" + "EXCert"); + assertMatches(ignoringCase, "START" + "excERT" + "END"); + assertMatches(ignoringCase, "eXCert" + "excErt"); + assertDoesNotMatch(ignoringCase, "xc"); + + assertMismatchDescription("was \"Something else\"", ignoringCase, "Something else"); + assertDescription("a string containing \"ExCert\" ignoring case", ignoringCase); + } + + +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java new file mode 100644 index 00000000..f482cbfa --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java @@ -0,0 +1,45 @@ +package org.hamcrest.core; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.core.StringEndsWith.endsWith; +import static org.hamcrest.core.StringEndsWith.endsWithIgnoringCase; + + +public class StringEndsWithTest extends AbstractMatcherTest { + static final String EXCERPT = "EXCERPT"; + final Matcher stringEndsWith = endsWith(EXCERPT); + + @Override + protected Matcher createMatcher() { + return stringEndsWith; + } + + public void testMatchesSubstringAtEnd() { + assertDoesNotMatch(stringEndsWith, EXCERPT + "END"); + assertMatches(stringEndsWith, "START" + EXCERPT); + assertMatches(stringEndsWith, EXCERPT); + assertDoesNotMatch(stringEndsWith, EXCERPT.toLowerCase()); + assertDoesNotMatch(stringEndsWith, "START" + EXCERPT + "END"); + assertMatches(stringEndsWith, EXCERPT + EXCERPT); + assertDoesNotMatch(stringEndsWith, "EXCER"); + + assertMismatchDescription("was \"Something else\"", stringEndsWith, "Something else"); + assertDescription("a string ending with \"EXCERPT\"", stringEndsWith); + } + + public void testMatchesSubstringAtEndIngoringCase() { + final Matcher ignoringCase = endsWithIgnoringCase("EXCERpt"); + assertDoesNotMatch(ignoringCase, "eXCErpt" + "END"); + assertMatches(ignoringCase, "START" + "EXceRpt"); + assertMatches(ignoringCase, "EXcerPT"); + assertDoesNotMatch(ignoringCase, "START" + "ExcERpt" + "END"); + assertMatches(ignoringCase, "exCERpt" + "EXCerPt"); + assertDoesNotMatch(ignoringCase, "ExcER"); + + assertMismatchDescription("was \"Something else\"", ignoringCase, "Something else"); + assertDescription("a string ending with \"EXCERpt\" ignoring case", ignoringCase); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java new file mode 100644 index 00000000..7c2e5cd0 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java @@ -0,0 +1,35 @@ +package org.hamcrest.core; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import static org.hamcrest.core.StringContains.containsString; +import static org.hamcrest.core.StringEndsWith.endsWith; +import static org.hamcrest.core.StringStartsWith.startsWith; + +/** + * @author Steve Freeman 2016 http://www.hamcrest.com + */ +public class StringMatchingTest { + @Rule public final ExpectedException thrown = ExpectedException.none(); + + @Test public void + startsWithFailsWithNullSubstring() { + thrown.expect(IllegalArgumentException.class); + startsWith(null); + } + + @Test public void + endWithFailsWithNullSubstring() { + thrown.expect(IllegalArgumentException.class); + endsWith(null); + } + + @Test public void + containsFailsWithNullSubstring() { + thrown.expect(IllegalArgumentException.class); + containsString(null); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java new file mode 100644 index 00000000..2b2991bf --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java @@ -0,0 +1,25 @@ +package org.hamcrest.core; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.core.StringRegularExpression.matchesRegex; + +/** + * @author Steve Freeman 2016 http://www.hamcrest.com + */ +public class StringRegularExpressionTest extends AbstractMatcherTest { + public final Matcher matcher = matchesRegex("^[0-9]+$"); + + @Override + protected Matcher createMatcher() { return matcher; } + + + public void testMatchingRegex() { + assertMatches(matcher, "12"); + assertDoesNotMatch(matcher, "abc"); + + assertDescription("a string matching the pattern <^[0-9]+$>", matcher); + assertMismatchDescription("the string was \"bcd\"", matcher, "bcd"); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java new file mode 100644 index 00000000..f093acb4 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java @@ -0,0 +1,46 @@ +package org.hamcrest.core; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.core.StringStartsWith.startsWith; +import static org.hamcrest.core.StringStartsWith.startsWithIgnoringCase; + + +public class StringStartsWithTest extends AbstractMatcherTest { + static final String EXCERPT = "EXCERPT"; + final Matcher stringStartsWith = startsWith(EXCERPT); + + @Override + protected Matcher createMatcher() { + return stringStartsWith; + } + + public void testMatchesStringAtStart() { + assertMatches(stringStartsWith, EXCERPT + "END"); + assertDoesNotMatch(stringStartsWith, "START" + EXCERPT); + assertDoesNotMatch(stringStartsWith, "START" + EXCERPT + "END"); + assertMatches(stringStartsWith, EXCERPT); + assertDoesNotMatch(stringStartsWith, EXCERPT.toLowerCase()); + assertMatches(stringStartsWith, EXCERPT + EXCERPT); + assertDoesNotMatch(stringStartsWith, "EXCER"); + + assertDescription("a string starting with \"EXCERPT\"", stringStartsWith); + assertMismatchDescription("was \"Something else\"", stringStartsWith, "Something else"); + } + + public void testMatchesStringAtStartIgnoringCase() { + final Matcher ignoreCase = startsWithIgnoringCase("EXCerPT"); + + assertMatches(ignoreCase, "exCerPT" + "END"); + assertDoesNotMatch(ignoreCase, "START" + "EXCerpt"); + assertDoesNotMatch(ignoreCase, "START" + "EXcerpT" + "END"); + assertMatches(ignoreCase, "excERPT"); + assertMatches(ignoreCase, "ExcerPT" + "EXCerpt"); + assertDoesNotMatch(ignoreCase, "ExcER"); + + assertDescription("a string starting with \"EXCerPT\" ignoring case", ignoreCase); + assertMismatchDescription("was \"Something else\"", ignoreCase, "Something else"); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java b/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java new file mode 100644 index 00000000..c94e147d --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java @@ -0,0 +1,91 @@ +package org.hamcrest.io; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import java.io.File; +import java.io.IOException; + +import static org.hamcrest.core.IsEqual.equalTo; + +@SuppressWarnings("ResultOfMethodCallIgnored") +public class FileMatchersTest extends AbstractMatcherTest { + + private File directory; + private File file; + + @Override + protected void setUp() throws IOException { + directory = File.createTempFile("myDir", ""); + assertTrue("deleting " + directory, directory.delete()); + assertTrue("mkdir " + directory, directory.mkdirs()); + + file = new File(directory, "myFile"); + file.createNewFile(); + } + + public void testAnExistingDirectory() { + assertMatches("matches existing directory", FileMatchers.anExistingDirectory(), directory); + assertDoesNotMatch("doesn't match existing file", FileMatchers.anExistingDirectory(), file); + assertDoesNotMatch("doesn't match missing file", FileMatchers.anExistingDirectory(), new File("foo")); + } + + public void testAnExistingFileOrDirectory() { + assertMatches("matches existing file", FileMatchers.anExistingFileOrDirectory(), file); + assertMatches("matches existing directory", FileMatchers.anExistingFileOrDirectory(), directory); + assertDoesNotMatch("doesn't match missing file", FileMatchers.anExistingFileOrDirectory(), new File("foo")); + } + + public void testAnExistingFile() { + assertMatches("matches existing file", FileMatchers.anExistingFile(), file); + assertDoesNotMatch("doesn't match existing directory", FileMatchers.anExistingFile(), directory); + assertDoesNotMatch("doesn't match missing file", FileMatchers.anExistingFile(), new File("foo")); + } + + public void testAReadableFile() { // Not all OSes will allow setting readability so have to be forgiving here. + file.setReadable(true); + assertMatches("matches readable file", FileMatchers.aReadableFile(), file); + + if (file.setReadable(false)) { + assertDoesNotMatch("doesn't match unreadable file", FileMatchers.aReadableFile(), file); + } + } + + public void testAWritableFile() { + assertMatches("matches writable file", FileMatchers.aWritableFile(), file); + + assertTrue("set writable off " + file, file.setWritable(false)); + assertDoesNotMatch("doesn't match unwritable file", FileMatchers.aWritableFile(), file); + } + + public void testAFileWithSizeLong() { + assertMatches("matches file size", FileMatchers.aFileWithSize(0L), file); + assertDoesNotMatch("doesn't match incorrect file size", FileMatchers.aFileWithSize(34L), file); + } + + public void testAFileWithSizeMatcherOfLong() { + assertMatches("matches file size", FileMatchers.aFileWithSize(equalTo(0L)), file); + assertDoesNotMatch("doesn't match incorrect file size", FileMatchers.aFileWithSize(equalTo(23L)), file); + } + + public void testAFileNamed() { + assertMatches("matches file name", FileMatchers.aFileNamed(equalTo(file.getName())), file); + assertDoesNotMatch("doesn't match incorrect file name", FileMatchers.aFileNamed(equalTo("foo")), file); + } + + public void testAFileWithCanonicalPath() throws Exception { + assertMatches("matches file canonical path", FileMatchers.aFileWithCanonicalPath(equalTo(file.getCanonicalPath())), file); + assertDoesNotMatch("doesn't match incorrect canonical path", FileMatchers.aFileWithCanonicalPath(equalTo("foo")), file); + } + + public void testAFileWithAbsolutePath() { + assertMatches("matches file absolute path", FileMatchers.aFileWithAbsolutePath(equalTo(file.getAbsolutePath())), file); + assertDoesNotMatch("doesn't match incorrect absolute path", FileMatchers.aFileWithAbsolutePath(equalTo("foo")), file); + } + + @Override + protected Matcher createMatcher() { + return FileMatchers.aFileWithSize(1L); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java b/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java new file mode 100644 index 00000000..c82e6f4e --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java @@ -0,0 +1,45 @@ +package org.hamcrest.number; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import java.math.BigDecimal; + +import static org.hamcrest.number.BigDecimalCloseTo.closeTo; + +public class BigDecimalCloseToTest extends AbstractMatcherTest { + private final Matcher matcher = closeTo(new BigDecimal("1.0"), new BigDecimal("0.5")); + + @Override + protected Matcher createMatcher() { + BigDecimal irrelevant = new BigDecimal("0.01"); + return closeTo(irrelevant, irrelevant); + } + + public void testEvaluatesToTrueIfArgumentIsEqualToABigDecimalWithinSomeError() { + assertTrue(matcher.matches(new BigDecimal("1.0"))); + assertTrue(matcher.matches(new BigDecimal("0.5"))); + assertTrue(matcher.matches(new BigDecimal("1.5"))); + + assertDoesNotMatch("too large", matcher, new BigDecimal("2.0")); + assertMismatchDescription("<2.0> differed by <0.5> more than delta <0.5>", matcher, new BigDecimal("2.0")); + assertDoesNotMatch("number too small", matcher, new BigDecimal("0.0")); + assertMismatchDescription("<0.0> differed by <0.5> more than delta <0.5>", matcher, new BigDecimal("0.0")); + } + + public void testEvaluatesToTrueIfArgumentHasDifferentScale() { + assertTrue(matcher.matches(new BigDecimal("1.000000"))); + assertTrue(matcher.matches(new BigDecimal("0.500000"))); + assertTrue(matcher.matches(new BigDecimal("1.500000"))); + + assertDoesNotMatch("too large", matcher, new BigDecimal("2.000000")); + assertMismatchDescription("<2.000000> differed by <0.5> more than delta <0.5>", matcher, new BigDecimal("2.000000")); + assertDoesNotMatch("number too small", matcher, new BigDecimal("0.000000")); + assertMismatchDescription("<0.000000> differed by <0.5> more than delta <0.5>", matcher, new BigDecimal("0.000000")); + } + + public void test_is_self_describing() { + assertDescription("a numeric value within <0.5> of <1.0>", matcher); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java b/hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java new file mode 100644 index 00000000..8b0e244b --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java @@ -0,0 +1,32 @@ +package org.hamcrest.number; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.number.IsCloseTo.closeTo; + +public class IsCloseToTest extends AbstractMatcherTest { + private final Matcher matcher = closeTo(1.0d, 0.5d); + + @Override + protected Matcher createMatcher() { + final double irrelevant = 0.1; + return closeTo(irrelevant, irrelevant); + } + + public void test_matchesIfArgumentIsEqualToADoubleValueWithinSomeError() { + assertMatches("1.0", matcher, 1.0); + assertMatches("0.5d", matcher, 0.5d); + assertMatches("1.5d", matcher, 1.5d); + + assertDoesNotMatch("too large", matcher, 2.0); + assertMismatchDescription("<3.0> differed by <1.5> more than delta <0.5>", matcher, 3.0d); + assertDoesNotMatch("number too small", matcher, 0.0); + assertMismatchDescription("<0.1> differed by <0.4> more than delta <0.5>", matcher, 0.1); + } + + public void test_is_self_describing() { + assertDescription("a numeric value within <0.5> of <1.0>", matcher); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java b/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java new file mode 100644 index 00000000..c9b39568 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java @@ -0,0 +1,43 @@ +package org.hamcrest.number; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.number.IsNaN.notANumber; + +public final class IsNanTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = notANumber(); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesNaN() { + assertMatches(notANumber(), Double.NaN); + } + + @Test public void + doesNotMatchDoubleValue() { + assertDoesNotMatch(notANumber(), 1.25); + } + + @Test public void + doesNotMatchInfinity() { + assertDoesNotMatch(notANumber(), Double.POSITIVE_INFINITY); + } + + @Test public void + describesItself() { + assertDescription("a double value of NaN", notANumber()); + } + + @Test public void + describesAMismatch() { + assertMismatchDescription("was <1.25>", notANumber(), 1.25); + } +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/number/OrderingComparisonTest.java b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java similarity index 98% rename from hamcrest-unit-test/src/main/java/org/hamcrest/number/OrderingComparisonTest.java rename to hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java index 385672dc..5953bd0b 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/number/OrderingComparisonTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java @@ -1,5 +1,3 @@ -/* Copyright (c) 2000-2009 hamcrest.org - */ package org.hamcrest.number; import org.hamcrest.AbstractMatcherTest; diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java new file mode 100644 index 00000000..44aa7619 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java @@ -0,0 +1,56 @@ +package org.hamcrest.object; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +@SuppressWarnings("WeakerAccess") +public class HasEqualsValuesTest extends AbstractMatcherTest { + private static final WithPublicFields WITH_PUBLIC_FIELDS = new WithPublicFields('x', 666, "a string"); + private static final HasEqualValues WITH_PUBLIC_FIELDS_MATCHER = new HasEqualValues<>(WITH_PUBLIC_FIELDS); + + @Override + protected Matcher createMatcher() { + return WITH_PUBLIC_FIELDS_MATCHER; + } + + public void test_describes_itself() { + assertDescription( + "WithPublicFields has values [i: <666>, s: \"a string\", c: \"x\"]", + WITH_PUBLIC_FIELDS_MATCHER); + } + + public void test_matches_equivalent_object() { + assertMatches(WITH_PUBLIC_FIELDS_MATCHER, new WithPublicFields('x', 666, "a string")); + } + + public void test_mismatches_on_first_field_inequality() { + assertMismatchDescription( + "'s' was \"different\"", + WITH_PUBLIC_FIELDS_MATCHER, new WithPublicFields('x', 666, "different")); + } + + public void test_mismatches_on_inherited_field() { + assertMismatchDescription( + "'c' was \"y\"", + WITH_PUBLIC_FIELDS_MATCHER, new WithPublicFields('y', 666, "a string")); + } + + public static class WithPublicFields extends Parent { + public final int i; + public final String s; + + public WithPublicFields(char c, int i, String s) { + super(c); + this.i = i; + this.s = s; + } + } + + public static class Parent { + public final char c; + + public Parent(char c) { + this.c = c; + } + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java new file mode 100644 index 00000000..122e19b5 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java @@ -0,0 +1,55 @@ +package org.hamcrest.object; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.object.HasToString.hasToString; + +public final class HasToStringTest { + private static final String TO_STRING_RESULT = "toString result"; + private static final Object TEST_OBJECT = new Object() { + @Override + public String toString() { + return TO_STRING_RESULT; + } + }; + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = hasToString(equalTo("irrelevant")); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesWhenUtilisingANestedMatcher() { + final Matcher matcher = hasToString(equalTo(TO_STRING_RESULT)); + + assertMatches(matcher, TEST_OBJECT); + assertDoesNotMatch(matcher, new Object()); + } + + @Test public void + matchesWhenUsingShortcutForHasToStringEqualTo() { + final Matcher matcher = hasToString(TO_STRING_RESULT); + + assertMatches(matcher, TEST_OBJECT); + assertDoesNotMatch(matcher, new Object()); + } + + @Test public void + describesItself() { + final Matcher matcher = hasToString(equalTo(TO_STRING_RESULT)); + assertDescription("with toString() \"toString result\"", matcher); + } + + @Test public void + describesAMismatch() { + final Matcher matcher = hasToString(equalTo(TO_STRING_RESULT)); + String expectedMismatchString = "toString() was \"Cheese\""; + assertMismatchDescription(expectedMismatchString, matcher, "Cheese"); + } +} diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/object/IsCompatibleTypeTest.java b/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java similarity index 72% rename from hamcrest-unit-test/src/main/java/org/hamcrest/object/IsCompatibleTypeTest.java rename to hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java index f3ba6c6b..62a3637c 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/object/IsCompatibleTypeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java @@ -2,23 +2,24 @@ import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; + import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.object.IsCompatibleType.typeCompatibleWith; public class IsCompatibleTypeTest extends AbstractMatcherTest { - public static class BaseClass { + static class BaseClass { } - public static class ExtendedClass extends BaseClass { + private static class ExtendedClass extends BaseClass { } - public interface BaseInterface { + interface BaseInterface { } - public interface ExtendedInterface extends BaseInterface { + interface ExtendedInterface extends BaseInterface { } - public static class ClassImplementingBaseInterface implements BaseInterface { + private static class ClassImplementingBaseInterface implements BaseInterface { } @Override @@ -46,11 +47,6 @@ public void testMatchesExtendedInterface() { assertThat(ExtendedInterface.class, typeCompatibleWith(BaseInterface.class)); } -// public void testDoesNotMatchIncompatibleTypes() { -// assertThat(BaseClass.class, not(compatibleType(ExtendedClass.class))); -// assertThat(Integer.class, not(compatibleType(String.class))); -// } - public void testHasReadableDescription() { assertDescription("type < java.lang.Runnable", typeCompatibleWith(Runnable.class)); } diff --git a/hamcrest-unit-test/src/main/java/org/hamcrest/object/IsEventFromTest.java b/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java similarity index 97% rename from hamcrest-unit-test/src/main/java/org/hamcrest/object/IsEventFromTest.java rename to hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java index 1e69da0f..b3c4a3a5 100644 --- a/hamcrest-unit-test/src/main/java/org/hamcrest/object/IsEventFromTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java @@ -1,14 +1,12 @@ -/* Copyright (c) 2000-2006 hamcrest.org - */ package org.hamcrest.object; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.object.IsEventFrom.eventFrom; +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; import java.util.EventObject; -import org.hamcrest.AbstractMatcherTest; -import org.hamcrest.Matcher; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.object.IsEventFrom.eventFrom; public class IsEventFromTest extends AbstractMatcherTest { diff --git a/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java b/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java new file mode 100644 index 00000000..3e2d9114 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java @@ -0,0 +1,59 @@ +package org.hamcrest.object; + +import org.hamcrest.Matcher; +import org.hamcrest.text.MatchesPattern; +import org.junit.Test; + +import java.util.regex.Pattern; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.junit.Assert.assertThat; + +public class MatchesPatternTest { + @Test + public void copesWithNullsAndUnknownTypes() { + Matcher matcher = new MatchesPattern(Pattern.compile(".")); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test + public void matchesExactString() { + assertThat("a", new MatchesPattern(Pattern.compile("a"))); + } + + @Test + public void doesNotMatchADifferentString() { + assertDoesNotMatch("A different string does not match", new MatchesPattern(Pattern.compile("a")), "b"); + } + + @Test + public void doesNotMatchSubstring() { + assertDoesNotMatch("A substring does not match", new MatchesPattern(Pattern.compile("a")), "ab"); + } + + @Test + public void hasAReadableDescription() { + Matcher m = new MatchesPattern(Pattern.compile("a[bc](d|e)")); + assertDescription("a string matching the pattern 'a[bc](d|e)'", m ); + } + + @Test + public void describesAMismatch() { + final Matcher matcher = new MatchesPattern(Pattern.compile("a")); + assertMismatchDescription("was \"Cheese\"", matcher, "Cheese"); + } + + @Test + public void factoryMethodAllowsCreationWithPattern() { + Matcher m = MatchesPattern.matchesPattern(Pattern.compile("a[bc](d|e)")); + assertDescription("a string matching the pattern 'a[bc](d|e)'", m ); + } + + @Test + public void factoryMethodAllowsCreationWithString() { + Matcher m = MatchesPattern.matchesPattern("a[bc](d|e)"); + assertDescription("a string matching the pattern 'a[bc](d|e)'", m ); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/text/CharSequenceLengthTest.java b/hamcrest/src/test/java/org/hamcrest/text/CharSequenceLengthTest.java new file mode 100644 index 00000000..76629465 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/text/CharSequenceLengthTest.java @@ -0,0 +1,38 @@ +package org.hamcrest.text; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.number.OrderingComparison.lessThan; +import static org.hamcrest.text.CharSequenceLength.hasLength; + +/** + * @author Marco Leichsenring + * @author Steve Freeman + */ +public class CharSequenceLengthTest extends AbstractMatcherTest { + + @Override + protected Matcher createMatcher() { + return hasLength(4); + } + + public void test_matchesExactLengthOf_CharSequence() { + final Matcher matcher = hasLength(4); + assertMatches(matcher, "aaaa"); + assertMatches(matcher, "a b "); + + assertMismatchDescription("length was <6>", matcher, "aaaaaa"); + } + + + public void test_matchesRelativeLengthOf_CharSequence() { + final Matcher matcher = hasLength(lessThan(4)); + assertMatches(matcher, "aaa"); + assertMatches(matcher, "a b"); + + assertMismatchDescription("length <4> was equal to <4>", matcher, "aaaa"); + assertMismatchDescription("length <5> was greater than <4>", matcher, "aaaaa"); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java new file mode 100644 index 00000000..c5f35f1c --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java @@ -0,0 +1,55 @@ +package org.hamcrest.text; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.text.IsBlankString.blankOrNullString; +import static org.hamcrest.text.IsBlankString.blankString; + +public final class IsBlankStringTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = blankString(); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesEmptyString() { + assertMatches(blankOrNullString(), ""); + assertMatches(blankString(), ""); + } + + @Test public void + matchesNullAppropriately() { + assertMatches(blankOrNullString(), null); + assertDoesNotMatch(blankString(), null); + } + + @Test public void + matchesBlankStringAppropriately() { + assertMatches(blankString(), " \t"); + assertMatches(blankOrNullString(), " \t"); + } + + @Test public void + doesNotMatchFilledString() { + assertDoesNotMatch(blankString(), "a"); + assertDoesNotMatch(blankOrNullString(), "a"); + } + + @Test public void + describesItself() { + assertDescription("a blank string", blankString()); + assertDescription("(null or a blank string)", blankOrNullString()); + } + + @Test public void + describesAMismatch() { + assertMismatchDescription("was \"a\"", blankString(), "a"); + assertMismatchDescription("was \"a\"", blankOrNullString(), "a"); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java new file mode 100644 index 00000000..62e30535 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java @@ -0,0 +1,55 @@ +package org.hamcrest.text; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.text.IsEmptyString.emptyOrNullString; +import static org.hamcrest.text.IsEmptyString.emptyString; + +public final class IsEmptyStringTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = emptyString(); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + matchesEmptyString() { + assertMatches(emptyOrNullString(), ""); + assertMatches(emptyString(), ""); + } + + @Test public void + matchesNullAppropriately() { + assertMatches(emptyOrNullString(), null); + assertDoesNotMatch(emptyString(), null); + } + + @Test public void + matchesBlankStringAppropriately() { + assertDoesNotMatch(emptyString(), " "); + assertDoesNotMatch(emptyOrNullString(), " "); + } + + @Test public void + doesNotMatchFilledString() { + assertDoesNotMatch(emptyString(), "a"); + assertDoesNotMatch(emptyOrNullString(), "a"); + } + + @Test public void + describesItself() { + assertDescription("an empty string", emptyString()); + assertDescription("(null or an empty string)", emptyOrNullString()); + } + + @Test public void + describesAMismatch() { + assertMismatchDescription("was \"a\"", emptyString(), "a"); + assertMismatchDescription("was \"a\"", emptyOrNullString(), "a"); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java new file mode 100644 index 00000000..2f09c136 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java @@ -0,0 +1,44 @@ +package org.hamcrest.text; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static org.hamcrest.text.IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace; + +public class IsEqualCompressingWhiteSpaceTest extends AbstractMatcherTest { + + private final Matcher matcher = equalToCompressingWhiteSpace(" Hello World how\n are we? "); + + @Override + protected Matcher createMatcher() { + return matcher; + } + + public void testPassesIfWordsAreSameButWhitespaceDiffers() { + assertMatches(matcher, "Hello World how are we?"); + assertMatches(matcher, " Hello World how are \n\n\twe?"); + } + + public void testFailsIfTextOtherThanWhitespaceDiffers() { + assertDoesNotMatch(matcher, "Hello PLANET how are we?"); + assertDoesNotMatch(matcher, "Hello World how are we"); + } + + public void testFailsIfWhitespaceIsAddedOrRemovedInMidWord() { + assertDoesNotMatch(matcher, "HelloWorld how are we?"); + assertDoesNotMatch(matcher, "Hello Wo rld how are we?"); + } + + public void test_has_a_readable_mismatch() { + assertMismatchDescription("was \"Hello World how are we \"", matcher, "Hello World how are we "); + } + + public void testFailsIfMatchingAgainstNull() { + assertDoesNotMatch(matcher, null); + } + + public void testHasAReadableDescription() { + assertDescription("a string equal to \" Hello World how\\n are we? \" compressing white space", + matcher); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java new file mode 100644 index 00000000..b2b73917 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java @@ -0,0 +1,62 @@ +package org.hamcrest.text; + +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase; + +public final class IsEqualIgnoringCaseTest { + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = equalToIgnoringCase("irrelevant"); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + ignoresCaseOfCharsInString() { + final Matcher matcher = equalToIgnoringCase("heLLo"); + + assertMatches(matcher, "HELLO"); + assertMatches(matcher, "hello"); + assertMatches(matcher, "HelLo"); + assertDoesNotMatch(matcher, "bye"); + } + + @Test public void + mismatchesIfAdditionalWhitespaceIsPresent() { + final Matcher matcher = equalToIgnoringCase("heLLo"); + + assertDoesNotMatch(matcher, "hello "); + assertDoesNotMatch(matcher, " hello"); + } + + @Test public void + mismatchesNull() { + final Matcher matcher = equalToIgnoringCase("heLLo"); + + assertDoesNotMatch(matcher, null); + } + + @Test(expected=IllegalArgumentException.class) public void + canOnlyBeConstructedAboutANonNullString() { + equalToIgnoringCase(null); + } + + + @Test public void + describesItself() { + final Matcher matcher = equalToIgnoringCase("heLLo"); + assertDescription("a string equal to \"heLLo\" ignoring case", matcher); + } + + @Test public void + describesAMismatch() { + final Matcher matcher = equalToIgnoringCase("heLLo"); + String expectedMismatchString = "was \"Cheese\""; + assertMismatchDescription(expectedMismatchString, matcher, "Cheese"); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java new file mode 100644 index 00000000..52390a82 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java @@ -0,0 +1,33 @@ +package org.hamcrest.text; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import static java.util.Arrays.asList; +import static org.hamcrest.text.StringContainsInOrder.stringContainsInOrder; + + +public class StringContainsInOrderTest extends AbstractMatcherTest { + final StringContainsInOrder matcher = new StringContainsInOrder(asList("a", "b", "c", "c")); + + @Override + protected Matcher createMatcher() { + return matcher; + } + + public void testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() { + assertMatches("substrings in order", matcher, "abcc"); + assertMatches("substrings separated", matcher, "1a2b3c4c5"); + + assertDoesNotMatch("can detect repeated strings for matching", stringContainsInOrder("abc", "abc"), "---abc---"); + assertDoesNotMatch("substrings in order missing a repeated pattern", matcher, "abc"); + assertDoesNotMatch("substrings out of order", matcher, "cab"); + assertDoesNotMatch("no substrings in string", matcher, "xyz"); + assertDoesNotMatch("substring missing", matcher, "ac"); + assertDoesNotMatch("empty string", matcher, ""); + } + + public void testHasAReadableDescription() { + assertDescription("a string containing \"a\", \"b\", \"c\", \"c\" in order", matcher); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java new file mode 100644 index 00000000..a66689dc --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java @@ -0,0 +1,147 @@ +package org.hamcrest.xml; + +import org.hamcrest.Matcher; +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.ByteArrayInputStream; +import java.util.HashSet; +import java.util.Iterator; + +import static org.hamcrest.AbstractMatcherTest.*; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsNot.not; +import static org.hamcrest.core.StringContains.containsString; +import static org.hamcrest.xml.HasXPath.hasXPath; +import static org.junit.Assert.fail; + +/** + * @author Joe Walnes + * @author Tom Denley + */ +public final class HasXPathTest { + + private final Document xml = parse("" + + "\n" + + " Edam\n" + + " Cheddar\n" + + " Caravane\n" + + " \n" + + " " + + "\n" + ); + + private final NamespaceContext ns = new NamespaceContext() { + @Override + public String getNamespaceURI(String prefix) { + return ("cheese".equals(prefix) ? "http://cheese.com" : null); + } + + @Override + public String getPrefix(String namespaceURI) { + return ("http://cheese.com".equals(namespaceURI) ? "cheese" : null); + } + + @Override + public Iterator getPrefixes(String namespaceURI) { + HashSet prefixes = new HashSet(); + String prefix = getPrefix(namespaceURI); + if (prefix != null) { + prefixes.add(prefix); + } + return prefixes.iterator(); + } + }; + + @Test public void + copesWithNullsAndUnknownTypes() { + Matcher matcher = hasXPath("//irrelevant"); + + assertNullSafe(matcher); + assertUnknownTypeSafe(matcher); + } + + @Test public void + appliesMatcherToXPathInDocument() { + assertMatches(hasXPath("/root/something[2]/cheese", equalTo("Cheddar")), xml); + assertMatches(hasXPath("//something[1]/cheese", containsString("dam")), xml); + assertMatches(hasXPath("//something[2]/cheese", not(containsString("dam"))), xml); + assertMatches(hasXPath("/root/@type", equalTo("food")), xml); + assertMatches(hasXPath("//something[@id='b']/cheese", equalTo("Cheddar")), xml); + assertMatches(hasXPath("//something[@id='b']/cheese"), xml); + } + + @Test public void + matchesEmptyElement() { + assertMatches(hasXPath("//emptySomething"), xml); + } + + @Test public void + matchesEmptyElementInNamespace() { + assertMatches(hasXPath("//cheese:emptySomething", ns), xml); + } + + @Test public void + failsIfNodeIsMissing() { + assertDoesNotMatch(hasXPath("/root/something[3]/cheese", ns, equalTo("Cheddar")), xml); + assertDoesNotMatch(hasXPath("//something[@id='c']/cheese", ns), xml); + } + + @Test public void + failsIfNodeIsMissingInNamespace() { + assertDoesNotMatch(hasXPath("//cheese:foreignSomething", equalTo("Badger")), xml); + assertDoesNotMatch(hasXPath("//cheese:foreignSomething"), xml); + } + + @Test public void + matchesWithNamespace() { + assertMatches(hasXPath("//cheese:foreignSomething", ns), xml); + assertMatches(hasXPath("//cheese:foreignSomething/@milk", ns, equalTo("camel")), xml); + assertMatches(hasXPath("//cheese:foreignSomething/text()", ns, equalTo("Caravane")), xml); + } + + @Test public void + throwsIllegalArgumentExceptionIfGivenIllegalExpression() { + try { + hasXPath("\\g:dfgd::DSgf/root/something[2]/cheese", equalTo("blah")); + fail("Expected exception"); + } catch (IllegalArgumentException expectedException) { + // expected exception + } + } + + @Test public void + describesItself() { + assertDescription("an XML document with XPath /some/path \"Cheddar\"", + hasXPath("/some/path", equalTo("Cheddar"))); + + assertDescription("an XML document with XPath /some/path", + hasXPath("/some/path")); + } + + @Test public void + describesMissingNodeMismatch() { + assertMismatchDescription("xpath returned no results.", hasXPath("//honky"), xml); + } + + @Test public void + describesIncorrectNodeValueMismatch() { + assertMismatchDescription("was \"Edam\"", hasXPath("//something[1]/cheese", equalTo("parmesan")), xml); + } + + private static Document parse(String xml) { + try { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setNamespaceAware(true); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + return documentBuilder.parse(new ByteArrayInputStream(xml.getBytes())); + } + catch (Exception e) { + throw new IllegalStateException(e); + } + } +} diff --git a/lib/generator/jarjar-1.3.jar b/lib/generator/jarjar-1.3.jar deleted file mode 100644 index b1328f59..00000000 Binary files a/lib/generator/jarjar-1.3.jar and /dev/null differ diff --git a/lib/generator/qdox-1.12.jar b/lib/generator/qdox-1.12.jar deleted file mode 100644 index 3d850e5f..00000000 Binary files a/lib/generator/qdox-1.12.jar and /dev/null differ diff --git a/lib/integration/easymock-2.2.jar b/lib/integration/easymock-2.2.jar deleted file mode 100644 index c4159f5a..00000000 Binary files a/lib/integration/easymock-2.2.jar and /dev/null differ diff --git a/lib/integration/easymock-license.html b/lib/integration/easymock-license.html deleted file mode 100644 index 5c240cf5..00000000 --- a/lib/integration/easymock-license.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - EasyMock License - - - -
    - -

    -EasyMock 2 License (MIT License) -

    - -Copyright (c) 2001-2006 OFFIS, Tammo Freese. - -

    -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -

    -

    -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -

    -

    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -

    - -
    - - - - diff --git a/lib/integration/jmock-1.10RC1.jar b/lib/integration/jmock-1.10RC1.jar deleted file mode 100644 index e07c34ab..00000000 Binary files a/lib/integration/jmock-1.10RC1.jar and /dev/null differ diff --git a/lib/integration/jmock-license.txt b/lib/integration/jmock-license.txt deleted file mode 100644 index d75c363a..00000000 --- a/lib/integration/jmock-license.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2000-2003, jMock.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 jMock 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. diff --git a/lib/integration/junit-3.8.1.jar b/lib/integration/junit-3.8.1.jar deleted file mode 100644 index 674d71e8..00000000 Binary files a/lib/integration/junit-3.8.1.jar and /dev/null differ diff --git a/lib/integration/junit-dep-4.10.jar b/lib/integration/junit-dep-4.10.jar deleted file mode 100644 index 9b88183e..00000000 Binary files a/lib/integration/junit-dep-4.10.jar and /dev/null differ diff --git a/lib/integration/junit-license.html b/lib/integration/junit-license.html deleted file mode 100755 index 19009948..00000000 --- a/lib/integration/junit-license.html +++ /dev/null @@ -1,125 +0,0 @@ - - - -Common Public License - v 1.0 - - - - - - -

    Common Public License - v 1.0 -

    -

    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. -

    -

    1. DEFINITIONS -

    "Contribution" means: - -

      a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
      -b) in the case of each subsequent Contributor:
    - - -
      i) changes to the Program, and
    - - -
      ii) additions to the Program;
    - - -
      where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
    - -

    -

    "Contributor" means any person or entity that distributes the Program. -

    -

    "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. -

    -

    "Program" means the Contributions distributed in accordance with this Agreement. -

    -

    "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. -

    -

    2. GRANT OF RIGHTS - -

      a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
    - - -
    - - -
      b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
    - - -
    - - -
      c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
    - - -
    - - -
      d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
    - - -
    - -

    3. REQUIREMENTS -

    A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -

      a) it complies with the terms and conditions of this Agreement; and
    - - -
      b) its license agreement:
    - - -
      i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
    - - -
      ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
    - - -
      iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
    - - -
      iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
    - - -
    - -

    When the Program is made available in source code form: - -

      a) it must be made available under this Agreement; and
    - - -
      b) a copy of this Agreement must be included with each copy of the Program.
    - -

    -

    Contributors may not remove or alter any copyright notices contained within the Program. -

    -

    Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. -

    -

    4. COMMERCIAL DISTRIBUTION -

    Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. -

    -

    For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. -

    -

    5. NO WARRANTY -

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. -

    -

    6. DISCLAIMER OF LIABILITY -

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -

    -

    7. GENERAL -

    If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. -

    -

    If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. -

    -

    All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. -

    -

    Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. -

    -

    This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. -

    -

    - - - - \ No newline at end of file diff --git a/lib/integration/testng-6.5.2.jar b/lib/integration/testng-6.5.2.jar deleted file mode 100644 index b1a2655a..00000000 Binary files a/lib/integration/testng-6.5.2.jar and /dev/null differ diff --git a/lib/integration/testng-license.txt b/lib/integration/testng-license.txt deleted file mode 100755 index 29f81d81..00000000 --- a/lib/integration/testng-license.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/lib/sources/qdox-1.12-sources.jar b/lib/sources/qdox-1.12-sources.jar deleted file mode 100644 index 20af8f8e..00000000 Binary files a/lib/sources/qdox-1.12-sources.jar and /dev/null differ diff --git a/lib/sources/testng-6.5.2-sources.jar b/lib/sources/testng-6.5.2-sources.jar deleted file mode 100644 index ba5c801f..00000000 Binary files a/lib/sources/testng-6.5.2-sources.jar and /dev/null differ diff --git a/matchers.xml b/matchers.xml deleted file mode 100644 index 8fc69d31..00000000 --- a/matchers.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/overview.html b/overview.html deleted file mode 100644 index 2592e3a3..00000000 --- a/overview.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - -

    Hamcrest is a library of matchers, which can be combined in -to create flexible expressions of intent in tests.

    - -

    Documentation can be found at: http://hamcrest.org/.

    - diff --git a/pom/hamcrest-all.pom b/pom/hamcrest-all.pom deleted file mode 100644 index 536b8d58..00000000 --- a/pom/hamcrest-all.pom +++ /dev/null @@ -1,18 +0,0 @@ - - - 4.0.0 - - - org.hamcrest - hamcrest-parent - @VERSION@ - - - hamcrest-all - jar - Hamcrest All - - A self-contained hamcrest jar containing all of the sub-modules in a single artifact. - - diff --git a/pom/hamcrest-core.pom b/pom/hamcrest-core.pom deleted file mode 100644 index 23841def..00000000 --- a/pom/hamcrest-core.pom +++ /dev/null @@ -1,18 +0,0 @@ - - - 4.0.0 - - - org.hamcrest - hamcrest-parent - @VERSION@ - - - hamcrest-core - jar - Hamcrest Core - - This is the core API of hamcrest matcher framework to be used by third-party framework providers. This includes the a foundation set of matcher implementations for common operations. - - diff --git a/pom/hamcrest-generator.pom b/pom/hamcrest-generator.pom deleted file mode 100644 index 8525bfc7..00000000 --- a/pom/hamcrest-generator.pom +++ /dev/null @@ -1,17 +0,0 @@ - - - 4.0.0 - - - org.hamcrest - hamcrest-parent - @VERSION@ - - - hamcrest-generator - Hamcrest generator - - A tool to allow many Matcher implementations to be combined into a single class so users don't have to remember many classes/packages to import. Generates code. - - diff --git a/pom/hamcrest-integration.pom b/pom/hamcrest-integration.pom deleted file mode 100644 index b50f4087..00000000 --- a/pom/hamcrest-integration.pom +++ /dev/null @@ -1,40 +0,0 @@ - - - 4.0.0 - - - org.hamcrest - hamcrest-parent - @VERSION@ - - - hamcrest-integration - jar - Hamcrest Integration - - Provides integration between Hamcrest and other testing tools, including JUnit (3 and 4), TestNG, jMock and EasyMock. - - - - - org.hamcrest - hamcrest-library - @VERSION@ - - - - jmock - jmock - 1.1.0 - true - - - - org.easymock - easymock - 2.2 - true - - - diff --git a/pom/hamcrest-library.pom b/pom/hamcrest-library.pom deleted file mode 100644 index 4dd691f2..00000000 --- a/pom/hamcrest-library.pom +++ /dev/null @@ -1,26 +0,0 @@ - - - 4.0.0 - - - org.hamcrest - hamcrest-parent - @VERSION@ - - - hamcrest-library - jar - Hamcrest library - - Hamcrest library of matcher implementations. - - - - - org.hamcrest - hamcrest-core - @VERSION@ - - - \ No newline at end of file diff --git a/pom/hamcrest-parent.pom b/pom/hamcrest-parent.pom deleted file mode 100644 index 321aa436..00000000 --- a/pom/hamcrest-parent.pom +++ /dev/null @@ -1,72 +0,0 @@ - - - 4.0.0 - - org.hamcrest - hamcrest-parent - @VERSION@ - pom - - Hamcrest Maven Parent - https://github.com/hamcrest/JavaHamcrest - General parent POM for all hamcrest libraries. - - - - New BSD License - http://www.opensource.org/licenses/bsd-license.php - repo - - - - - https://github.com/hamcrest/JavaHamcrest - scm:git:git@github.com:hamcrest/JavaHamcrest.git - - - - - joe.walnes - Joe Walnes - - Developer - - - - nat.pryce - Nat Pryce - - Developer - - - - smgfreeman - Steve Freeman - - Developer - - - - neildunn - Neil Dunn - - Developer - - - - scarytom - Tom Denley - - Developer - - - - - - hamcrest-core - hamcrest-generator - hamcrest-library - hamcrest-integration - - diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..b2cd43d7 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,12 @@ +enableFeaturePreview('STABLE_PUBLISHING') + +include 'hamcrest', + 'hamcrest-core', + 'hamcrest-library', + 'hamcrest-integration' + +rootProject.name = 'JavaHamcrest' + +// Change the file name of the child project build file to match the directory name +// This avoids having multiple `build.gradle` files, making them easier to distinguish +rootProject.children.each { childProject -> childProject.buildFileName = "${childProject.name}.gradle" } diff --git a/snapshot-with-git.cm b/snapshot-with-git.cm deleted file mode 100755 index 729f8d55..00000000 --- a/snapshot-with-git.cm +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ant -Dversion="GIT-$(git log -1 --oneline | cut -d " " -f 1)" - diff --git a/upload_files.cm b/upload_files.cm deleted file mode 100755 index b9db802d..00000000 --- a/upload_files.cm +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -VERSION=${1:?no version}${2:?no release-candidate flag (can be an empty string)} -echo "Version: $VERSION" -CREDENTIALS="-u ${3:?no Google Code username} -w ${4:?mp Google Code password}" -echo "Credentials: ${CREDENTIALS}" - -LABELS="Type-Archive,OpSys-All,${1},${2}" - -# Hmmm. multiple labels don't seem to work properly. -./googlecode_upload.py -s "Full Hamcrest distribution (tgz)" -p hamcrest ${CREDENTIALS} -l "$LABELS" build/hamcrest-$VERSION.tgz -./googlecode_upload.py -s "Full Hamcrest distribution (zip)" -p hamcrest ${CREDENTIALS} -l "$LABELS" build/hamcrest-$VERSION.zip -./googlecode_upload.py -s "Hamcrest core Jar (bare-bones minimum)" -p hamcrest ${CREDENTIALS} -l "$LABELS" build/hamcrest-core-$VERSION.jar -./googlecode_upload.py -s "Hamcrest all-in-one Jar" -p hamcrest ${CREDENTIALS} -l "$LABELS" build/hamcrest-all-$VERSION.jar -./googlecode_upload.py -s "Hamcrest code generator tool" -p hamcrest ${CREDENTIALS} -l "$LABELS" build/hamcrest-generator-$VERSION.jar -./googlecode_upload.py -s "Hamcrest testing library integration" -p hamcrest ${CREDENTIALS} -l "$LABELS" build/hamcrest-integration-$VERSION.jar -./googlecode_upload.py -s "Hamcrest additional library of matchers" -p hamcrest ${CREDENTIALS} -l "$LABELS" build/hamcrest-library-$VERSION.jar -