diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83fbd7fa..bfb4bf83 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,17 +14,17 @@ jobs: strategy: fail-fast: true matrix: - java: [ 8 ] + java: [ 17 ] experimental: [false] include: - - java: 17 + - java: 21 experimental: true steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: ${{ matrix.java }} distribution: 'temurin' diff --git a/CHANGES.md b/CHANGES.md index 851be4dc..e2a14e5a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,27 +1,34 @@ # Hamcrest Changes -## Version 3.1 (Unreleased) +## Version 4.0 (Unreleased) ### Breaking Changes +* The baseline version of Java required for Hamcrest 4.0 has been moved to Java 17. Developers who use Java 8-16 can still depend upon hamcrest-3.0.jar. * As a result of the bugfix to allow matching against polymorphic collections ([PR #422](https://github.com/hamcrest/JavaHamcrest/pull/422)), the signature of the `hasItem` and `hasItems` methods has changed. Code relying on the exact signature of these methods will need to be updated. The following methods are affected: - * `org.hamcrest.CoreMatchers.hasItem` - * `org.hamcrest.CoreMatchers.hasItems` - * `org.hamcrest.Matchers.hasItem` - * `org.hamcrest.Matchers.hasItems` - * `org.hamcrest.core.IsCollectionContaining.hasItem` - * `org.hamcrest.core.IsCollectionContaining.hasItems` - * `org.hamcrest.core.IsIterableContaining.hasItem` - * `org.hamcrest.core.IsIterableContaining.hasItems` - * TODO: decide if these breaking changes should trigger a major version upgrade (i.e v4.0) + * `org.hamcrest.CoreMatchers.hasItem` + * `org.hamcrest.CoreMatchers.hasItems` + * `org.hamcrest.Matchers.hasItem` + * `org.hamcrest.Matchers.hasItems` + * `org.hamcrest.core.IsCollectionContaining.hasItem` + * `org.hamcrest.core.IsCollectionContaining.hasItems` + * `org.hamcrest.core.IsIterableContaining.hasItem` + * `org.hamcrest.core.IsIterableContaining.hasItems` ### New Features -* Optional matchers ([PR #421](https://github.com/hamcrest/JavaHamcrest/pull/421)) -* Matchers for thrown exceptions ([PR #423](https://github.com/hamcrest/JavaHamcrest/pull/423)) +* Optional matchers `emptyOptional()`, `optionalWithValue()` available in `org.hamcrest.Matchers` ([PR #421](https://github.com/hamcrest/JavaHamcrest/pull/421)) +* Matchers for thrown exceptions available through `throwsException()` in `org.hamcrest.Matchers` ([PR #423](https://github.com/hamcrest/JavaHamcrest/pull/423)) +* New `org.hamcrest.io.PathMatchers` class for matching `java.nio.files.Path` objects ([PR #442](https://github.com/hamcrest/JavaHamcrest/pull/442)) +* Create custom matchers more succinctly using `matcher()` static factory methods on `FeatureMatcher` and `TypeSafeDiagnosingMatcher` ([PR #441](https://github.com/hamcrest/JavaHamcrest/pull/441)) +* `org.hamcrest.beans` property matchers now support Java record naming conventions in addition to bean naming conventions ([PR #429](https://github.com/hamcrest/JavaHamcrest/pull/429)) +* `IsIterableContainingInAnyOrder.containsInAnyOrder()` matcher now supports custom `Comparator`s ([PR #404](https://github.com/hamcrest/JavaHamcrest/pull/404)) +* New `IsIterableContainingParallelRuns.containsParallelRunsOf()` matcher is a more general implementation of `containsInRelativeOrder()` ([PR #383](https://github.com/hamcrest/JavaHamcrest/pull/383)) +* New `IsUnmodifiable.isUnmodifiableCollection` matcher for testing if a collection is unmodifiable. ([PR #381](https://github.com/hamcrest/JavaHamcrest/pull/381))([PR #379](https://github.com/hamcrest/JavaHamcrest/pull/379)) +* New matchers for testing the content of files in `org.hamcrest.io.FileMatchers` and `org.hamcrest.io.PathMatchers` ([PR #345](https://github.com/hamcrest/JavaHamcrest/pull/345)) ### Improvements diff --git a/build.gradle b/build.gradle index 0a6791b6..4b2f5da0 100644 --- a/build.gradle +++ b/build.gradle @@ -19,13 +19,14 @@ tasks.register("showVersion") { subprojects { apply plugin: 'checkstyle' apply plugin: 'java-library' + apply plugin: "eclipse" group = rootProject.group version = rootProject.version java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } repositories { diff --git a/docs/javadoc/4.0/allclasses-index.html b/docs/javadoc/4.0/allclasses-index.html new file mode 100644 index 00000000..6ccc89ae --- /dev/null +++ b/docs/javadoc/4.0/allclasses-index.html @@ -0,0 +1,424 @@ + + + + +All Classes and Interfaces (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

All Classes and Interfaces

+
+
+
+
+
+
Class
+
Description
+ +
+
Calculates the logical conjunction of multiple matchers.
+
+ +
+
Calculates the logical disjunction of multiple matchers.
+
+ +
+
A matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers.
+
+ +
+
Collected helper code for converting matchers between lists and iterables.
+
+ +
+
A Description that is stored as a string.
+
+ +
+
BaseClass for all Matcher implementations.
+
+ +
+
A matcher that checks a BigDecimal is close to an expected value.
+
+ +
+
A Matcher that checks the length of a string.
+
+ +
+
Allows matchers of the same type to be combined using + either/or, or + both/and.
+
+ +
+
Allows syntactic sugar of using both and and.
+
+ +
+
Allows syntactic sugar of using either and or.
+
+ +
+
Builder for matchers that allow matchers to use a corresponding Compartor
+
+ +
+
A Condition implements part of a multi-step match.
+
+ +
+
Represents a single step in a multi-step sequence
+
+ +
+
Builder methods for various matchers.
+
+ +
+
Utility class for writing one off matchers.
+
+ +
+
Utility class for writing one off matchers (with type safety and null checks).
+
+ +
+
Provides a custom description to another matcher.
+
+ +
+
A description of a Matcher.
+
+ +
+
A description that consumes input but does nothing.
+
+ +
+
Convenient base class for Matchers of a specific type and that will report why the + received value has been rejected.
+
+ +
+
A matcher that applies a delegate matcher to every item in an Iterable.
+
+ +
+
Supporting class for matching a feature of an object.
+
+ +
+
Matchers for properties of files.
+
+ +
+
Checks the status of a File.
+
+ +
+
A matcher that checks if an object as equal fields values to an expected object.
+
+ +
+
Matches if an array contains an item satisfying a nested matcher.
+
+ +
+
A matcher that checks if an object has a JavaBean property with the + specified name.
+
+ +
+
A matcher that checks if an object has a JavaBean property with the + specified name and an expected value.
+
+ +
+
A Matcher that checks the output of the toString() method.
+
+ +
+
Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+
+ +
+
Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
+
+ +
+
A matcher that always returns true.
+
+ +
+
Matcher for array whose elements satisfy a sequence of matchers.
+
+ +
Deprecated. +
As of release 2.1, replaced by ArrayMatching.
+
+ +
Deprecated. +
As of release 2.1, replaced by ArrayMatching.
+
+ +
+
Matches if array size satisfies a size matcher.
+
+ +
+
Matches blank Strings (and null).
+
+ +
+
Is the value a number equal to a value within some range of acceptable error?
+
+ +
Deprecated. +
As of release 2.1, replaced by IsIterableContaining.
+
+ +
+
Matches if collection size satisfies a nested matcher.
+
+ +
+
A matcher of Class that matches when the specified baseType is assignable from the examined class.
+
+ +
+
Tests if a collection is empty.
+
+ +
+
Tests if an iterable is empty.
+
+ +
+
Matches empty Strings (and null).
+
+ +
+
Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) method.
+
+ +
+
Tests if a string is equal to another string, compressing any changes in whitespace.
+
+ +
+
Tests if a string is equal to another string, regardless of the case.
+
+ +
+
Tests if the value is an event announced by a specific object.
+
+ +
+
Tests if a collection contains a matching object.
+
+ +
+
Tests whether the value is an instance of a class.
+
+ +
+
Tests if an iterable contains matching elements.
+
+ +
+
Tests if an iterable contains matching elements in any order.
+
+ +
+
Tests if an iterable contains matching elements in order.
+
+ +
+
Tests if an iterable contains matching elements in relative order.
+
+ +
+
A matcher like that can check an iterable for parallel runs of a list of matchers.
+
+ +
+
Matches if iterable size satisfies a size matcher.
+
+ +
+
Matches if map keys, values or entries match the value matchers.
+
+ +
+
Matches if map size satisfies a nested matcher.
+
+ +
+
Is the value a number actually not a number (NaN)?
+
+ +
+
Calculates the logical negation of a matcher.
+
+ +
+
Is the value null?
+
+ +
+
Is the value the same object as another value?
+
+ +
+
This class contains static factory methods for creating Matchers that test if a collection is unmodifiable.
+
+ +
+
+ A matcher over acceptable values.
+
+ +
+
The Hamcrest entrypoint, static methods to check if matchers match a + given value.
+
+ +
+
Builder methods for various matchers.
+
+ +
+
Tests if a string matches a regular expression.
+
+ +
+
Matcher that expects an empty Optional.
+
+ +
+
Matcher for Optional that expects that value is present.
+
+ +
+
Static methods for building ordering comparisons.
+
+ +
+
Matchers for properties of files.
+
+ +
+
Utility class to help with finding properties in an object.
+
+ +
Deprecated. +
Replaced by PropertyAccessor
+
+ +
+
A matcher that checks if a given bean has the same property values + as an example bean.
+
+ +
+
The ability of an object to describe itself.
+
+ +
+
Tests if the argument is a string that contains a specific substring.
+
+ +
+
Tests if a string contains the given substrings in order.
+
+ +
+
A Description that is stored as a string.
+
+ +
+
Tests if the argument is a string that ends with a specific substring.
+
+ +
+
A matcher that checks a string against a regular expression.
+
+ +
+
Tests if the argument is a string that starts with a specific substring.
+
+ +
+
Common behaviour for matchers that check substrings.
+
+ +
+
Tests if a Runnable throws a matching exception.
+
+ +
+
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.
+
+ +
+
Convenient base class for Matchers that require a non-null value of a specific type.
+
+
+
+
+
+
+ + diff --git a/docs/javadoc/4.0/allpackages-index.html b/docs/javadoc/4.0/allpackages-index.html new file mode 100644 index 00000000..5c6adbab --- /dev/null +++ b/docs/javadoc/4.0/allpackages-index.html @@ -0,0 +1,112 @@ + + + + +All Packages (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

All Packages

+
+
Package Summary
+
+
Package
+
Description
+ +
+
Top level matcher classes and interfaces.
+
+ +
+
Matchers of Java Bean properties and their values.
+
+ +
+
Matchers of arrays and collections.
+
+ +
+
Helper classes for building matcher comparators.
+
+ +
+
Fundamental matchers of objects and values, and composite matchers.
+
+ +
+
Matchers of exceptions.
+
+ +
+
Matchers that perform file comparisons.
+
+ +
+
Matchers that perform numeric comparisons.
+
+ +
+
Matchers that inspect objects and classes.
+
+ +
+
Matchers that perform comparisons on Optional instances.
+
+ +
+
Matchers that perform text comparisons.
+
+ +
+
Matchers of XML documents.
+
+
+
+
+ + diff --git a/docs/javadoc/4.0/deprecated-list.html b/docs/javadoc/4.0/deprecated-list.html new file mode 100644 index 00000000..d73a29f9 --- /dev/null +++ b/docs/javadoc/4.0/deprecated-list.html @@ -0,0 +1,212 @@ + + + + +Deprecated List (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Deprecated API

+
+

Contents

+ + + + +
+
+ + diff --git a/docs/javadoc/4.0/element-list b/docs/javadoc/4.0/element-list new file mode 100644 index 00000000..f45fe309 --- /dev/null +++ b/docs/javadoc/4.0/element-list @@ -0,0 +1,12 @@ +org.hamcrest +org.hamcrest.beans +org.hamcrest.collection +org.hamcrest.comparator +org.hamcrest.core +org.hamcrest.exception +org.hamcrest.io +org.hamcrest.number +org.hamcrest.object +org.hamcrest.optional +org.hamcrest.text +org.hamcrest.xml diff --git a/docs/javadoc/4.0/help-doc.html b/docs/javadoc/4.0/help-doc.html new file mode 100644 index 00000000..b50f0c24 --- /dev/null +++ b/docs/javadoc/4.0/help-doc.html @@ -0,0 +1,188 @@ + + + + +API Help (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+

JavaDoc Help

+
+
+

Navigation

+Starting from the Overview page, you can browse the documentation using the links in each page, and in the navigation bar at the top of each page. The Index and Search box allow you to navigate to specific declarations and summary pages, including: All Packages, All Classes and Interfaces + +
+
+
+

Kinds of Pages

+The following sections describe the different kinds of pages in this collection. +
+

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. These pages may contain the following categories:

+
    +
  • Interfaces
  • +
  • Classes
  • +
  • Enum Classes
  • +
  • Exception Classes
  • +
  • Annotation Interfaces
  • +
+
+
+

Class or Interface

+

Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a declaration and description, member summary tables, and detailed member descriptions. Entries in each of these sections are omitted if they are empty or not applicable.

+
    +
  • Class Inheritance Diagram
  • +
  • Direct Subclasses
  • +
  • All Known Subinterfaces
  • +
  • All Known Implementing Classes
  • +
  • Class or Interface Declaration
  • +
  • Class or Interface Description
  • +
+
+
    +
  • Nested Class Summary
  • +
  • Enum Constant Summary
  • +
  • Field Summary
  • +
  • Property Summary
  • +
  • Constructor Summary
  • +
  • Method Summary
  • +
  • Required Element Summary
  • +
  • Optional Element Summary
  • +
+
+
    +
  • Enum Constant Details
  • +
  • Field Details
  • +
  • Property Details
  • +
  • Constructor Details
  • +
  • Method Details
  • +
  • Element Details
  • +
+

Note: Annotation interfaces have required and optional elements, but not methods. Only enum classes have enum constants. The components of a record class are displayed as part of the declaration of the record class. Properties are a feature of JavaFX.

+

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.

+
+
+

Other Files

+

Packages and modules may contain pages with additional information related to the declarations nearby.

+
+
+

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. Classes are organized by inheritance structure starting with java.lang.Object. 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 on 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 shortcomings, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

+
+
+

Serialized Form

+

Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to those who implement rather than use 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.

+
+
+

All Packages

+

The All Packages page contains an alphabetic index of all packages contained in the documentation.

+
+
+

All Classes and Interfaces

+

The All Classes and Interfaces page contains an alphabetic index of all classes and interfaces contained in the documentation, including annotation interfaces, enum classes, and record classes.

+
+
+

Index

+

The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields in the documentation, as well as summary pages such as All Packages, All Classes and Interfaces.

+
+
+
+This help file applies to API documentation generated by the standard doclet.
+
+ + diff --git a/docs/javadoc/4.0/index-all.html b/docs/javadoc/4.0/index-all.html new file mode 100644 index 00000000..1b2ee6f4 --- /dev/null +++ b/docs/javadoc/4.0/index-all.html @@ -0,0 +1,3304 @@ + + + + +Index (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Index

+
+A B C D E F G H I L M N O P R S T U _ 
All Classes and Interfaces|All Packages +

A

+
+
aFileNamed(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file name matches an expected name.
+
+
aFileWithAbsolutePath(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file absolute path matches an expected path.
+
+
aFileWithCanonicalPath(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file canonical path matches an expected path.
+
+
aFileWithContent(Matcher<String>) - Static method in class org.hamcrest.io.FileMatchers
+
+
Matcher for matching file content with given String Matcher
+
+
aFileWithSize(long) - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file has a specific size.
+
+
aFileWithSize(Matcher<Long>) - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file size matches an expected size.
+
+
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(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(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.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.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.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.
+
+
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
+
+
Constructor, best called from AllOf.allOf(Iterable).
+
+
AllOf(Matcher<? super T>...) - Constructor for class org.hamcrest.core.AllOf
+
+
Constructor, best called from AllOf.allOf(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(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.
+
+
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(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.
+
+
and(Condition.Step<? super T, U>) - Method in class org.hamcrest.Condition
+
+
Applies the mapping to the current value in the sequence
+
+
and(Matcher<? super T>) - Method in class org.hamcrest.core.CombinableMatcher
+
+
Specify the second matcher in a CombinableMatcher pair.
+
+
and(Matcher<? super X>) - Method in class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher
+
+
Specify the second matcher in a CombinableMatcher pair.
+
+
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
+
+
A matcher that checks if a directory exists.
+
+
anExistingDirectory() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a directory exists.
+
+
anExistingFile() - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file exists.
+
+
anExistingFile() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file exists.
+
+
anExistingFileOrDirectory() - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file or directory exists.
+
+
anExistingFileOrDirectory() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file or directory exists.
+
+
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 + 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 + examined object.
+
+
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(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(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.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.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.Matchers
+
+
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
anyOf(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<? 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<? 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<? 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<? 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 ANY of the specified matchers.
+
+
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
+
+
Constructor, best called from AnyOf.anyOf(Iterable).
+
+
AnyOf(Matcher<? super T>...) - Constructor for class org.hamcrest.core.AnyOf
+
+
Constructor, best called from AnyOf.anyOf(Matcher[]).
+
+
anything() - Static method in class org.hamcrest.core.IsAnything
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
anything() - Static method in class org.hamcrest.CoreMatchers
+
+
Creates a matcher that always matches, regardless of the examined object.
+
+
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.core.IsAnything
+
+
Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
+
+
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(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(char) - Method in class org.hamcrest.BaseDescription
+
+
Append the char c to the description.
+
+
append(char) - Method in class org.hamcrest.StringDescription
+
 
+
append(String) - Method in class org.hamcrest.BaseDescription
+
+
Append the String str to the description.
+
+
append(String) - 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, Iterable<T>) - Method in class org.hamcrest.BaseDescription
+
 
+
appendValueList(String, String, String, Iterable<T>) - Method in interface org.hamcrest.Description
+
+
Appends a list of values to the description.
+
+
appendValueList(String, String, String, Iterable<T>) - Method in class org.hamcrest.Description.NullDescription
+
 
+
appendValueList(String, String, String, 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, T...) - Method in class org.hamcrest.Description.NullDescription
+
 
+
apply(I, Description) - Method in interface org.hamcrest.Condition.Step
+
+
Apply this condition to a value
+
+
aReadableFile() - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a file is readable.
+
+
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
+
+
A matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers.
+
+
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(E...) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated. + +
+
+
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(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(List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated. +
As of version 2.1, use ArrayMatching.arrayContaining(List).
+
+
+
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(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(Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated. + +
+
+
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(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(E...) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated. + +
+
+
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(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(Collection<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated. + +
+
+
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(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(Matcher<? super 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.
+
+
ArrayMatching - Class in org.hamcrest.collection
+
+
Collected helper code for converting matchers between lists and iterables.
+
+
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(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.
+
+
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(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.
+
+
asEqualMatchers(E[]) - Static method in class org.hamcrest.collection.ArrayMatching
+
+
Converts item array to corresponding array of equalTo matchers
+
+
assertThat(String, boolean) - Static method in class org.hamcrest.MatcherAssert
+
+
Checks that an assertion is true
+
+
assertThat(String, T, Matcher<? super T>) - Static method in class org.hamcrest.MatcherAssert
+
+
Checks that a value matches a matcher
+
+
assertThat(T, Matcher<? super T>) - Static method in class org.hamcrest.MatcherAssert
+
+
Checks that a value matches a matcher
+
+
asString(SelfDescribing) - Static method in class org.hamcrest.StringDescription
+
+ +
+
aWritableFile() - Static method in class org.hamcrest.io.FileMatchers
+
+
A matcher that checks if a directory is writable.
+
+
+

B

+
+
BaseDescription - Class in org.hamcrest
+
+
A Description that is stored as a string.
+
+
BaseDescription() - Constructor for class org.hamcrest.BaseDescription
+
+
Default constructor
+
+
BaseMatcher<T> - Class in org.hamcrest
+
+
BaseClass for all Matcher implementations.
+
+
BaseMatcher() - Constructor for class org.hamcrest.BaseMatcher
+
+
Default constructor.
+
+
BigDecimalCloseTo - Class in org.hamcrest.number
+
+
A matcher that checks a BigDecimal is close to an expected value.
+
+
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
+
+
Checks if a File is readable.
+
+
CAN_WRITE - Static variable in class org.hamcrest.io.FileMatchers
+
+
Checks if a File is writable.
+
+
CharSequenceLength - Class in org.hamcrest.text
+
+
A Matcher that checks the length of a string.
+
+
CharSequenceLength(Matcher<? super Integer>) - Constructor for class org.hamcrest.text.CharSequenceLength
+
+
Constructor, best called from CharSequenceLength.hasLength(Matcher).
+
+
check(File) - Method in interface org.hamcrest.io.FileMatchers.FileStatus
+
+
Checks the give file against a status.
+
+
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(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.
+
+
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.
+
+
CombinableBothMatcher(Matcher<? super X>) - Constructor for class org.hamcrest.core.CombinableMatcher.CombinableBothMatcher
+
+
Constructor, best called from CombinableMatcher.both(Matcher).
+
+
CombinableEitherMatcher(Matcher<? super X>) - Constructor for class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher
+
+
Constructor, best called from CombinableMatcher.either(Matcher)
+
+
CombinableMatcher<T> - Class in org.hamcrest.core
+
+
Allows matchers of the same type to be combined using + either/or, or + both/and.
+
+
CombinableMatcher(Matcher<? super T>) - Constructor for class org.hamcrest.core.CombinableMatcher
+
+
Constructor, best called from either or both.
+
+
CombinableMatcher.CombinableBothMatcher<X> - Class in org.hamcrest.core
+
+
Allows syntactic sugar of using both and and.
+
+
CombinableMatcher.CombinableEitherMatcher<X> - Class in org.hamcrest.core
+
+
Allows syntactic sugar of using either and or.
+
+
ComparatorMatcherBuilder<T> - Class in org.hamcrest.comparator
+
+
Builder for matchers that allow matchers to use a corresponding Compartor
+
+
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
+
+
Represents a single step in a multi-step sequence
+
+
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(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(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(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.
+
+
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.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.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(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.
+
+
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(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(Comparator<T>, 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 according to + the comparator to one item anywhere in the specified items.
+
+
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(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.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(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.
+
+
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(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(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(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.
+
+
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(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.
+
+
containsParallelRunsOf(int, E...) - Static method in class org.hamcrest.collection.IsIterableContainingParallelRuns
+
+
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, with numRuns + occurrences of the specified series of items being matched (possibly interspersed).
+
+
containsParallelRunsOf(int, List<Matcher<? super E>>) - Static method in class org.hamcrest.collection.IsIterableContainingParallelRuns
+
 
+
containsParallelRunsOf(int, Matcher<? super E>...) - Static method in class org.hamcrest.collection.IsIterableContainingParallelRuns
+
 
+
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
+
+
Helper method to allow subclasses to handle case insensitivity.
+
+
CoreMatchers - Class in org.hamcrest
+
+
Builder methods for various matchers.
+
+
CoreMatchers() - Constructor for class org.hamcrest.CoreMatchers
+
+
Unused
+
+
CustomMatcher<T> - Class in org.hamcrest
+
+
Utility class for writing one off matchers.
+
+
CustomMatcher(String) - Constructor for class org.hamcrest.CustomMatcher
+
+
Constructor
+
+
CustomTypeSafeMatcher<T> - Class in org.hamcrest
+
+
Utility class for writing one off matchers (with type safety and null checks).
+
+
CustomTypeSafeMatcher(String) - Constructor for class org.hamcrest.CustomTypeSafeMatcher
+
+
Constructor
+
+
+

D

+
+
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.
+
+
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
+
+ +
+
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(E[], Description) - Method in class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
describeMismatchSafely(E[], Description) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated.
+
describeMismatchSafely(E[], Description) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated.
+
describeMismatchSafely(Class<?>, Description) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
describeMismatchSafely(Double, Description) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
describeMismatchSafely(Double, Description) - Method in class org.hamcrest.number.IsNaN
+
 
+
describeMismatchSafely(Iterable<? extends E>, Description) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
describeMismatchSafely(String, Description) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
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(BigDecimal, Description) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
describeMismatchSafely(Collection<? extends E>, Description) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
describeMismatchSafely(Map<? extends K, ? extends V>, Description) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
describeMismatchSafely(T[], Description) - Method in class org.hamcrest.collection.HasItemInArray
+
 
+
describeMismatchSafely(T[], Description) - Method in class org.hamcrest.collection.IsArray
+
 
+
describeMismatchSafely(T, Description) - Method in class org.hamcrest.beans.HasProperty
+
 
+
describeMismatchSafely(T, Description) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Describe the mismatch.
+
+
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.IsIterableContainingParallelRuns
+
 
+
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.exception.ThrowsException
+
 
+
describeTo(Description) - Method in class org.hamcrest.FeatureMatcher
+
 
+
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 class org.hamcrest.optional.OptionalEmpty
+
 
+
describeTo(Description) - Method in class org.hamcrest.optional.OptionalWithValue
+
 
+
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
+
 
+
describeTo(Description, String) - Method in class org.hamcrest.core.AnyOf
+
+
Describe this matcher to description
+
+
Description - Interface in org.hamcrest
+
+
A description of a Matcher.
+
+
Description.NullDescription - Class in org.hamcrest
+
+
A description that consumes input but does nothing.
+
+
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
+
+
Convenient base class for Matchers of a specific type and that will report why the + received value has been rejected.
+
+
DiagnosingMatcher() - Constructor for class org.hamcrest.DiagnosingMatcher
+
+
Constructor
+
+
+

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.
+
+
emptyOptional() - Static method in class org.hamcrest.Matchers
+
+
Matcher that expects empty Optional.
+
+
emptyOptional() - Static method in class org.hamcrest.optional.OptionalEmpty
+
+
Matcher that expects empty Optional.
+
+
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
+
+
Checks if the input matches the specific substring.
+
+
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(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.Matchers
+
+
Creates a matcher of EventObject that matches any EventObject + 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
+
+
A matcher that applies a delegate matcher to every item in an Iterable.
+
+
Every(Matcher<? super T>) - Constructor for class org.hamcrest.core.Every
+
+
Constructor, best called from Every.everyItem(Matcher).
+
+
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.
+
+
Example Usage - Search tag in class org.hamcrest.beans.HasPropertyWithValue
+
Section
+
EXISTS - Static variable in class org.hamcrest.io.FileMatchers
+
+
Checks if a File is a exists.
+
+
+

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(CharSequence) - Method in class org.hamcrest.text.CharSequenceLength
+
 
+
featureValueOf(Iterable<E>) - Method in class org.hamcrest.collection.IsIterableWithSize
+
 
+
featureValueOf(Collection<? extends E>) - Method in class org.hamcrest.collection.IsCollectionWithSize
+
 
+
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
+
 
+
fieldNames() - Method in class org.hamcrest.beans.PropertyAccessor
+
+
The names of properties that were found in the object.
+
+
fieldValue(String) - Method in class org.hamcrest.beans.PropertyAccessor
+
+
The value of the specified property.
+
+
FileMatchers - Class in org.hamcrest.io
+
+
Matchers for properties of files.
+
+
FileMatchers.FileStatus - Interface in org.hamcrest.io
+
+
Checks the status of a File.
+
+
+

G

+
+
getName() - Method in class org.hamcrest.beans.PropertyAccessor.PropertyReadLens
+
+
The name of the property
+
+
getPropertyDescriptor(String, Object) - Static method in class org.hamcrest.beans.PropertyUtil
+
+
Deprecated.
+
Returns the description of the property with the provided + name on the provided object's interface.
+
+
getReadMethod() - Method in class org.hamcrest.beans.PropertyAccessor.PropertyReadLens
+
+
The read method for the property.
+
+
getString() - Method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
+
Gets the string
+
+
getValue() - Method in class org.hamcrest.beans.PropertyAccessor.PropertyReadLens
+
+
The value of the property.
+
+
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

+
+
hasAbsolutePath(Matcher<Path>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file absolute path matches an expected path.
+
+
hasAbsolutePathString(Matcher<String>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file absolute path matches an expected String.
+
+
hasCanonicalPathString(Matcher<String>) - Static method in class org.hamcrest.io.PathMatchers
+
+
Deprecated. +
Use PathMatchers.hasRealPath(Matcher) instead. Provided for backward compatibility with FileMatchers.
+
+
+
hasContent(Matcher<String>) - Static method in class org.hamcrest.io.PathMatchers
+
+
Matcher for matching file content with given String Matcher.
+
+
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.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(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.
+
+
HasEqualValues<T> - Class in org.hamcrest.object
+
+
A matcher that checks if an object as equal fields values to an expected object.
+
+
HasEqualValues(T) - Constructor for class org.hamcrest.object.HasEqualValues
+
+
Constructor
+
+
hasFileName(Matcher<Path>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file name matches an expected name.
+
+
hasFileNameString(Matcher<String>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file name matches an expected String.
+
+
hasFileSystem(Matcher<FileSystem>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file's FileSystem matches an expected FileSystem.
+
+
hasItem(Matcher<? super T>) - Static method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated. + +
+
+
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(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(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.core.IsCollectionContaining
+
+
Deprecated. +
As of version 2.1, use IsIterableContaining.hasItem(Object).
+
+
+
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(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(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(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.collection.ArrayMatching
+
+
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<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
+
+
Constructor, best called from ArrayMatching.
+
+
hasItems(Matcher<? super 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(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(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.core.IsCollectionContaining
+
+
Deprecated. + +
+
+
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(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(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(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(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.
+
+
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(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.
+
+
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.Matchers
+
+
Creates a matcher of CharSequence that matches when a char sequence has the length + that satisfies the specified matcher.
+
+
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:
+
+
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) - 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.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, 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.
+
+
HasProperty<T> - Class in org.hamcrest.beans
+
+
A matcher that checks if an object has a JavaBean property with the + specified name.
+
+
HasProperty(String) - Constructor for class org.hamcrest.beans.HasProperty
+
+
Constructor, best called from HasProperty.hasProperty(String).
+
+
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
+
+
A matcher that checks if an object has a JavaBean property with the + specified name and an expected value.
+
+
HasPropertyWithValue(String, Matcher<?>) - Constructor for class org.hamcrest.beans.HasPropertyWithValue
+
+ +
+
HasPropertyWithValue(String, Matcher<?>, String) - Constructor for class org.hamcrest.beans.HasPropertyWithValue
+
+ +
+
hasRealPath(Matcher<Path>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file real path matches an expected path.
+
+
hasRealPathString(Matcher<String>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file real path matches an expected String.
+
+
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(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.
+
+
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(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(Matcher<Long>) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file size matches an expected size.
+
+
hasSizeEqualTo(long) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file has a specific size.
+
+
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(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.
+
+
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(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<T> - Class in org.hamcrest.object
+
+
A Matcher that checks the output of the toString() method.
+
+
HasToString(Matcher<? super String>) - Constructor for class org.hamcrest.object.HasToString
+
+ +
+
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(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.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.
+
+
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) - 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.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, 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.
+
+
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, 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, 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, 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 - 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, NamespaceContext, Matcher<String>) - Constructor for class org.hamcrest.xml.HasXPath
+
+
Constructor, best called from one of the hasXPath static factory methods.
+
+
HasXPath(String, Matcher<String>) - Constructor for class org.hamcrest.xml.HasXPath
+
+
Constructor, best called from one of the hasXPath static factory methods.
+
+
+

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(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.collection.IsIn
+
+
Creates a matcher that matches when the examined object is found within the + specified array.
+
+
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(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(Matcher<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive.
+
+
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.core.Is
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
is(T) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
is(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used is(equalTo(x)).
+
+
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
+
+
Constructor, best called from Is.is(Object), Is.is(Matcher), or Is.isA(Class).
+
+
IS_DIRECTORY - Static variable in class org.hamcrest.io.FileMatchers
+
+
Checks if a File is a directory.
+
+
IS_FILE - Static variable in class org.hamcrest.io.FileMatchers
+
+
Checks if a File is a file.
+
+
isA(Class<?>) - Static method in class org.hamcrest.core.Is
+
+
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)).
+
+
isA(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
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
+
+
Constructor, best called from IsAnything.anything().
+
+
IsAnything(String) - Constructor for class org.hamcrest.core.IsAnything
+
+
Constructor, best called from IsAnything.anything(String).
+
+
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
+
+
Constructor, best called from IsArray.array(Matcher[]).
+
+
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 size 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
+
+
Constructor, best called from IsCloseTo.closeTo(double, double).
+
+
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.
+
Constructor, best called from one of the static factory methods.
+
+
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
+
+
A matcher of Class that matches when the specified baseType is assignable from the examined class.
+
+
IsCompatibleType(Class<T>) - Constructor for class org.hamcrest.object.IsCompatibleType
+
+
Constructor, best called from IsCompatibleType.typeCompatibleWith(Class).
+
+
IsEmptyCollection<E> - Class in org.hamcrest.collection
+
+
Tests if a collection is empty.
+
+
IsEmptyCollection() - Constructor for class org.hamcrest.collection.IsEmptyCollection
+
+ +
+
IsEmptyIterable<E> - Class in org.hamcrest.collection
+
+
Tests if an iterable 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() - Static method in class org.hamcrest.text.IsEmptyString
+
+
Deprecated. +
use is(emptyString()) instead
+
+
+
IsEmptyString - Class in org.hamcrest.text
+
+
Matches empty Strings (and null).
+
+
IsEqual<T> - Class in org.hamcrest.core
+
+
Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) method.
+
+
IsEqual(T) - Constructor for class org.hamcrest.core.IsEqual
+
+
Constructor, best called from IsEqual.equalTo(Object) or IsEqual.equalToObject(Object).
+
+
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
+
+ +
+
isExecutable() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file/directory is executable.
+
+
isHidden() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file/directory is hidden.
+
+
isIn(Collection<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.collection.IsIn
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
isIn(T[]) - Static method in class org.hamcrest.Matchers
+
+
Deprecated. +
use is(in(...)) instead
+
+
+
IsIn<T> - Class in org.hamcrest.collection
+
+
Tests if a collection contains a matching object.
+
+
IsIn(Collection<T>) - Constructor for class org.hamcrest.collection.IsIn
+
+
Constructor, best called from IsIn.in(Collection).
+
+
IsIn(T[]) - Constructor for class org.hamcrest.collection.IsIn
+
+
Constructor, best called from IsIn.in(Object[]).
+
+
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
+
+
Tests if an iterable contains matching elements.
+
+
IsIterableContaining(Matcher<? super T>) - Constructor for class org.hamcrest.core.IsIterableContaining
+
+
Constructor, best called from one of the static factory methods.
+
+
IsIterableContainingInAnyOrder<T> - Class in org.hamcrest.collection
+
+
Tests if an iterable contains matching elements in any order.
+
+
IsIterableContainingInAnyOrder(Collection<Matcher<? super T>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
+
Constructor, best called from one of the static "containsInAnyOrder" factory methods.
+
+
IsIterableContainingInOrder<E> - Class in org.hamcrest.collection
+
+
Tests if an iterable contains matching elements in order.
+
+
IsIterableContainingInOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInOrder
+
+
Constructor, best called from one of the static "contains" factory methods.
+
+
IsIterableContainingInRelativeOrder<E> - Class in org.hamcrest.collection
+
+
Tests if an iterable contains matching elements in relative order.
+
+
IsIterableContainingInRelativeOrder(List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsIterableContainingInRelativeOrder
+
+ +
+
IsIterableContainingParallelRuns<E> - Class in org.hamcrest.collection
+
+
A matcher like that can check an iterable for parallel runs of a list of matchers.
+
+
IsIterableContainingParallelRuns(int, List<Matcher<? super E>>) - Constructor for class org.hamcrest.collection.IsIterableContainingParallelRuns
+
+
Construct a new matcher that will check for parallel runs.
+
+
IsIterableWithSize<E> - Class in org.hamcrest.collection
+
+
Matches if iterable size satisfies a size matcher.
+
+
IsIterableWithSize(Matcher<? super Integer>) - Constructor for class org.hamcrest.collection.IsIterableWithSize
+
+ +
+
IsMapContaining<K,V> - Class in org.hamcrest.collection
+
+
Matches if map keys, values or entries match the value matchers.
+
+
IsMapContaining(Matcher<? super K>, Matcher<? super V>) - Constructor for class org.hamcrest.collection.IsMapContaining
+
+
Constructor, best called from one of the static factory methods (hasKey, hasValue, + or hasEntry).
+
+
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
+
+ +
+
isModifiableJdkCollection() - Static method in class org.hamcrest.collection.IsUnmodifiable
+
+
Creates a matcher that matches when the collection is one of the known modifiable JDK collections.
+
+
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
+
+
Constructor, best called from IsNot.not(Object) or + IsNot.not(Matcher).
+
+
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
+
+
+
isReadable() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file or directory is readable.
+
+
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
+
+
Constructor, best called from IsSame.sameInstance(Object) or + IsSame.theInstance(Object).
+
+
isSameFile(Path) - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file/directory is the same file.
+
+
isSymbolicLink() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file/directory is a symbolic link.
+
+
IsUnmodifiable - Class in org.hamcrest.collection
+
+
This class contains static factory methods for creating Matchers that test if a collection is unmodifiable.
+
+
isUnmodifiableCollection() - Static method in class org.hamcrest.collection.IsUnmodifiable
+
+
Creates matcher that matches when collection is unmodifiable.
+
+
isUnmodifiableCustomCollection() - Static method in class org.hamcrest.collection.IsUnmodifiable
+
+
Creates a matcher that matches when the collection is unmodifiable by calling all modification methods to see if + any of them succeed.
+
+
isUnmodifiableJdkCollection() - Static method in class org.hamcrest.collection.IsUnmodifiable
+
+
Creates a matcher that matches when the collection is one of the known unmodifiable JDK collections.
+
+
isWritable() - Static method in class org.hamcrest.io.PathMatchers
+
+
A matcher that checks if a file/directory is writable.
+
+
iterableMatcher - Variable in class org.hamcrest.collection.ArrayAsIterableMatcher
+
+
The matchers to match iterable against
+
+
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(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.
+
+
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(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.
+
+
+

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
+
+
Called by steps when a match occurs
+
+
matcher(Predicate<T>, String, String, Class<T>) - Static method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Creates a TypeSafeDiagnosingMatcher that matches an item based on a Predicate.
+
+
matcher(Matcher<F>, Function<T, F>, String, String, Class<T>) - Static method in class org.hamcrest.FeatureMatcher
+
+
Create a Matcher that matches a feature of an object.
+
+
Matcher<T> - Interface in org.hamcrest
+
+
+ A matcher over acceptable values.
+
+
MatcherAssert - Class in org.hamcrest
+
+
The Hamcrest entrypoint, static methods to check if matchers match a + given value.
+
+
MatcherAssert() - Constructor for class org.hamcrest.MatcherAssert
+
+
Unused.
+
+
matchers - Variable in class org.hamcrest.collection.ArrayAsIterableMatcher
+
+
The matchers to match items against
+
+
Matchers - Class in org.hamcrest
+
+
Builder methods for various matchers.
+
+
Matchers() - Constructor for class org.hamcrest.Matchers
+
+
Unused
+
+
matches(Object) - Method in class org.hamcrest.collection.IsIn
+
 
+
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
+
+
Always returns true.
+
+
matches(Object) - Method in class org.hamcrest.core.IsEqual
+
 
+
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) - 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.
+
+
matches(Object, boolean) - Method in class org.hamcrest.core.AnyOf
+
+
Evaluates the argument o against the delegate matchers.
+
+
matches(Object, Description) - Method in class org.hamcrest.beans.SamePropertyValuesAs
+
 
+
matches(Object, Description) - Method in class org.hamcrest.core.AllOf
+
 
+
matches(Object, Description) - Method in class org.hamcrest.core.IsInstanceOf
+
 
+
matches(Object, Description) - Method in class org.hamcrest.DiagnosingMatcher
+
+
Evaluates the matcher for argument item.
+
+
matchesContentOf(File) - Static method in class org.hamcrest.io.FileMatchers
+
+
Matcher for matching file content with given file
+
+
matchesContentOf(Path) - Static method in class org.hamcrest.io.PathMatchers
+
+
Matcher for matching file content with given file path.
+
+
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(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.
+
+
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(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 - Class in org.hamcrest.text
+
+
Tests if a string matches a regular expression.
+
+
MatchesPattern(Pattern) - Constructor for class org.hamcrest.text.MatchesPattern
+
+ +
+
matchesRegex(String) - Static method in class org.hamcrest.core.StringRegularExpression
+
+
Creates a matcher that checks if the examined string matches a specified regex.
+
+
matchesRegex(String) - Static method in class org.hamcrest.Matchers
+
+
Validate a string with a regex.
+
+
matchesRegex(Pattern) - Static method in class org.hamcrest.core.StringRegularExpression
+
+
Creates a matcher that checks if the examined string matches a specified Pattern.
+
+
matchesRegex(Pattern) - Static method in class org.hamcrest.Matchers
+
+
Validate a string with a Pattern.
+
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.ArrayAsIterableMatcher
+
 
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.IsArrayContainingInAnyOrder
+
+
Deprecated.
+
matchesSafely(E[]) - Method in class org.hamcrest.collection.IsArrayContainingInOrder
+
+
Deprecated.
+
matchesSafely(Class<?>) - Method in class org.hamcrest.object.IsCompatibleType
+
 
+
matchesSafely(Double) - Method in class org.hamcrest.number.IsCloseTo
+
 
+
matchesSafely(Double) - Method in class org.hamcrest.number.IsNaN
+
 
+
matchesSafely(Iterable<? extends E>) - Method in class org.hamcrest.collection.IsEmptyIterable
+
 
+
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(Iterable<? extends T>, Description) - Method in class org.hamcrest.collection.IsIterableContainingInAnyOrder
+
 
+
matchesSafely(Iterable<? extends T>, Description) - Method in class org.hamcrest.core.Every
+
 
+
matchesSafely(Iterable<? extends T>, Description) - Method in class org.hamcrest.core.IsCollectionContaining
+
+
Deprecated.
+
matchesSafely(Iterable<? extends T>, Description) - Method in class org.hamcrest.core.IsIterableContaining
+
 
+
matchesSafely(Iterable<E>, Description) - Method in class org.hamcrest.collection.IsIterableContainingParallelRuns
+
 
+
matchesSafely(String) - Method in class org.hamcrest.core.SubstringMatcher
+
 
+
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(String, Description) - Method in class org.hamcrest.core.StringRegularExpression
+
 
+
matchesSafely(BigDecimal) - Method in class org.hamcrest.number.BigDecimalCloseTo
+
 
+
matchesSafely(Collection<? extends E>) - Method in class org.hamcrest.collection.IsEmptyCollection
+
 
+
matchesSafely(EventObject, Description) - Method in class org.hamcrest.object.IsEventFrom
+
 
+
matchesSafely(Map<? extends K, ? extends V>) - Method in class org.hamcrest.collection.IsMapContaining
+
 
+
matchesSafely(Optional<T>, Description) - Method in class org.hamcrest.optional.OptionalEmpty
+
 
+
matchesSafely(Optional<T>, Description) - Method in class org.hamcrest.optional.OptionalWithValue
+
 
+
matchesSafely(Node, Description) - Method in class org.hamcrest.xml.HasXPath
+
 
+
matchesSafely(T) - Method in class org.hamcrest.beans.HasProperty
+
 
+
matchesSafely(T) - Method in class org.hamcrest.TypeSafeMatcher
+
+
Check if the item matches.
+
+
matchesSafely(T[]) - Method in class org.hamcrest.collection.HasItemInArray
+
 
+
matchesSafely(T[]) - Method in class org.hamcrest.collection.IsArray
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.beans.HasPropertyWithValue
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.core.CombinableMatcher
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.exception.ThrowsException
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.FeatureMatcher
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.object.HasEqualValues
+
 
+
matchesSafely(T, Description) - Method in class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
Subclasses should implement this.
+
+
matching(Matcher<T>) - Method in class org.hamcrest.Condition
+
+
Applies the matcher as the final step in the sequence
+
+
matching(Matcher<T>, String) - Method in class org.hamcrest.Condition
+
+
Applies the matcher as the final step in the sequence
+
+
+

N

+
+
NO_ARGUMENTS - Static variable in class org.hamcrest.beans.PropertyAccessor
+
+
Empty object array, used for documenting that we are deliberately passing no arguments to a method.
+
+
NO_ARGUMENTS - Static variable in class org.hamcrest.beans.PropertyUtil
+
+
Deprecated.
+
Empty object array, used for documenting that we are deliberately passing no arguments to a method.
+
+
NO_NAMESPACE_CONTEXT - Static variable in class org.hamcrest.xml.HasXPath
+
+
Null NamespaceContext, used to document deliberate use + of no namespace.
+
+
NONE - Static variable in interface org.hamcrest.Description
+
+
A description that consumes input but does nothing, implemented by + Description.NullDescription.
+
+
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(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(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.core.IsNot
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
not(T) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
not(T) - Static method in class org.hamcrest.Matchers
+
+
A shortcut to the frequently used not(equalTo(x)).
+
+
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
+
+
Called by steps when a mismatch occurs.
+
+
notNullValue() - Static method in class org.hamcrest.core.IsNull
+
+
A shortcut to the frequently used not(nullValue()).
+
+
notNullValue() - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(nullValue()).
+
+
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.core.IsNull
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
notNullValue(Class<T>) - Static method in class org.hamcrest.CoreMatchers
+
+
A shortcut to the frequently used not(nullValue(X.class)).
+
+
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
+
+
Constructor.
+
+
nullValue() - 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() - 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.core.IsNull
+
+
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(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.
+
+
OptionalEmpty<T> - Class in org.hamcrest.optional
+
+
Matcher that expects an empty Optional.
+
+
OptionalEmpty() - Constructor for class org.hamcrest.optional.OptionalEmpty
+
+
Constructor, best called from OptionalEmpty.emptyOptional().
+
+
optionalWithValue() - Static method in class org.hamcrest.Matchers
+
+
Matcher for Optional that expects that value is present.
+
+
optionalWithValue() - Static method in class org.hamcrest.optional.OptionalWithValue
+
+
Matcher for Optional that expects that value is present.
+
+
optionalWithValue(Matcher<? super T>) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Optional that expects that value is present and matches matcher
+
+
optionalWithValue(Matcher<? super T>) - Static method in class org.hamcrest.optional.OptionalWithValue
+
+
Matcher for Optional that expects that value is present and matches matcher
+
+
optionalWithValue(T) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Optional that expects that value is present and is equal to value
+
+
optionalWithValue(T) - Static method in class org.hamcrest.optional.OptionalWithValue
+
+
Matcher for Optional that expects that value is present and is equal to value
+
+
OptionalWithValue<T> - Class in org.hamcrest.optional
+
+
Matcher for Optional that expects that value is present.
+
+
OptionalWithValue(Matcher<? super T>) - Constructor for class org.hamcrest.optional.OptionalWithValue
+
+
Constructor.
+
+
or(Matcher<? super T>) - Method in class org.hamcrest.core.CombinableMatcher
+
+
Specify the second matcher in a CombinableMatcher pair.
+
+
or(Matcher<? super X>) - Method in class org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher
+
+
Specify the second matcher in a CombinableMatcher pair.
+
+
OrderingComparison - Class in org.hamcrest.number
+
+
Static methods for building ordering comparisons.
+
+
org.hamcrest - package org.hamcrest
+
+
Top level matcher classes and interfaces.
+
+
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
+
+
Helper classes for building matcher comparators.
+
+
org.hamcrest.core - package org.hamcrest.core
+
+
Fundamental matchers of objects and values, and composite matchers.
+
+
org.hamcrest.exception - package org.hamcrest.exception
+
+
Matchers of exceptions.
+
+
org.hamcrest.io - package org.hamcrest.io
+
+
Matchers that perform file comparisons.
+
+
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.optional - package org.hamcrest.optional
+
+
Matchers that perform comparisons on Optional instances.
+
+
org.hamcrest.text - package org.hamcrest.text
+
+
Matchers that perform text comparisons.
+
+
org.hamcrest.xml - package org.hamcrest.xml
+
+
Matchers of XML documents.
+
+
+

P

+
+
PathMatchers - Class in org.hamcrest.io
+
+
Matchers for properties of files.
+
+
PropertyAccessor - Class in org.hamcrest.beans
+
+
Utility class to help with finding properties in an object.
+
+
PropertyAccessor(Object) - Constructor for class org.hamcrest.beans.PropertyAccessor
+
+
Constructor.
+
+
PropertyAccessor.PropertyReadLens - Class in org.hamcrest.beans
+
+
Encapsulates a property in the parent object.
+
+
propertyDescriptorsFor(Object, Class<Object>) - Static method in class org.hamcrest.beans.PropertyAccessor
+
+
Returns all the property descriptors for the class associated with the given object
+
+
propertyDescriptorsFor(Object, Class<Object>) - Static method in class org.hamcrest.beans.PropertyUtil
+
+
Deprecated.
+
Returns all the property descriptors for the class associated with the given object
+
+
PropertyReadLens(String, Method) - Constructor for class org.hamcrest.beans.PropertyAccessor.PropertyReadLens
+
+
Constructor.
+
+
PropertyUtil - Class in org.hamcrest.beans
+
+
Deprecated. +
Replaced by PropertyAccessor
+
+
+
+

R

+
+
readLenses() - Method in class org.hamcrest.beans.PropertyAccessor
+
+
The collection of lenses for all the properties that were found in the + object.
+
+
readLensFor(String) - Method in class org.hamcrest.beans.PropertyAccessor
+
+
The read lens for the specified property.
+
+
+

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(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.
+
+
SamePropertyValuesAs<T> - Class in org.hamcrest.beans
+
+
A matcher that checks if a given bean has the same property values + as an example bean.
+
+
SamePropertyValuesAs(T, List<String>) - Constructor for class org.hamcrest.beans.SamePropertyValuesAs
+
+ +
+
SelfDescribing - Interface in org.hamcrest
+
+
The ability of an object to describe itself.
+
+
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
+
+ +
+
StringContains(String) - Constructor for class org.hamcrest.core.StringContains
+
+
Constructor, best used with StringContains.containsString(String).
+
+
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(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.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.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 - Class in org.hamcrest.text
+
+
Tests if a string contains the given substrings in order.
+
+
StringContainsInOrder(Iterable<String>) - Constructor for class org.hamcrest.text.StringContainsInOrder
+
+ +
+
StringDescription - Class in org.hamcrest
+
+
A Description that is stored as a string.
+
+
StringDescription() - Constructor for class org.hamcrest.StringDescription
+
+
Creates a new description.
+
+
StringDescription(Appendable) - Constructor for class org.hamcrest.StringDescription
+
+
Creates a new description using the given appendable.
+
+
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
+
+ +
+
StringEndsWith(String) - Constructor for class org.hamcrest.core.StringEndsWith
+
+
Constructor, best used with StringEndsWith.endsWith(String).
+
+
StringRegularExpression - Class in org.hamcrest.core
+
+
A matcher that checks a string against a regular expression.
+
+
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
+
+ +
+
StringStartsWith(String) - Constructor for class org.hamcrest.core.StringStartsWith
+
+
Constructor, best used with StringStartsWith.startsWith(String).
+
+
stripSpaces(String) - Method in class org.hamcrest.text.IsEqualCompressingWhiteSpace
+
+
Strips spaces
+
+
substring - Variable in class org.hamcrest.core.SubstringMatcher
+
+
The substring to match
+
+
SubstringMatcher - Class in org.hamcrest.core
+
+
Common behaviour for matchers that check substrings.
+
+
SubstringMatcher(String, boolean, String) - Constructor for class org.hamcrest.core.SubstringMatcher
+
+
Build a 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
+
+
An alias for Condition.and(Step), which applies the mapping to the current value in the + sequence.
+
+
throwsException() - Static method in class org.hamcrest.exception.ThrowsException
+
+
Matcher for Runnable that expects an exception to be thrown
+
+
throwsException() - Static method in class org.hamcrest.Matchers
+
+
Matcher for Runnable that expects an exception to be thrown
+
+
throwsException(Class<U>) - Static method in class org.hamcrest.exception.ThrowsException
+
+
Matcher for Throwable that expects that the Runnable throws an exception of the + provided throwableClass class
+
+
throwsException(Class<U>) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class
+
+
throwsException(Class<U>, String) - Static method in class org.hamcrest.exception.ThrowsException
+
+
Matcher for Throwable that expects that the Runnable throws an exception of the + provided throwableClass class and has a message equal to the provided + message
+
+
throwsException(Class<U>, String) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class and has a message equal to the provided message
+
+
throwsException(Class<U>, Matcher<String>) - Static method in class org.hamcrest.exception.ThrowsException
+
+
Matcher for Throwable that expects that the Runnable throws an exception of the provided + throwableClass class and has a message matching the provided + messageMatcher
+
+
throwsException(Class<U>, Matcher<String>) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class and has a message matching the provided messageMatcher
+
+
throwsException(U) - Static method in class org.hamcrest.exception.ThrowsException
+
+
Matcher for Throwable that expects that the Runnable throws an exception equal + to the provided throwable
+
+
throwsException(U) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Throwable that expects that the Runnable throws an exception equal to the provided throwable
+
+
ThrowsException<T> - Class in org.hamcrest.exception
+
+
Tests if a Runnable throws a matching exception.
+
+
ThrowsException(IsInstanceOf, Matcher<? super String>) - Constructor for class org.hamcrest.exception.ThrowsException
+
+
Constructor, best called from one of the static ThrowsException.throwsException() methods.
+
+
throwsExceptionWithMessage(String) - Static method in class org.hamcrest.exception.ThrowsException
+
+
Matcher for Throwable that expects that the Runnable throws an exception with a message equal to the provided message
+
+
throwsExceptionWithMessage(String) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Throwable that expects that the Runnable throws an exception with a message equal to the provided message
+
+
throwsExceptionWithMessage(Matcher<String>) - Static method in class org.hamcrest.exception.ThrowsException
+
+
Matcher for Throwable that expects that the Runnable throws an exception with a message matching the provided messageMatcher
+
+
throwsExceptionWithMessage(Matcher<String>) - Static method in class org.hamcrest.Matchers
+
+
Matcher for Throwable that expects that the Runnable throws an exception with a message matching the provided messageMatcher
+
+
toString() - Method in class org.hamcrest.BaseMatcher
+
 
+
toString() - Method in class org.hamcrest.Description.NullDescription
+
 
+
toString() - Method in class org.hamcrest.StringDescription
+
+
Returns the description as a string.
+
+
toString(SelfDescribing) - Static method in class org.hamcrest.StringDescription
+
+
Return the description of a SelfDescribing object 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() - Constructor for class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
The default constructor for simple sub types
+
+
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.
+
+
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 _ 
All Classes and Interfaces|All Packages
+
+ + diff --git a/docs/javadoc/4.0/index.html b/docs/javadoc/4.0/index.html new file mode 100644 index 00000000..de156392 --- /dev/null +++ b/docs/javadoc/4.0/index.html @@ -0,0 +1,135 @@ + + + + +Overview (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hamcrest 4.0 API

+
+

Matchers that can be combined to create flexible expressions of intent.

+

For example:

+
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));

+  }

+}

+
+ +

For more information and documentation, see:

+
+
+
Packages
+
+
Package
+
Description
+ +
+
Top level matcher classes and interfaces.
+
+ +
+
Matchers of Java Bean properties and their values.
+
+ +
+
Matchers of arrays and collections.
+
+ +
+
Helper classes for building matcher comparators.
+
+ +
+
Fundamental matchers of objects and values, and composite matchers.
+
+ +
+
Matchers of exceptions.
+
+ +
+
Matchers that perform file comparisons.
+
+ +
+
Matchers that perform numeric comparisons.
+
+ +
+
Matchers that inspect objects and classes.
+
+ +
+
Matchers that perform comparisons on Optional instances.
+
+ +
+
Matchers that perform text comparisons.
+
+ +
+
Matchers of XML documents.
+
+
+
+
+
+ + diff --git a/docs/javadoc/4.0/legal/ADDITIONAL_LICENSE_INFO b/docs/javadoc/4.0/legal/ADDITIONAL_LICENSE_INFO new file mode 100644 index 00000000..ff700cd0 --- /dev/null +++ b/docs/javadoc/4.0/legal/ADDITIONAL_LICENSE_INFO @@ -0,0 +1,37 @@ + ADDITIONAL INFORMATION ABOUT LICENSING + +Certain files distributed by Oracle America, Inc. and/or its affiliates are +subject to the following clarification and special exception to the GPLv2, +based on the GNU Project exception for its Classpath libraries, known as the +GNU Classpath Exception. + +Note that Oracle includes multiple, independent programs in this software +package. Some of those programs are provided under licenses deemed +incompatible with the GPLv2 by the Free Software Foundation and others. +For example, the package includes programs licensed under the Apache +License, Version 2.0 and may include FreeType. Such programs are licensed +to you under their original licenses. + +Oracle facilitates your further distribution of this package by adding the +Classpath Exception to the necessary parts of its GPLv2 code, which permits +you to use that code in combination with other independent modules not +licensed under the GPLv2. However, note that this would not permit you to +commingle code under an incompatible license with Oracle's GPLv2 licensed +code by, for example, cutting and pasting such code into a file also +containing Oracle's GPLv2 licensed code and then distributing the result. + +Additionally, if you were to remove the Classpath Exception from any of the +files to which it applies and distribute the result, you would likely be +required to license some or all of the other code in that distribution under +the GPLv2 as well, and since the GPLv2 is incompatible with the license terms +of some items included in the distribution by Oracle, removing the Classpath +Exception could therefore effectively compromise your ability to further +distribute the package. + +Failing to distribute notices associated with some files may also create +unexpected legal consequences. + +Proceed with caution and we recommend that you obtain the advice of a lawyer +skilled in open source matters before removing the Classpath Exception or +making modifications to this package which may subsequently be redistributed +and/or involve the use of third party software. diff --git a/docs/javadoc/4.0/legal/ASSEMBLY_EXCEPTION b/docs/javadoc/4.0/legal/ASSEMBLY_EXCEPTION new file mode 100644 index 00000000..42966666 --- /dev/null +++ b/docs/javadoc/4.0/legal/ASSEMBLY_EXCEPTION @@ -0,0 +1,27 @@ + +OPENJDK ASSEMBLY EXCEPTION + +The OpenJDK source code made available by Oracle America, Inc. (Oracle) at +openjdk.org ("OpenJDK Code") is distributed under the terms of the GNU +General Public License version 2 +only ("GPL2"), with the following clarification and special exception. + + Linking this OpenJDK Code statically or dynamically with other code + is making a combined work based on this library. Thus, the terms + and conditions of GPL2 cover the whole combination. + + As a special exception, Oracle gives you permission to link this + OpenJDK Code with certain code licensed by Oracle as indicated at + https://openjdk.org/legal/exception-modules-2007-05-08.html + ("Designated Exception Modules") to produce an executable, + regardless of the license terms of the Designated Exception Modules, + and to copy and distribute the resulting executable under GPL2, + provided that the Designated Exception Modules continue to be + governed by the licenses under which they were offered by Oracle. + +As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code +to build an executable that includes those portions of necessary code that +Oracle could not provide under GPL2 (or that Oracle has provided under GPL2 +with the Classpath exception). If you modify or add to the OpenJDK code, +that new GPL2 code may still be combined with Designated Exception Modules +if the new code is made subject to this exception by its copyright holder. diff --git a/docs/javadoc/4.0/legal/LICENSE b/docs/javadoc/4.0/legal/LICENSE new file mode 100644 index 00000000..8b400c7a --- /dev/null +++ b/docs/javadoc/4.0/legal/LICENSE @@ -0,0 +1,347 @@ +The GNU General Public License (GPL) + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to +most of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software is +covered by the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you +can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for +a fee, you must give the recipients all the rights that you have. You must +make sure that they, too, receive or can get the source code. And you must +show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) +offer you this license which gives you legal permission to copy, distribute +and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program proprietary. +To prevent this, we have made it clear that any patent must be licensed for +everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program +or work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included +without limitation in the term "modification".) Each licensee is addressed as +"you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is +not restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as +you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this License +and to the absence of any warranty; and give any other recipients of the +Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may +at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus +forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all of +these conditions: + + a) You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or + in part contains or is derived from the Program or any part thereof, to be + licensed as a whole at no charge to all third parties under the terms of + this License. + + c) If the modified program normally reads commands interactively when run, + you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms +of this License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based on +the Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of Sections 1 and +2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above + on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only + for noncommercial distribution and only if you received the program in + object code or executable form with such an offer, in accord with + Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all +the source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code +distributed need not include anything that is normally distributed (in either +source or binary form) with the major components (compiler, kernel, and so on) +of the operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source +code from the same place counts as distribution of the source code, even though +third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Program +or its derivative works. These actions are prohibited by law if you do not +accept this License. Therefore, by modifying or distributing the Program (or +any work based on the Program), you indicate your acceptance of this License to +do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), +the recipient automatically receives a license from the original licensor to +copy, distribute or modify the Program subject to these terms and conditions. +You may not impose any further restrictions on the recipients' exercise of the +rights granted herein. You are not responsible for enforcing compliance by +third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), conditions +are imposed on you (whether by court order, agreement or otherwise) that +contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot distribute so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not distribute the Program at all. +For example, if a patent license would not permit royalty-free redistribution +of the Program by all those who receive copies directly or indirectly through +you, then the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and +the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original +copyright holder who places the Program under this License may add an explicit +geographical distribution limitation excluding those countries, so that +distribution is permitted only in or among countries not thus excluded. In +such case, this License incorporates the limitation as if written in the body +of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any later +version", you have the option of following the terms and conditions either of +that version or of any later version published by the Free Software Foundation. +If the Program does not specify a version number of this License, you may +choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status of +all derivatives of our free software and of promoting the sharing and reuse of +software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE +PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA +BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER +OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion +of warranty; and each file should have at least the "copyright" line and a +pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + + Copyright (C) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it +starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes + with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free + software, and you are welcome to redistribute it under certain conditions; + type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may be +called something other than 'show w' and 'show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here +is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + 'Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General Public +License instead of this License. + + +"CLASSPATH" EXCEPTION TO THE GPL + +Certain source files distributed by Oracle America and/or its affiliates are +subject to the following clarification and special exception to the GPL, but +only where Oracle has expressly included in the particular source file's header +the words "Oracle designates this particular file as subject to the "Classpath" +exception as provided by Oracle in the LICENSE file that accompanied this code." + + Linking this library statically or dynamically with other modules is making + a combined work based on this library. Thus, the terms and conditions of + the GNU General Public License cover the whole combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules, + and to copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent module, + the terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. If + you modify this library, you may extend this exception to your version of + the library, but you are not obligated to do so. If you do not wish to do + so, delete this exception statement from your version. diff --git a/docs/javadoc/4.0/legal/dejavufonts.md b/docs/javadoc/4.0/legal/dejavufonts.md new file mode 100644 index 00000000..8c9e3cf3 --- /dev/null +++ b/docs/javadoc/4.0/legal/dejavufonts.md @@ -0,0 +1,191 @@ +## DejaVu fonts v2.37 + +### DejaVu License +
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
+
+
+Bitstream Vera Fonts Copyright
+------------------------------
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute the
+Font Software, including without limitation the rights to use, copy, merge,
+publish, distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright and trademark notices and this permission notice shall
+be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional glyphs or characters may be added to the Fonts, only if the fonts
+are renamed to names not containing either the words "Bitstream" or the word
+"Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream
+Vera" names.
+
+The Font Software may be sold as part of a larger software package but no
+copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
+FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font Software
+without prior written authorization from the Gnome Foundation or Bitstream
+Inc., respectively. For further information, contact: fonts at gnome dot
+org.
+
+Arev Fonts Copyright
+------------------------------
+
+Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and
+associated documentation files (the "Font Software"), to reproduce
+and distribute the modifications to the Bitstream Vera Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Tavmjong Bah" or the word "Arev".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Tavmjong Bah Arev" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the name of Tavmjong Bah shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealings in this Font Software without prior written authorization
+from Tavmjong Bah. For further information, contact: tavmjong @ free
+. fr.
+
+TeX Gyre DJV Math
+-----------------
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+
+Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
+(on behalf of TeX users groups) are in public domain.
+
+Letters imported from Euler Fraktur from AMSfonts are (c) American
+Mathematical Society (see below).
+Bitstream Vera Fonts Copyright
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
+is a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated
+documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute,
+and/or sell copies of the Font Software, and to permit persons  to whom
+the Font Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be
+included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional
+glyphs or characters may be added to the Fonts, only if the fonts are
+renamed
+to names not containing either the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or
+Font Software
+that has been modified and is distributed under the "Bitstream Vera"
+names.
+
+The Font Software may be sold as part of a larger software package but
+no copy
+of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
+SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
+ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE
+THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+Except as contained in this notice, the names of GNOME, the GNOME
+Foundation,
+and Bitstream Inc., shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Font Software without prior written
+authorization from the GNOME Foundation or Bitstream Inc., respectively.
+For further information, contact: fonts at gnome dot org.
+
+AMSFonts (v. 2.2) copyright
+
+The PostScript Type 1 implementation of the AMSFonts produced by and
+previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
+available for general use. This has been accomplished through the
+cooperation
+of a consortium of scientific publishers with Blue Sky Research and Y&Y.
+Members of this consortium include:
+
+Elsevier Science IBM Corporation Society for Industrial and Applied
+Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)
+
+In order to assure the authenticity of these fonts, copyright will be
+held by
+the American Mathematical Society. This is not meant to restrict in any way
+the legitimate use of the fonts, such as (but not limited to) electronic
+distribution of documents containing these fonts, inclusion of these fonts
+into other public domain or commercial font collections or computer
+applications, use of the outline data to create derivative fonts and/or
+faces, etc. However, the AMS does require that the AMS copyright notice be
+removed from any derivative versions of the fonts which have been altered in
+any way. In addition, to ensure the fidelity of TeX documents using Computer
+Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
+has requested that any alterations which yield different font metrics be
+given a different name.
+
+
diff --git a/docs/javadoc/4.0/legal/jquery.md b/docs/javadoc/4.0/legal/jquery.md new file mode 100644 index 00000000..a763ec6f --- /dev/null +++ b/docs/javadoc/4.0/legal/jquery.md @@ -0,0 +1,26 @@ +## jQuery v3.7.1 + +### jQuery License +``` +jQuery v 3.7.1 +Copyright OpenJS Foundation and other contributors, https://openjsf.org/ + +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/docs/javadoc/4.0/legal/jqueryUI.md b/docs/javadoc/4.0/legal/jqueryUI.md new file mode 100644 index 00000000..8bda9d7a --- /dev/null +++ b/docs/javadoc/4.0/legal/jqueryUI.md @@ -0,0 +1,49 @@ +## jQuery UI v1.13.2 + +### jQuery UI License +``` +Copyright jQuery Foundation and other contributors, https://jquery.org/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery-ui + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code contained within the demos directory. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. + +``` diff --git a/docs/javadoc/4.0/member-search-index.js b/docs/javadoc/4.0/member-search-index.js new file mode 100644 index 00000000..269884c1 --- /dev/null +++ b/docs/javadoc/4.0/member-search-index.js @@ -0,0 +1 @@ +memberSearchIndex = [{"p":"org.hamcrest","c":"BaseMatcher","l":"_dont_implement_Matcher___instead_extend_BaseMatcher_()"},{"p":"org.hamcrest","c":"Matcher","l":"_dont_implement_Matcher___instead_extend_BaseMatcher_()"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aFileNamed(Matcher)","u":"aFileNamed(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aFileWithAbsolutePath(Matcher)","u":"aFileWithAbsolutePath(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aFileWithCanonicalPath(Matcher)","u":"aFileWithCanonicalPath(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aFileWithContent(Matcher)","u":"aFileWithContent(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aFileWithSize(long)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aFileWithSize(Matcher)","u":"aFileWithSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"AllOf","l":"allOf(Iterable>)","u":"allOf(java.lang.Iterable)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"allOf(Iterable>)","u":"allOf(java.lang.Iterable)"},{"p":"org.hamcrest","c":"Matchers","l":"allOf(Iterable>)","u":"allOf(java.lang.Iterable)"},{"p":"org.hamcrest.core","c":"AllOf","l":"AllOf(Iterable>)","u":"%3Cinit%3E(java.lang.Iterable)"},{"p":"org.hamcrest","c":"Matchers","l":"allOf(Matcher, Matcher)","u":"allOf(org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"allOf(Matcher, Matcher, Matcher)","u":"allOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"allOf(Matcher, Matcher, Matcher, Matcher)","u":"allOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"allOf(Matcher, Matcher, Matcher, Matcher, Matcher)","u":"allOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"allOf(Matcher, Matcher, Matcher, Matcher, Matcher, Matcher)","u":"allOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"AllOf","l":"allOf(Matcher...)","u":"allOf(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"allOf(Matcher...)","u":"allOf(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"allOf(Matcher...)","u":"allOf(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.core","c":"AllOf","l":"AllOf(Matcher...)","u":"%3Cinit%3E(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"IsMapWithSize","l":"aMapWithSize(int)"},{"p":"org.hamcrest","c":"Matchers","l":"aMapWithSize(int)"},{"p":"org.hamcrest.collection","c":"IsMapWithSize","l":"aMapWithSize(Matcher)","u":"aMapWithSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"aMapWithSize(Matcher)","u":"aMapWithSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Condition","l":"and(Condition.Step)","u":"and(org.hamcrest.Condition.Step)"},{"p":"org.hamcrest.core","c":"CombinableMatcher","l":"and(Matcher)","u":"and(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"CombinableMatcher.CombinableBothMatcher","l":"and(Matcher)","u":"and(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsMapWithSize","l":"anEmptyMap()"},{"p":"org.hamcrest","c":"Matchers","l":"anEmptyMap()"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"anExistingDirectory()"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"anExistingDirectory()"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"anExistingFile()"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"anExistingFile()"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"anExistingFileOrDirectory()"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"anExistingFileOrDirectory()"},{"p":"org.hamcrest.core","c":"IsInstanceOf","l":"any(Class)","u":"any(java.lang.Class)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"any(Class)","u":"any(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"any(Class)","u":"any(java.lang.Class)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"anyOf(Iterable>)","u":"anyOf(java.lang.Iterable)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"anyOf(Iterable>)","u":"anyOf(java.lang.Iterable)"},{"p":"org.hamcrest","c":"Matchers","l":"anyOf(Iterable>)","u":"anyOf(java.lang.Iterable)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"AnyOf(Iterable>)","u":"%3Cinit%3E(java.lang.Iterable)"},{"p":"org.hamcrest","c":"Matchers","l":"anyOf(Matcher, Matcher)","u":"anyOf(org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"anyOf(Matcher, Matcher, Matcher)","u":"anyOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"anyOf(Matcher, Matcher, Matcher, Matcher)","u":"anyOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"anyOf(Matcher, Matcher, Matcher, Matcher, Matcher)","u":"anyOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"anyOf(Matcher, Matcher, Matcher, Matcher, Matcher, Matcher)","u":"anyOf(org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"anyOf(Matcher...)","u":"anyOf(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"anyOf(Matcher...)","u":"anyOf(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"anyOf(Matcher...)","u":"anyOf(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"AnyOf(Matcher...)","u":"%3Cinit%3E(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.core","c":"IsAnything","l":"anything()"},{"p":"org.hamcrest","c":"CoreMatchers","l":"anything()"},{"p":"org.hamcrest","c":"Matchers","l":"anything()"},{"p":"org.hamcrest.core","c":"IsAnything","l":"anything(String)","u":"anything(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"anything(String)","u":"anything(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"anything(String)","u":"anything(java.lang.String)"},{"p":"org.hamcrest","c":"BaseDescription","l":"append(char)"},{"p":"org.hamcrest","c":"StringDescription","l":"append(char)"},{"p":"org.hamcrest","c":"BaseDescription","l":"append(String)","u":"append(java.lang.String)"},{"p":"org.hamcrest","c":"StringDescription","l":"append(String)","u":"append(java.lang.String)"},{"p":"org.hamcrest","c":"BaseDescription","l":"appendDescriptionOf(SelfDescribing)","u":"appendDescriptionOf(org.hamcrest.SelfDescribing)"},{"p":"org.hamcrest","c":"Description","l":"appendDescriptionOf(SelfDescribing)","u":"appendDescriptionOf(org.hamcrest.SelfDescribing)"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"appendDescriptionOf(SelfDescribing)","u":"appendDescriptionOf(org.hamcrest.SelfDescribing)"},{"p":"org.hamcrest","c":"BaseDescription","l":"appendList(String, String, String, Iterable)","u":"appendList(java.lang.String,java.lang.String,java.lang.String,java.lang.Iterable)"},{"p":"org.hamcrest","c":"Description","l":"appendList(String, String, String, Iterable)","u":"appendList(java.lang.String,java.lang.String,java.lang.String,java.lang.Iterable)"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"appendList(String, String, String, Iterable)","u":"appendList(java.lang.String,java.lang.String,java.lang.String,java.lang.Iterable)"},{"p":"org.hamcrest","c":"BaseDescription","l":"appendText(String)","u":"appendText(java.lang.String)"},{"p":"org.hamcrest","c":"Description","l":"appendText(String)","u":"appendText(java.lang.String)"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"appendText(String)","u":"appendText(java.lang.String)"},{"p":"org.hamcrest","c":"BaseDescription","l":"appendValue(Object)","u":"appendValue(java.lang.Object)"},{"p":"org.hamcrest","c":"Description","l":"appendValue(Object)","u":"appendValue(java.lang.Object)"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"appendValue(Object)","u":"appendValue(java.lang.Object)"},{"p":"org.hamcrest","c":"BaseDescription","l":"appendValueList(String, String, String, Iterable)","u":"appendValueList(java.lang.String,java.lang.String,java.lang.String,java.lang.Iterable)"},{"p":"org.hamcrest","c":"Description","l":"appendValueList(String, String, String, Iterable)","u":"appendValueList(java.lang.String,java.lang.String,java.lang.String,java.lang.Iterable)"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"appendValueList(String, String, String, Iterable)","u":"appendValueList(java.lang.String,java.lang.String,java.lang.String,java.lang.Iterable)"},{"p":"org.hamcrest","c":"BaseDescription","l":"appendValueList(String, String, String, T...)","u":"appendValueList(java.lang.String,java.lang.String,java.lang.String,T...)"},{"p":"org.hamcrest","c":"Description","l":"appendValueList(String, String, String, T...)","u":"appendValueList(java.lang.String,java.lang.String,java.lang.String,T...)"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"appendValueList(String, String, String, T...)","u":"appendValueList(java.lang.String,java.lang.String,java.lang.String,T...)"},{"p":"org.hamcrest","c":"Condition.Step","l":"apply(I, Description)","u":"apply(I,org.hamcrest.Description)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aReadableFile()"},{"p":"org.hamcrest.collection","c":"IsArray","l":"array(Matcher...)","u":"array(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"array(Matcher...)","u":"array(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"ArrayAsIterableMatcher","l":"ArrayAsIterableMatcher(TypeSafeDiagnosingMatcher>, Collection>, String)","u":"%3Cinit%3E(org.hamcrest.TypeSafeDiagnosingMatcher,java.util.Collection,java.lang.String)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"arrayContaining(E...)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInOrder","l":"arrayContaining(E...)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayContaining(E...)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"arrayContaining(List>)","u":"arrayContaining(java.util.List)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInOrder","l":"arrayContaining(List>)","u":"arrayContaining(java.util.List)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayContaining(List>)","u":"arrayContaining(java.util.List)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"arrayContaining(Matcher...)","u":"arrayContaining(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInOrder","l":"arrayContaining(Matcher...)","u":"arrayContaining(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayContaining(Matcher...)","u":"arrayContaining(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"arrayContainingInAnyOrder(Collection>)","u":"arrayContainingInAnyOrder(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInAnyOrder","l":"arrayContainingInAnyOrder(Collection>)","u":"arrayContainingInAnyOrder(java.util.Collection)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayContainingInAnyOrder(Collection>)","u":"arrayContainingInAnyOrder(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"arrayContainingInAnyOrder(E...)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInAnyOrder","l":"arrayContainingInAnyOrder(E...)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayContainingInAnyOrder(E...)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"arrayContainingInAnyOrder(Matcher...)","u":"arrayContainingInAnyOrder(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInAnyOrder","l":"arrayContainingInAnyOrder(Matcher...)","u":"arrayContainingInAnyOrder(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayContainingInAnyOrder(Matcher...)","u":"arrayContainingInAnyOrder(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"IsArrayWithSize","l":"arrayWithSize(int)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayWithSize(int)"},{"p":"org.hamcrest.collection","c":"IsArrayWithSize","l":"arrayWithSize(Matcher)","u":"arrayWithSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"arrayWithSize(Matcher)","u":"arrayWithSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"asEqualMatchers(E[])"},{"p":"org.hamcrest","c":"MatcherAssert","l":"assertThat(String, boolean)","u":"assertThat(java.lang.String,boolean)"},{"p":"org.hamcrest","c":"MatcherAssert","l":"assertThat(String, T, Matcher)","u":"assertThat(java.lang.String,T,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"MatcherAssert","l":"assertThat(T, Matcher)","u":"assertThat(T,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"StringDescription","l":"asString(SelfDescribing)","u":"asString(org.hamcrest.SelfDescribing)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"aWritableFile()"},{"p":"org.hamcrest","c":"BaseDescription","l":"BaseDescription()","u":"%3Cinit%3E()"},{"p":"org.hamcrest","c":"BaseMatcher","l":"BaseMatcher()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.number","c":"BigDecimalCloseTo","l":"BigDecimalCloseTo(BigDecimal, BigDecimal)","u":"%3Cinit%3E(java.math.BigDecimal,java.math.BigDecimal)"},{"p":"org.hamcrest","c":"Matchers","l":"blankOrNullString()"},{"p":"org.hamcrest.text","c":"IsBlankString","l":"blankOrNullString()"},{"p":"org.hamcrest","c":"Matchers","l":"blankString()"},{"p":"org.hamcrest.text","c":"IsBlankString","l":"blankString()"},{"p":"org.hamcrest.core","c":"CombinableMatcher","l":"both(Matcher)","u":"both(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"both(Matcher)","u":"both(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"both(Matcher)","u":"both(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"CAN_READ"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"CAN_WRITE"},{"p":"org.hamcrest.text","c":"CharSequenceLength","l":"CharSequenceLength(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"FileMatchers.FileStatus","l":"check(File)","u":"check(java.io.File)"},{"p":"org.hamcrest","c":"Matchers","l":"closeTo(BigDecimal, BigDecimal)","u":"closeTo(java.math.BigDecimal,java.math.BigDecimal)"},{"p":"org.hamcrest.number","c":"BigDecimalCloseTo","l":"closeTo(BigDecimal, BigDecimal)","u":"closeTo(java.math.BigDecimal,java.math.BigDecimal)"},{"p":"org.hamcrest","c":"Matchers","l":"closeTo(double, double)","u":"closeTo(double,double)"},{"p":"org.hamcrest.number","c":"IsCloseTo","l":"closeTo(double, double)","u":"closeTo(double,double)"},{"p":"org.hamcrest.core","c":"CombinableMatcher.CombinableBothMatcher","l":"CombinableBothMatcher(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"CombinableMatcher.CombinableEitherMatcher","l":"CombinableEitherMatcher(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"CombinableMatcher","l":"CombinableMatcher(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.comparator","c":"ComparatorMatcherBuilder","l":"comparedBy(Comparator)","u":"comparedBy(java.util.Comparator)"},{"p":"org.hamcrest.comparator","c":"ComparatorMatcherBuilder","l":"comparesEqualTo(T)"},{"p":"org.hamcrest","c":"Matchers","l":"comparesEqualTo(T)"},{"p":"org.hamcrest.number","c":"OrderingComparison","l":"comparesEqualTo(T)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInOrder","l":"contains(E...)"},{"p":"org.hamcrest","c":"Matchers","l":"contains(E...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInOrder","l":"contains(List>)","u":"contains(java.util.List)"},{"p":"org.hamcrest","c":"Matchers","l":"contains(List>)","u":"contains(java.util.List)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInOrder","l":"contains(Matcher)","u":"contains(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"contains(Matcher)","u":"contains(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInOrder","l":"contains(Matcher...)","u":"contains(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"contains(Matcher...)","u":"contains(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInAnyOrder","l":"containsInAnyOrder(Collection>)","u":"containsInAnyOrder(java.util.Collection)"},{"p":"org.hamcrest","c":"Matchers","l":"containsInAnyOrder(Collection>)","u":"containsInAnyOrder(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInAnyOrder","l":"containsInAnyOrder(Comparator, T...)","u":"containsInAnyOrder(java.util.Comparator,T...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInAnyOrder","l":"containsInAnyOrder(Matcher...)","u":"containsInAnyOrder(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"containsInAnyOrder(Matcher...)","u":"containsInAnyOrder(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInAnyOrder","l":"containsInAnyOrder(T...)"},{"p":"org.hamcrest","c":"Matchers","l":"containsInAnyOrder(T...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInRelativeOrder","l":"containsInRelativeOrder(E...)"},{"p":"org.hamcrest","c":"Matchers","l":"containsInRelativeOrder(E...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInRelativeOrder","l":"containsInRelativeOrder(List>)","u":"containsInRelativeOrder(java.util.List)"},{"p":"org.hamcrest","c":"Matchers","l":"containsInRelativeOrder(List>)","u":"containsInRelativeOrder(java.util.List)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInRelativeOrder","l":"containsInRelativeOrder(Matcher...)","u":"containsInRelativeOrder(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"containsInRelativeOrder(Matcher...)","u":"containsInRelativeOrder(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingParallelRuns","l":"containsParallelRunsOf(int, E...)","u":"containsParallelRunsOf(int,E...)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingParallelRuns","l":"containsParallelRunsOf(int, List>)","u":"containsParallelRunsOf(int,java.util.List)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingParallelRuns","l":"containsParallelRunsOf(int, Matcher...)","u":"containsParallelRunsOf(int,org.hamcrest.Matcher...)"},{"p":"org.hamcrest.core","c":"StringContains","l":"containsString(String)","u":"containsString(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"containsString(String)","u":"containsString(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"containsString(String)","u":"containsString(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringContains","l":"containsStringIgnoringCase(String)","u":"containsStringIgnoringCase(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"containsStringIgnoringCase(String)","u":"containsStringIgnoringCase(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"containsStringIgnoringCase(String)","u":"containsStringIgnoringCase(java.lang.String)"},{"p":"org.hamcrest.core","c":"SubstringMatcher","l":"converted(String)","u":"converted(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"CoreMatchers()","u":"%3Cinit%3E()"},{"p":"org.hamcrest","c":"CustomMatcher","l":"CustomMatcher(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest","c":"CustomTypeSafeMatcher","l":"CustomTypeSafeMatcher(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest.core","c":"DescribedAs","l":"describedAs(String, Matcher, Object...)","u":"describedAs(java.lang.String,org.hamcrest.Matcher,java.lang.Object...)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"describedAs(String, Matcher, Object...)","u":"describedAs(java.lang.String,org.hamcrest.Matcher,java.lang.Object...)"},{"p":"org.hamcrest","c":"Matchers","l":"describedAs(String, Matcher, Object...)","u":"describedAs(java.lang.String,org.hamcrest.Matcher,java.lang.Object...)"},{"p":"org.hamcrest.core","c":"DescribedAs","l":"DescribedAs(String, Matcher, Object[])","u":"%3Cinit%3E(java.lang.String,org.hamcrest.Matcher,java.lang.Object[])"},{"p":"org.hamcrest","c":"BaseMatcher","l":"describeMismatch(Object, Description)","u":"describeMismatch(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"DescribedAs","l":"describeMismatch(Object, Description)","u":"describeMismatch(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"Is","l":"describeMismatch(Object, Description)","u":"describeMismatch(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"DiagnosingMatcher","l":"describeMismatch(Object, Description)","u":"describeMismatch(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"Matcher","l":"describeMismatch(Object, Description)","u":"describeMismatch(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"TypeSafeDiagnosingMatcher","l":"describeMismatch(Object, Description)","u":"describeMismatch(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"TypeSafeMatcher","l":"describeMismatch(Object, Description)","u":"describeMismatch(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest.number","c":"BigDecimalCloseTo","l":"describeMismatchSafely(BigDecimal, Description)","u":"describeMismatchSafely(java.math.BigDecimal,org.hamcrest.Description)"},{"p":"org.hamcrest.object","c":"IsCompatibleType","l":"describeMismatchSafely(Class, Description)","u":"describeMismatchSafely(java.lang.Class,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsEmptyCollection","l":"describeMismatchSafely(Collection, Description)","u":"describeMismatchSafely(java.util.Collection,org.hamcrest.Description)"},{"p":"org.hamcrest.number","c":"IsCloseTo","l":"describeMismatchSafely(Double, Description)","u":"describeMismatchSafely(java.lang.Double,org.hamcrest.Description)"},{"p":"org.hamcrest.number","c":"IsNaN","l":"describeMismatchSafely(Double, Description)","u":"describeMismatchSafely(java.lang.Double,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"ArrayAsIterableMatcher","l":"describeMismatchSafely(E[], Description)","u":"describeMismatchSafely(E[],org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInAnyOrder","l":"describeMismatchSafely(E[], Description)","u":"describeMismatchSafely(E[],org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInOrder","l":"describeMismatchSafely(E[], Description)","u":"describeMismatchSafely(E[],org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsEmptyIterable","l":"describeMismatchSafely(Iterable, Description)","u":"describeMismatchSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"describeMismatchSafely(Map, Description)","u":"describeMismatchSafely(java.util.Map,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"SubstringMatcher","l":"describeMismatchSafely(String, Description)","u":"describeMismatchSafely(java.lang.String,org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"describeMismatchSafely(String, Description)","u":"describeMismatchSafely(java.lang.String,org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"IsEqualIgnoringCase","l":"describeMismatchSafely(String, Description)","u":"describeMismatchSafely(java.lang.String,org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"StringContainsInOrder","l":"describeMismatchSafely(String, Description)","u":"describeMismatchSafely(java.lang.String,org.hamcrest.Description)"},{"p":"org.hamcrest.beans","c":"HasProperty","l":"describeMismatchSafely(T, Description)","u":"describeMismatchSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"TypeSafeMatcher","l":"describeMismatchSafely(T, Description)","u":"describeMismatchSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"HasItemInArray","l":"describeMismatchSafely(T[], Description)","u":"describeMismatchSafely(T[],org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsArray","l":"describeMismatchSafely(T[], Description)","u":"describeMismatchSafely(T[],org.hamcrest.Description)"},{"p":"org.hamcrest.beans","c":"HasProperty","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.beans","c":"HasPropertyWithValue","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.beans","c":"SamePropertyValuesAs","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"ArrayAsIterableMatcher","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"HasItemInArray","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsArray","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInAnyOrder","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInOrder","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsEmptyCollection","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsEmptyIterable","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIn","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInAnyOrder","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInOrder","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInRelativeOrder","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingParallelRuns","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"AllOf","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"CombinableMatcher","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"DescribedAs","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"Every","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"Is","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsAnything","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsCollectionContaining","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsEqual","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsInstanceOf","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsIterableContaining","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsNot","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsNull","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsSame","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"StringRegularExpression","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"SubstringMatcher","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest","c":"CustomMatcher","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest","c":"CustomTypeSafeMatcher","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest","c":"FeatureMatcher","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.number","c":"BigDecimalCloseTo","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.number","c":"IsCloseTo","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.number","c":"IsNaN","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.object","c":"HasEqualValues","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.object","c":"IsCompatibleType","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.object","c":"IsEventFrom","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.optional","c":"OptionalEmpty","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.optional","c":"OptionalWithValue","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest","c":"SelfDescribing","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"IsBlankString","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"IsEmptyString","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"IsEqualIgnoringCase","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"MatchesPattern","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.text","c":"StringContainsInOrder","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"describeTo(Description)","u":"describeTo(org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"describeTo(Description, String)","u":"describeTo(org.hamcrest.Description,java.lang.String)"},{"p":"org.hamcrest.collection","c":"IsArray","l":"descriptionEnd()"},{"p":"org.hamcrest.collection","c":"IsArray","l":"descriptionSeparator()"},{"p":"org.hamcrest.collection","c":"IsArray","l":"descriptionStart()"},{"p":"org.hamcrest","c":"DiagnosingMatcher","l":"DiagnosingMatcher()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.core","c":"CombinableMatcher","l":"either(Matcher)","u":"either(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"either(Matcher)","u":"either(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"either(Matcher)","u":"either(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsEmptyCollection","l":"empty()"},{"p":"org.hamcrest","c":"Matchers","l":"empty()"},{"p":"org.hamcrest.collection","c":"IsArrayWithSize","l":"emptyArray()"},{"p":"org.hamcrest","c":"Matchers","l":"emptyArray()"},{"p":"org.hamcrest.collection","c":"IsEmptyCollection","l":"emptyCollectionOf(Class)","u":"emptyCollectionOf(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"emptyCollectionOf(Class)","u":"emptyCollectionOf(java.lang.Class)"},{"p":"org.hamcrest.collection","c":"IsEmptyIterable","l":"emptyIterable()"},{"p":"org.hamcrest","c":"Matchers","l":"emptyIterable()"},{"p":"org.hamcrest.collection","c":"IsEmptyIterable","l":"emptyIterableOf(Class)","u":"emptyIterableOf(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"emptyIterableOf(Class)","u":"emptyIterableOf(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"emptyOptional()"},{"p":"org.hamcrest.optional","c":"OptionalEmpty","l":"emptyOptional()"},{"p":"org.hamcrest","c":"Matchers","l":"emptyOrNullString()"},{"p":"org.hamcrest.text","c":"IsEmptyString","l":"emptyOrNullString()"},{"p":"org.hamcrest","c":"Matchers","l":"emptyString()"},{"p":"org.hamcrest.text","c":"IsEmptyString","l":"emptyString()"},{"p":"org.hamcrest.core","c":"StringEndsWith","l":"endsWith(String)","u":"endsWith(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"endsWith(String)","u":"endsWith(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"endsWith(String)","u":"endsWith(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringEndsWith","l":"endsWithIgnoringCase(String)","u":"endsWithIgnoringCase(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"endsWithIgnoringCase(String)","u":"endsWithIgnoringCase(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"endsWithIgnoringCase(String)","u":"endsWithIgnoringCase(java.lang.String)"},{"p":"org.hamcrest.core","c":"IsEqual","l":"equalTo(T)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"equalTo(T)"},{"p":"org.hamcrest","c":"Matchers","l":"equalTo(T)"},{"p":"org.hamcrest","c":"Matchers","l":"equalToCompressingWhiteSpace(String)","u":"equalToCompressingWhiteSpace(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"equalToCompressingWhiteSpace(String)","u":"equalToCompressingWhiteSpace(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"equalToIgnoringCase(String)","u":"equalToIgnoringCase(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEqualIgnoringCase","l":"equalToIgnoringCase(String)","u":"equalToIgnoringCase(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"equalToIgnoringWhiteSpace(String)","u":"equalToIgnoringWhiteSpace(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"equalToIgnoringWhiteSpace(String)","u":"equalToIgnoringWhiteSpace(java.lang.String)"},{"p":"org.hamcrest.core","c":"IsEqual","l":"equalToObject(Object)","u":"equalToObject(java.lang.Object)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"equalToObject(Object)","u":"equalToObject(java.lang.Object)"},{"p":"org.hamcrest","c":"Matchers","l":"equalToObject(Object)","u":"equalToObject(java.lang.Object)"},{"p":"org.hamcrest.core","c":"StringContains","l":"evalSubstringOf(String)","u":"evalSubstringOf(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringEndsWith","l":"evalSubstringOf(String)","u":"evalSubstringOf(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringStartsWith","l":"evalSubstringOf(String)","u":"evalSubstringOf(java.lang.String)"},{"p":"org.hamcrest.core","c":"SubstringMatcher","l":"evalSubstringOf(String)","u":"evalSubstringOf(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"eventFrom(Class, Object)","u":"eventFrom(java.lang.Class,java.lang.Object)"},{"p":"org.hamcrest.object","c":"IsEventFrom","l":"eventFrom(Class, Object)","u":"eventFrom(java.lang.Class,java.lang.Object)"},{"p":"org.hamcrest","c":"Matchers","l":"eventFrom(Object)","u":"eventFrom(java.lang.Object)"},{"p":"org.hamcrest.object","c":"IsEventFrom","l":"eventFrom(Object)","u":"eventFrom(java.lang.Object)"},{"p":"org.hamcrest.core","c":"Every","l":"Every(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"Every","l":"everyItem(Matcher)","u":"everyItem(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"everyItem(Matcher)","u":"everyItem(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"everyItem(Matcher)","u":"everyItem(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"EXISTS"},{"p":"org.hamcrest","c":"FeatureMatcher","l":"FeatureMatcher(Matcher, String, String)","u":"%3Cinit%3E(org.hamcrest.Matcher,java.lang.String,java.lang.String)"},{"p":"org.hamcrest.text","c":"CharSequenceLength","l":"featureValueOf(CharSequence)","u":"featureValueOf(java.lang.CharSequence)"},{"p":"org.hamcrest.collection","c":"IsCollectionWithSize","l":"featureValueOf(Collection)","u":"featureValueOf(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsArrayWithSize","l":"featureValueOf(E[])"},{"p":"org.hamcrest.collection","c":"IsIterableWithSize","l":"featureValueOf(Iterable)","u":"featureValueOf(java.lang.Iterable)"},{"p":"org.hamcrest.collection","c":"IsMapWithSize","l":"featureValueOf(Map)","u":"featureValueOf(java.util.Map)"},{"p":"org.hamcrest","c":"FeatureMatcher","l":"featureValueOf(T)"},{"p":"org.hamcrest.object","c":"HasToString","l":"featureValueOf(T)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor","l":"fieldNames()"},{"p":"org.hamcrest.beans","c":"PropertyAccessor","l":"fieldValue(String)","u":"fieldValue(java.lang.String)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor.PropertyReadLens","l":"getName()"},{"p":"org.hamcrest.beans","c":"PropertyUtil","l":"getPropertyDescriptor(String, Object)","u":"getPropertyDescriptor(java.lang.String,java.lang.Object)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor.PropertyReadLens","l":"getReadMethod()"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"getString()"},{"p":"org.hamcrest.beans","c":"PropertyAccessor.PropertyReadLens","l":"getValue()"},{"p":"org.hamcrest.comparator","c":"ComparatorMatcherBuilder","l":"greaterThan(T)"},{"p":"org.hamcrest","c":"Matchers","l":"greaterThan(T)"},{"p":"org.hamcrest.number","c":"OrderingComparison","l":"greaterThan(T)"},{"p":"org.hamcrest.comparator","c":"ComparatorMatcherBuilder","l":"greaterThanOrEqualTo(T)"},{"p":"org.hamcrest","c":"Matchers","l":"greaterThanOrEqualTo(T)"},{"p":"org.hamcrest.number","c":"OrderingComparison","l":"greaterThanOrEqualTo(T)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasAbsolutePath(Matcher)","u":"hasAbsolutePath(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasAbsolutePathString(Matcher)","u":"hasAbsolutePathString(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasCanonicalPathString(Matcher)","u":"hasCanonicalPathString(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasContent(Matcher)","u":"hasContent(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"hasEntry(K, V)","u":"hasEntry(K,V)"},{"p":"org.hamcrest","c":"Matchers","l":"hasEntry(K, V)","u":"hasEntry(K,V)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"hasEntry(Matcher, Matcher)","u":"hasEntry(org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasEntry(Matcher, Matcher)","u":"hasEntry(org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest.object","c":"HasEqualValues","l":"HasEqualValues(T)","u":"%3Cinit%3E(T)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasFileName(Matcher)","u":"hasFileName(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasFileNameString(Matcher)","u":"hasFileNameString(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasFileSystem(Matcher)","u":"hasFileSystem(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"IsCollectionContaining","l":"hasItem(Matcher)","u":"hasItem(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"IsIterableContaining","l":"hasItem(Matcher)","u":"hasItem(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"hasItem(Matcher)","u":"hasItem(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasItem(Matcher)","u":"hasItem(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"IsCollectionContaining","l":"hasItem(T)"},{"p":"org.hamcrest.core","c":"IsIterableContaining","l":"hasItem(T)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"hasItem(T)"},{"p":"org.hamcrest","c":"Matchers","l":"hasItem(T)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"hasItemInArray(Matcher)","u":"hasItemInArray(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasItemInArray(Matcher)","u":"hasItemInArray(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"HasItemInArray","l":"HasItemInArray(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"ArrayMatching","l":"hasItemInArray(T)"},{"p":"org.hamcrest","c":"Matchers","l":"hasItemInArray(T)"},{"p":"org.hamcrest.core","c":"IsCollectionContaining","l":"hasItems(Matcher...)","u":"hasItems(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.core","c":"IsIterableContaining","l":"hasItems(Matcher...)","u":"hasItems(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"hasItems(Matcher...)","u":"hasItems(org.hamcrest.Matcher...)"},{"p":"org.hamcrest","c":"Matchers","l":"hasItems(Matcher...)","u":"hasItems(org.hamcrest.Matcher...)"},{"p":"org.hamcrest.core","c":"IsCollectionContaining","l":"hasItems(T...)"},{"p":"org.hamcrest.core","c":"IsIterableContaining","l":"hasItems(T...)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"hasItems(T...)"},{"p":"org.hamcrest","c":"Matchers","l":"hasItems(T...)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"hasKey(K)"},{"p":"org.hamcrest","c":"Matchers","l":"hasKey(K)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"hasKey(Matcher)","u":"hasKey(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasKey(Matcher)","u":"hasKey(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasLength(int)"},{"p":"org.hamcrest.text","c":"CharSequenceLength","l":"hasLength(int)"},{"p":"org.hamcrest","c":"Matchers","l":"hasLength(Matcher)","u":"hasLength(org.hamcrest.Matcher)"},{"p":"org.hamcrest.text","c":"CharSequenceLength","l":"hasLength(Matcher)","u":"hasLength(org.hamcrest.Matcher)"},{"p":"org.hamcrest.beans","c":"HasProperty","l":"hasProperty(String)","u":"hasProperty(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"hasProperty(String)","u":"hasProperty(java.lang.String)"},{"p":"org.hamcrest.beans","c":"HasProperty","l":"HasProperty(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest.beans","c":"HasPropertyWithValue","l":"hasProperty(String, Matcher)","u":"hasProperty(java.lang.String,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasProperty(String, Matcher)","u":"hasProperty(java.lang.String,org.hamcrest.Matcher)"},{"p":"org.hamcrest.beans","c":"HasPropertyWithValue","l":"hasPropertyAtPath(String, Matcher)","u":"hasPropertyAtPath(java.lang.String,org.hamcrest.Matcher)"},{"p":"org.hamcrest.beans","c":"HasPropertyWithValue","l":"HasPropertyWithValue(String, Matcher)","u":"%3Cinit%3E(java.lang.String,org.hamcrest.Matcher)"},{"p":"org.hamcrest.beans","c":"HasPropertyWithValue","l":"HasPropertyWithValue(String, Matcher, String)","u":"%3Cinit%3E(java.lang.String,org.hamcrest.Matcher,java.lang.String)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasRealPath(Matcher)","u":"hasRealPath(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasRealPathString(Matcher)","u":"hasRealPathString(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsCollectionWithSize","l":"hasSize(int)"},{"p":"org.hamcrest","c":"Matchers","l":"hasSize(int)"},{"p":"org.hamcrest.collection","c":"IsCollectionWithSize","l":"hasSize(Matcher)","u":"hasSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasSize(Matcher)","u":"hasSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasSize(Matcher)","u":"hasSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"hasSizeEqualTo(long)"},{"p":"org.hamcrest","c":"Matchers","l":"hasToString(Matcher)","u":"hasToString(org.hamcrest.Matcher)"},{"p":"org.hamcrest.object","c":"HasToString","l":"hasToString(Matcher)","u":"hasToString(org.hamcrest.Matcher)"},{"p":"org.hamcrest.object","c":"HasToString","l":"HasToString(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasToString(String)","u":"hasToString(java.lang.String)"},{"p":"org.hamcrest.object","c":"HasToString","l":"hasToString(String)","u":"hasToString(java.lang.String)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"hasValue(Matcher)","u":"hasValue(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasValue(Matcher)","u":"hasValue(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"hasValue(V)"},{"p":"org.hamcrest","c":"Matchers","l":"hasValue(V)"},{"p":"org.hamcrest","c":"Matchers","l":"hasXPath(String)","u":"hasXPath(java.lang.String)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"hasXPath(String)","u":"hasXPath(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"hasXPath(String, Matcher)","u":"hasXPath(java.lang.String,org.hamcrest.Matcher)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"hasXPath(String, Matcher)","u":"hasXPath(java.lang.String,org.hamcrest.Matcher)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"HasXPath(String, Matcher)","u":"%3Cinit%3E(java.lang.String,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"hasXPath(String, NamespaceContext)","u":"hasXPath(java.lang.String,javax.xml.namespace.NamespaceContext)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"hasXPath(String, NamespaceContext)","u":"hasXPath(java.lang.String,javax.xml.namespace.NamespaceContext)"},{"p":"org.hamcrest","c":"Matchers","l":"hasXPath(String, NamespaceContext, Matcher)","u":"hasXPath(java.lang.String,javax.xml.namespace.NamespaceContext,org.hamcrest.Matcher)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"hasXPath(String, NamespaceContext, Matcher)","u":"hasXPath(java.lang.String,javax.xml.namespace.NamespaceContext,org.hamcrest.Matcher)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"HasXPath(String, NamespaceContext, Matcher)","u":"%3Cinit%3E(java.lang.String,javax.xml.namespace.NamespaceContext,org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsIn","l":"in(Collection)","u":"in(java.util.Collection)"},{"p":"org.hamcrest","c":"Matchers","l":"in(Collection)","u":"in(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsIn","l":"in(T[])"},{"p":"org.hamcrest","c":"Matchers","l":"in(T[])"},{"p":"org.hamcrest.core","c":"IsInstanceOf","l":"instanceOf(Class)","u":"instanceOf(java.lang.Class)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"instanceOf(Class)","u":"instanceOf(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"instanceOf(Class)","u":"instanceOf(java.lang.Class)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"IS_DIRECTORY"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"IS_FILE"},{"p":"org.hamcrest.core","c":"Is","l":"is(Matcher)","u":"is(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"is(Matcher)","u":"is(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"is(Matcher)","u":"is(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"Is","l":"Is(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"Is","l":"is(T)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"is(T)"},{"p":"org.hamcrest","c":"Matchers","l":"is(T)"},{"p":"org.hamcrest.core","c":"Is","l":"isA(Class)","u":"isA(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"isA(Class)","u":"isA(java.lang.Class)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"isA(Class)","u":"isA(java.lang.Class)"},{"p":"org.hamcrest.core","c":"IsAnything","l":"IsAnything()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.core","c":"IsAnything","l":"IsAnything(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest.collection","c":"IsArray","l":"IsArray(Matcher[])","u":"%3Cinit%3E(org.hamcrest.Matcher[])"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInAnyOrder","l":"IsArrayContainingInAnyOrder(Collection>)","u":"%3Cinit%3E(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInOrder","l":"IsArrayContainingInOrder(List>)","u":"%3Cinit%3E(java.util.List)"},{"p":"org.hamcrest.collection","c":"IsArrayWithSize","l":"IsArrayWithSize(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.number","c":"IsCloseTo","l":"IsCloseTo(double, double)","u":"%3Cinit%3E(double,double)"},{"p":"org.hamcrest.core","c":"IsCollectionContaining","l":"IsCollectionContaining(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsCollectionWithSize","l":"IsCollectionWithSize(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.object","c":"IsCompatibleType","l":"IsCompatibleType(Class)","u":"%3Cinit%3E(java.lang.Class)"},{"p":"org.hamcrest.collection","c":"IsEmptyCollection","l":"IsEmptyCollection()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.collection","c":"IsEmptyIterable","l":"IsEmptyIterable()","u":"%3Cinit%3E()"},{"p":"org.hamcrest","c":"Matchers","l":"isEmptyOrNullString()"},{"p":"org.hamcrest.text","c":"IsEmptyString","l":"isEmptyOrNullString()"},{"p":"org.hamcrest","c":"Matchers","l":"isEmptyString()"},{"p":"org.hamcrest.text","c":"IsEmptyString","l":"isEmptyString()"},{"p":"org.hamcrest.core","c":"IsEqual","l":"IsEqual(T)","u":"%3Cinit%3E(T)"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"IsEqualCompressingWhiteSpace(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEqualIgnoringCase","l":"IsEqualIgnoringCase(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest.object","c":"IsEventFrom","l":"IsEventFrom(Class, Object)","u":"%3Cinit%3E(java.lang.Class,java.lang.Object)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"isExecutable()"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"isHidden()"},{"p":"org.hamcrest.collection","c":"IsIn","l":"isIn(Collection)","u":"isIn(java.util.Collection)"},{"p":"org.hamcrest","c":"Matchers","l":"isIn(Collection)","u":"isIn(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsIn","l":"IsIn(Collection)","u":"%3Cinit%3E(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsIn","l":"isIn(T[])"},{"p":"org.hamcrest","c":"Matchers","l":"isIn(T[])"},{"p":"org.hamcrest.collection","c":"IsIn","l":"IsIn(T[])","u":"%3Cinit%3E(T[])"},{"p":"org.hamcrest.core","c":"IsInstanceOf","l":"IsInstanceOf(Class)","u":"%3Cinit%3E(java.lang.Class)"},{"p":"org.hamcrest.core","c":"IsIterableContaining","l":"IsIterableContaining(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInAnyOrder","l":"IsIterableContainingInAnyOrder(Collection>)","u":"%3Cinit%3E(java.util.Collection)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInOrder","l":"IsIterableContainingInOrder(List>)","u":"%3Cinit%3E(java.util.List)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInRelativeOrder","l":"IsIterableContainingInRelativeOrder(List>)","u":"%3Cinit%3E(java.util.List)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingParallelRuns","l":"IsIterableContainingParallelRuns(int, List>)","u":"%3Cinit%3E(int,java.util.List)"},{"p":"org.hamcrest.collection","c":"IsIterableWithSize","l":"IsIterableWithSize(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"IsMapContaining(Matcher, Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher,org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsMapWithSize","l":"IsMapWithSize(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest.collection","c":"IsUnmodifiable","l":"isModifiableJdkCollection()"},{"p":"org.hamcrest.core","c":"IsNot","l":"IsNot(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"BaseMatcher","l":"isNotNull(Object, Description)","u":"isNotNull(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsNull","l":"IsNull()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.collection","c":"IsIn","l":"isOneOf(T...)"},{"p":"org.hamcrest","c":"Matchers","l":"isOneOf(T...)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"isReadable()"},{"p":"org.hamcrest.core","c":"IsSame","l":"IsSame(T)","u":"%3Cinit%3E(T)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"isSameFile(Path)","u":"isSameFile(java.nio.file.Path)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"isSymbolicLink()"},{"p":"org.hamcrest.collection","c":"IsUnmodifiable","l":"isUnmodifiableCollection()"},{"p":"org.hamcrest.collection","c":"IsUnmodifiable","l":"isUnmodifiableCustomCollection()"},{"p":"org.hamcrest.collection","c":"IsUnmodifiable","l":"isUnmodifiableJdkCollection()"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"isWritable()"},{"p":"org.hamcrest.collection","c":"ArrayAsIterableMatcher","l":"iterableMatcher"},{"p":"org.hamcrest.collection","c":"IsIterableWithSize","l":"iterableWithSize(int)"},{"p":"org.hamcrest","c":"Matchers","l":"iterableWithSize(int)"},{"p":"org.hamcrest.collection","c":"IsIterableWithSize","l":"iterableWithSize(Matcher)","u":"iterableWithSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"iterableWithSize(Matcher)","u":"iterableWithSize(org.hamcrest.Matcher)"},{"p":"org.hamcrest.comparator","c":"ComparatorMatcherBuilder","l":"lessThan(T)"},{"p":"org.hamcrest","c":"Matchers","l":"lessThan(T)"},{"p":"org.hamcrest.number","c":"OrderingComparison","l":"lessThan(T)"},{"p":"org.hamcrest.comparator","c":"ComparatorMatcherBuilder","l":"lessThanOrEqualTo(T)"},{"p":"org.hamcrest","c":"Matchers","l":"lessThanOrEqualTo(T)"},{"p":"org.hamcrest.number","c":"OrderingComparison","l":"lessThanOrEqualTo(T)"},{"p":"org.hamcrest","c":"Condition","l":"matched(T, Description)","u":"matched(T,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"FeatureMatcher","l":"matcher(Matcher, Function, String, String, Class)","u":"matcher(org.hamcrest.Matcher,java.util.function.Function,java.lang.String,java.lang.String,java.lang.Class)"},{"p":"org.hamcrest","c":"TypeSafeDiagnosingMatcher","l":"matcher(Predicate, String, String, Class)","u":"matcher(java.util.function.Predicate,java.lang.String,java.lang.String,java.lang.Class)"},{"p":"org.hamcrest","c":"MatcherAssert","l":"MatcherAssert()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.collection","c":"ArrayAsIterableMatcher","l":"matchers"},{"p":"org.hamcrest","c":"Matchers","l":"Matchers()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.collection","c":"IsIn","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"DescribedAs","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"Is","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"IsAnything","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"IsEqual","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"IsNot","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"IsNull","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"IsSame","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest","c":"DiagnosingMatcher","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest","c":"Matcher","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest","c":"TypeSafeDiagnosingMatcher","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest","c":"TypeSafeMatcher","l":"matches(Object)","u":"matches(java.lang.Object)"},{"p":"org.hamcrest.core","c":"AnyOf","l":"matches(Object, boolean)","u":"matches(java.lang.Object,boolean)"},{"p":"org.hamcrest.beans","c":"SamePropertyValuesAs","l":"matches(Object, Description)","u":"matches(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"AllOf","l":"matches(Object, Description)","u":"matches(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsInstanceOf","l":"matches(Object, Description)","u":"matches(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"DiagnosingMatcher","l":"matches(Object, Description)","u":"matches(java.lang.Object,org.hamcrest.Description)"},{"p":"org.hamcrest.io","c":"FileMatchers","l":"matchesContentOf(File)","u":"matchesContentOf(java.io.File)"},{"p":"org.hamcrest.io","c":"PathMatchers","l":"matchesContentOf(Path)","u":"matchesContentOf(java.nio.file.Path)"},{"p":"org.hamcrest","c":"Matchers","l":"matchesPattern(Pattern)","u":"matchesPattern(java.util.regex.Pattern)"},{"p":"org.hamcrest.text","c":"MatchesPattern","l":"matchesPattern(Pattern)","u":"matchesPattern(java.util.regex.Pattern)"},{"p":"org.hamcrest.text","c":"MatchesPattern","l":"MatchesPattern(Pattern)","u":"%3Cinit%3E(java.util.regex.Pattern)"},{"p":"org.hamcrest","c":"Matchers","l":"matchesPattern(String)","u":"matchesPattern(java.lang.String)"},{"p":"org.hamcrest.text","c":"MatchesPattern","l":"matchesPattern(String)","u":"matchesPattern(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringRegularExpression","l":"matchesRegex(Pattern)","u":"matchesRegex(java.util.regex.Pattern)"},{"p":"org.hamcrest","c":"Matchers","l":"matchesRegex(Pattern)","u":"matchesRegex(java.util.regex.Pattern)"},{"p":"org.hamcrest.core","c":"StringRegularExpression","l":"matchesRegex(String)","u":"matchesRegex(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"matchesRegex(String)","u":"matchesRegex(java.lang.String)"},{"p":"org.hamcrest.number","c":"BigDecimalCloseTo","l":"matchesSafely(BigDecimal)","u":"matchesSafely(java.math.BigDecimal)"},{"p":"org.hamcrest.object","c":"IsCompatibleType","l":"matchesSafely(Class)","u":"matchesSafely(java.lang.Class)"},{"p":"org.hamcrest.collection","c":"IsEmptyCollection","l":"matchesSafely(Collection)","u":"matchesSafely(java.util.Collection)"},{"p":"org.hamcrest.number","c":"IsCloseTo","l":"matchesSafely(Double)","u":"matchesSafely(java.lang.Double)"},{"p":"org.hamcrest.number","c":"IsNaN","l":"matchesSafely(Double)","u":"matchesSafely(java.lang.Double)"},{"p":"org.hamcrest.collection","c":"ArrayAsIterableMatcher","l":"matchesSafely(E[])"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInAnyOrder","l":"matchesSafely(E[])"},{"p":"org.hamcrest.collection","c":"IsArrayContainingInOrder","l":"matchesSafely(E[])"},{"p":"org.hamcrest.object","c":"IsEventFrom","l":"matchesSafely(EventObject, Description)","u":"matchesSafely(java.util.EventObject,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsEmptyIterable","l":"matchesSafely(Iterable)","u":"matchesSafely(java.lang.Iterable)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInOrder","l":"matchesSafely(Iterable, Description)","u":"matchesSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInRelativeOrder","l":"matchesSafely(Iterable, Description)","u":"matchesSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingInAnyOrder","l":"matchesSafely(Iterable, Description)","u":"matchesSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"Every","l":"matchesSafely(Iterable, Description)","u":"matchesSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsCollectionContaining","l":"matchesSafely(Iterable, Description)","u":"matchesSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"IsIterableContaining","l":"matchesSafely(Iterable, Description)","u":"matchesSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsIterableContainingParallelRuns","l":"matchesSafely(Iterable, Description)","u":"matchesSafely(java.lang.Iterable,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"IsMapContaining","l":"matchesSafely(Map)","u":"matchesSafely(java.util.Map)"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"matchesSafely(Node, Description)","u":"matchesSafely(org.w3c.dom.Node,org.hamcrest.Description)"},{"p":"org.hamcrest.optional","c":"OptionalEmpty","l":"matchesSafely(Optional, Description)","u":"matchesSafely(java.util.Optional,org.hamcrest.Description)"},{"p":"org.hamcrest.optional","c":"OptionalWithValue","l":"matchesSafely(Optional, Description)","u":"matchesSafely(java.util.Optional,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"SubstringMatcher","l":"matchesSafely(String)","u":"matchesSafely(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsBlankString","l":"matchesSafely(String)","u":"matchesSafely(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEmptyString","l":"matchesSafely(String)","u":"matchesSafely(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"matchesSafely(String)","u":"matchesSafely(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEqualIgnoringCase","l":"matchesSafely(String)","u":"matchesSafely(java.lang.String)"},{"p":"org.hamcrest.text","c":"MatchesPattern","l":"matchesSafely(String)","u":"matchesSafely(java.lang.String)"},{"p":"org.hamcrest.text","c":"StringContainsInOrder","l":"matchesSafely(String)","u":"matchesSafely(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringRegularExpression","l":"matchesSafely(String, Description)","u":"matchesSafely(java.lang.String,org.hamcrest.Description)"},{"p":"org.hamcrest.beans","c":"HasProperty","l":"matchesSafely(T)"},{"p":"org.hamcrest","c":"TypeSafeMatcher","l":"matchesSafely(T)"},{"p":"org.hamcrest.beans","c":"HasPropertyWithValue","l":"matchesSafely(T, Description)","u":"matchesSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest.core","c":"CombinableMatcher","l":"matchesSafely(T, Description)","u":"matchesSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"matchesSafely(T, Description)","u":"matchesSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"FeatureMatcher","l":"matchesSafely(T, Description)","u":"matchesSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest.object","c":"HasEqualValues","l":"matchesSafely(T, Description)","u":"matchesSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest","c":"TypeSafeDiagnosingMatcher","l":"matchesSafely(T, Description)","u":"matchesSafely(T,org.hamcrest.Description)"},{"p":"org.hamcrest.collection","c":"HasItemInArray","l":"matchesSafely(T[])"},{"p":"org.hamcrest.collection","c":"IsArray","l":"matchesSafely(T[])"},{"p":"org.hamcrest","c":"Condition","l":"matching(Matcher)","u":"matching(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Condition","l":"matching(Matcher, String)","u":"matching(org.hamcrest.Matcher,java.lang.String)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor","l":"NO_ARGUMENTS"},{"p":"org.hamcrest.beans","c":"PropertyUtil","l":"NO_ARGUMENTS"},{"p":"org.hamcrest.xml","c":"HasXPath","l":"NO_NAMESPACE_CONTEXT"},{"p":"org.hamcrest","c":"Description","l":"NONE"},{"p":"org.hamcrest.core","c":"IsNot","l":"not(Matcher)","u":"not(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"not(Matcher)","u":"not(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"not(Matcher)","u":"not(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"IsNot","l":"not(T)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"not(T)"},{"p":"org.hamcrest","c":"Matchers","l":"not(T)"},{"p":"org.hamcrest","c":"Matchers","l":"notANumber()"},{"p":"org.hamcrest.number","c":"IsNaN","l":"notANumber()"},{"p":"org.hamcrest","c":"Condition","l":"notMatched()"},{"p":"org.hamcrest.core","c":"IsNull","l":"notNullValue()"},{"p":"org.hamcrest","c":"CoreMatchers","l":"notNullValue()"},{"p":"org.hamcrest","c":"Matchers","l":"notNullValue()"},{"p":"org.hamcrest.core","c":"IsNull","l":"notNullValue(Class)","u":"notNullValue(java.lang.Class)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"notNullValue(Class)","u":"notNullValue(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"notNullValue(Class)","u":"notNullValue(java.lang.Class)"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"NullDescription()","u":"%3Cinit%3E()"},{"p":"org.hamcrest.core","c":"IsNull","l":"nullValue()"},{"p":"org.hamcrest","c":"CoreMatchers","l":"nullValue()"},{"p":"org.hamcrest","c":"Matchers","l":"nullValue()"},{"p":"org.hamcrest.core","c":"IsNull","l":"nullValue(Class)","u":"nullValue(java.lang.Class)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"nullValue(Class)","u":"nullValue(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"nullValue(Class)","u":"nullValue(java.lang.Class)"},{"p":"org.hamcrest.collection","c":"IsIn","l":"oneOf(T...)"},{"p":"org.hamcrest","c":"Matchers","l":"oneOf(T...)"},{"p":"org.hamcrest.optional","c":"OptionalEmpty","l":"OptionalEmpty()","u":"%3Cinit%3E()"},{"p":"org.hamcrest","c":"Matchers","l":"optionalWithValue()"},{"p":"org.hamcrest.optional","c":"OptionalWithValue","l":"optionalWithValue()"},{"p":"org.hamcrest","c":"Matchers","l":"optionalWithValue(Matcher)","u":"optionalWithValue(org.hamcrest.Matcher)"},{"p":"org.hamcrest.optional","c":"OptionalWithValue","l":"optionalWithValue(Matcher)","u":"optionalWithValue(org.hamcrest.Matcher)"},{"p":"org.hamcrest.optional","c":"OptionalWithValue","l":"OptionalWithValue(Matcher)","u":"%3Cinit%3E(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"optionalWithValue(T)"},{"p":"org.hamcrest.optional","c":"OptionalWithValue","l":"optionalWithValue(T)"},{"p":"org.hamcrest.core","c":"CombinableMatcher","l":"or(Matcher)","u":"or(org.hamcrest.Matcher)"},{"p":"org.hamcrest.core","c":"CombinableMatcher.CombinableEitherMatcher","l":"or(Matcher)","u":"or(org.hamcrest.Matcher)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor","l":"PropertyAccessor(Object)","u":"%3Cinit%3E(java.lang.Object)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor","l":"propertyDescriptorsFor(Object, Class)","u":"propertyDescriptorsFor(java.lang.Object,java.lang.Class)"},{"p":"org.hamcrest.beans","c":"PropertyUtil","l":"propertyDescriptorsFor(Object, Class)","u":"propertyDescriptorsFor(java.lang.Object,java.lang.Class)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor.PropertyReadLens","l":"PropertyReadLens(String, Method)","u":"%3Cinit%3E(java.lang.String,java.lang.reflect.Method)"},{"p":"org.hamcrest.beans","c":"PropertyAccessor","l":"readLenses()"},{"p":"org.hamcrest.beans","c":"PropertyAccessor","l":"readLensFor(String)","u":"readLensFor(java.lang.String)"},{"p":"org.hamcrest.core","c":"IsSame","l":"sameInstance(T)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"sameInstance(T)"},{"p":"org.hamcrest","c":"Matchers","l":"sameInstance(T)"},{"p":"org.hamcrest.beans","c":"SamePropertyValuesAs","l":"samePropertyValuesAs(B, String...)","u":"samePropertyValuesAs(B,java.lang.String...)"},{"p":"org.hamcrest","c":"Matchers","l":"samePropertyValuesAs(B, String...)","u":"samePropertyValuesAs(B,java.lang.String...)"},{"p":"org.hamcrest.beans","c":"SamePropertyValuesAs","l":"SamePropertyValuesAs(T, List)","u":"%3Cinit%3E(T,java.util.List)"},{"p":"org.hamcrest.core","c":"StringStartsWith","l":"startsWith(String)","u":"startsWith(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"startsWith(String)","u":"startsWith(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"startsWith(String)","u":"startsWith(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringStartsWith","l":"startsWithIgnoringCase(String)","u":"startsWithIgnoringCase(java.lang.String)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"startsWithIgnoringCase(String)","u":"startsWithIgnoringCase(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"startsWithIgnoringCase(String)","u":"startsWithIgnoringCase(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringContains","l":"StringContains(boolean, String)","u":"%3Cinit%3E(boolean,java.lang.String)"},{"p":"org.hamcrest.core","c":"StringContains","l":"StringContains(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"stringContainsInOrder(Iterable)","u":"stringContainsInOrder(java.lang.Iterable)"},{"p":"org.hamcrest.text","c":"StringContainsInOrder","l":"stringContainsInOrder(Iterable)","u":"stringContainsInOrder(java.lang.Iterable)"},{"p":"org.hamcrest.text","c":"StringContainsInOrder","l":"StringContainsInOrder(Iterable)","u":"%3Cinit%3E(java.lang.Iterable)"},{"p":"org.hamcrest","c":"Matchers","l":"stringContainsInOrder(String...)","u":"stringContainsInOrder(java.lang.String...)"},{"p":"org.hamcrest.text","c":"StringContainsInOrder","l":"stringContainsInOrder(String...)","u":"stringContainsInOrder(java.lang.String...)"},{"p":"org.hamcrest","c":"StringDescription","l":"StringDescription()","u":"%3Cinit%3E()"},{"p":"org.hamcrest","c":"StringDescription","l":"StringDescription(Appendable)","u":"%3Cinit%3E(java.lang.Appendable)"},{"p":"org.hamcrest.core","c":"StringEndsWith","l":"StringEndsWith(boolean, String)","u":"%3Cinit%3E(boolean,java.lang.String)"},{"p":"org.hamcrest.core","c":"StringEndsWith","l":"StringEndsWith(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest.core","c":"StringRegularExpression","l":"StringRegularExpression(Pattern)","u":"%3Cinit%3E(java.util.regex.Pattern)"},{"p":"org.hamcrest.core","c":"StringStartsWith","l":"StringStartsWith(boolean, String)","u":"%3Cinit%3E(boolean,java.lang.String)"},{"p":"org.hamcrest.core","c":"StringStartsWith","l":"StringStartsWith(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"org.hamcrest.text","c":"IsEqualCompressingWhiteSpace","l":"stripSpaces(String)","u":"stripSpaces(java.lang.String)"},{"p":"org.hamcrest.core","c":"SubstringMatcher","l":"substring"},{"p":"org.hamcrest.core","c":"SubstringMatcher","l":"SubstringMatcher(String, boolean, String)","u":"%3Cinit%3E(java.lang.String,boolean,java.lang.String)"},{"p":"org.hamcrest.core","c":"IsSame","l":"theInstance(T)"},{"p":"org.hamcrest","c":"CoreMatchers","l":"theInstance(T)"},{"p":"org.hamcrest","c":"Matchers","l":"theInstance(T)"},{"p":"org.hamcrest","c":"Condition","l":"then(Condition.Step)","u":"then(org.hamcrest.Condition.Step)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"throwsException()"},{"p":"org.hamcrest","c":"Matchers","l":"throwsException()"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"throwsException(Class)","u":"throwsException(java.lang.Class)"},{"p":"org.hamcrest","c":"Matchers","l":"throwsException(Class)","u":"throwsException(java.lang.Class)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"throwsException(Class, Matcher)","u":"throwsException(java.lang.Class,org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"throwsException(Class, Matcher)","u":"throwsException(java.lang.Class,org.hamcrest.Matcher)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"throwsException(Class, String)","u":"throwsException(java.lang.Class,java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"throwsException(Class, String)","u":"throwsException(java.lang.Class,java.lang.String)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"ThrowsException(IsInstanceOf, Matcher)","u":"%3Cinit%3E(org.hamcrest.core.IsInstanceOf,org.hamcrest.Matcher)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"throwsException(U)"},{"p":"org.hamcrest","c":"Matchers","l":"throwsException(U)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"throwsExceptionWithMessage(Matcher)","u":"throwsExceptionWithMessage(org.hamcrest.Matcher)"},{"p":"org.hamcrest","c":"Matchers","l":"throwsExceptionWithMessage(Matcher)","u":"throwsExceptionWithMessage(org.hamcrest.Matcher)"},{"p":"org.hamcrest.exception","c":"ThrowsException","l":"throwsExceptionWithMessage(String)","u":"throwsExceptionWithMessage(java.lang.String)"},{"p":"org.hamcrest","c":"Matchers","l":"throwsExceptionWithMessage(String)","u":"throwsExceptionWithMessage(java.lang.String)"},{"p":"org.hamcrest","c":"BaseMatcher","l":"toString()"},{"p":"org.hamcrest","c":"Description.NullDescription","l":"toString()"},{"p":"org.hamcrest","c":"StringDescription","l":"toString()"},{"p":"org.hamcrest","c":"StringDescription","l":"toString(SelfDescribing)","u":"toString(org.hamcrest.SelfDescribing)"},{"p":"org.hamcrest","c":"Matchers","l":"typeCompatibleWith(Class)","u":"typeCompatibleWith(java.lang.Class)"},{"p":"org.hamcrest.object","c":"IsCompatibleType","l":"typeCompatibleWith(Class)","u":"typeCompatibleWith(java.lang.Class)"},{"p":"org.hamcrest","c":"TypeSafeDiagnosingMatcher","l":"TypeSafeDiagnosingMatcher()","u":"%3Cinit%3E()"},{"p":"org.hamcrest","c":"TypeSafeDiagnosingMatcher","l":"TypeSafeDiagnosingMatcher(Class)","u":"%3Cinit%3E(java.lang.Class)"},{"p":"org.hamcrest","c":"TypeSafeDiagnosingMatcher","l":"TypeSafeDiagnosingMatcher(ReflectiveTypeFinder)","u":"%3Cinit%3E(org.hamcrest.internal.ReflectiveTypeFinder)"},{"p":"org.hamcrest","c":"TypeSafeMatcher","l":"TypeSafeMatcher()","u":"%3Cinit%3E()"},{"p":"org.hamcrest","c":"TypeSafeMatcher","l":"TypeSafeMatcher(Class)","u":"%3Cinit%3E(java.lang.Class)"},{"p":"org.hamcrest","c":"TypeSafeMatcher","l":"TypeSafeMatcher(ReflectiveTypeFinder)","u":"%3Cinit%3E(org.hamcrest.internal.ReflectiveTypeFinder)"},{"p":"org.hamcrest.comparator","c":"ComparatorMatcherBuilder","l":"usingNaturalOrdering()"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/javadoc/4.0/module-search-index.js b/docs/javadoc/4.0/module-search-index.js new file mode 100644 index 00000000..0d59754f --- /dev/null +++ b/docs/javadoc/4.0/module-search-index.js @@ -0,0 +1 @@ +moduleSearchIndex = [];updateSearchResults(); \ No newline at end of file diff --git a/docs/javadoc/4.0/org/hamcrest/BaseDescription.html b/docs/javadoc/4.0/org/hamcrest/BaseDescription.html new file mode 100644 index 00000000..256e2b25 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/BaseDescription.html @@ -0,0 +1,411 @@ + + + + +BaseDescription (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class BaseDescription

+
+
java.lang.Object +
org.hamcrest.BaseDescription
+
+
+
+
+
All Implemented Interfaces:
+
Description
+
+
+
Direct Known Subclasses:
+
StringDescription
+
+
+
public abstract class BaseDescription +extends Object +implements Description
+
A Description that is stored as a string.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      BaseDescription

      +
      +
      public BaseDescription()
      +
      Default constructor
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      appendText

      +
      +
      public Description appendText(String text)
      +
      Description copied from interface: Description
      +
      Appends some plain text to the description.
      +
      +
      Specified by:
      +
      appendText in interface Description
      +
      Parameters:
      +
      text - the text to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      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
      +
      Parameters:
      +
      value - the value to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValue

      +
      +
      public Description appendValue(Object value)
      +
      Description copied from interface: Description
      +
      Appends an arbitrary value to the description.
      +
      +
      Specified by:
      +
      appendValue in interface Description
      +
      Parameters:
      +
      value - the object to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValueList

      +
      +
      @SafeVarargs +public final <T> Description appendValueList(String start, + String separator, + String end, + T... values)
      +
      Description copied from interface: Description
      +
      Appends a list of values to the description.
      +
      +
      Specified by:
      +
      appendValueList in interface Description
      +
      Type Parameters:
      +
      T - the description type.
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValueList

      +
      +
      public <T> Description appendValueList(String start, + String separator, + String end, + Iterable<T> values)
      +
      Description copied from interface: Description
      +
      Appends a list of values to the description.
      +
      +
      Specified by:
      +
      appendValueList in interface Description
      +
      Type Parameters:
      +
      T - the description type.
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendList

      +
      +
      public Description appendList(String start, + String separator, + String end, + Iterable<? extends SelfDescribing> values)
      +
      Description copied from interface: Description
      +
      Appends a list of SelfDescribing objects + to the description.
      +
      +
      Specified by:
      +
      appendList in interface Description
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      append

      +
      +
      protected void append(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.
      +
      +
      Parameters:
      +
      str - the string to append.
      +
      +
      +
      +
    • +
    • +
      +

      append

      +
      +
      protected abstract void append(char c)
      +
      Append the char c to the description.
      +
      +
      Parameters:
      +
      c - the char to append.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/BaseMatcher.html b/docs/javadoc/4.0/org/hamcrest/BaseMatcher.html new file mode 100644 index 00000000..9268683f --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/BaseMatcher.html @@ -0,0 +1,290 @@ + + + + +BaseMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class BaseMatcher<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T>
+
+
+
+
+
Type Parameters:
+
T - The Matcher type.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
+
AnyOf, CustomMatcher, DescribedAs, DiagnosingMatcher, Is, IsAnything, IsEqual, IsIn, IsNot, IsNull, IsSame, TypeSafeDiagnosingMatcher, TypeSafeMatcher
+
+
+
public abstract class BaseMatcher<T> +extends Object +implements Matcher<T>
+
BaseClass for all Matcher implementations.
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      BaseMatcher

      +
      +
      public BaseMatcher()
      +
      Default constructor.
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      _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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatch

      +
      +
      public void describeMismatch(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 String toString()
      +
      +
      Overrides:
      +
      toString in class Object
      +
      +
      +
      +
    • +
    • +
      +

      isNotNull

      +
      +
      protected static boolean isNotNull(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/4.0/org/hamcrest/Condition.Step.html b/docs/javadoc/4.0/org/hamcrest/Condition.Step.html new file mode 100644 index 00000000..ba721863 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/Condition.Step.html @@ -0,0 +1,158 @@ + + + + +Condition.Step (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Interface Condition.Step<I,O>

+
+
+
+
+
Type Parameters:
+
I - the initial value type
+
O - the next step value type
+
+
+
Enclosing class:
+
Condition<T>
+
+
+
Functional Interface:
+
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
+
+
+
@FunctionalInterface +public static interface Condition.Step<I,O>
+
Represents a single step in a multi-step sequence
+
+
+
+
    + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    + +
    apply(I value, + Description mismatch)
    +
    +
    Apply this condition to a value
    +
    +
    +
    +
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      apply

      +
      +
      Condition<O> apply(I value, + Description mismatch)
      +
      Apply this condition to a value
      +
      +
      Parameters:
      +
      value - the value to match
      +
      mismatch - the description for mismatches
      +
      Returns:
      +
      the next condition
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/Condition.html b/docs/javadoc/4.0/org/hamcrest/Condition.html new file mode 100644 index 00000000..1deed2ab --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/Condition.html @@ -0,0 +1,294 @@ + + + + +Condition (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class Condition<T>

+
+
java.lang.Object +
org.hamcrest.Condition<T>
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
public abstract class Condition<T> +extends 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 Nat Pryce's maybe-java. +

+
+
+
+
    + +
  • +
    +

    Nested Class Summary

    +
    Nested Classes
    +
    +
    Modifier and Type
    +
    Class
    +
    Description
    +
    static interface 
    + +
    +
    Represents a single step in a multi-step sequence
    +
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    abstract <U> Condition<U>
    +
    and(Condition.Step<? super T,U> mapping)
    +
    +
    Applies the mapping to the current value in the sequence
    +
    +
    static <T> Condition<T>
    +
    matched(T theValue, + Description mismatch)
    +
    +
    Called by steps when a match occurs
    +
    +
    final boolean
    +
    matching(Matcher<T> match)
    +
    +
    Applies the matcher as the final step in the sequence
    +
    +
    abstract boolean
    +
    matching(Matcher<T> match, + String message)
    +
    +
    Applies the matcher as the final step in the sequence
    +
    +
    static <T> Condition<T>
    + +
    +
    Called by steps when a mismatch occurs.
    +
    +
    final <U> Condition<U>
    +
    then(Condition.Step<? super T,U> mapping)
    +
    +
    An alias for and(Step), which applies the mapping to the current value in the + sequence.
    +
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matching

      +
      +
      public abstract boolean matching(Matcher<T> match, + String message)
      +
      Applies the matcher as the final step in the sequence
      +
      +
      Parameters:
      +
      match - the value matcher
      +
      message - a description of the value
      +
      Returns:
      +
      true if the matcher matches the value, otherwise false
      +
      +
      +
      +
    • +
    • +
      +

      matching

      +
      +
      public final boolean matching(Matcher<T> match)
      +
      Applies the matcher as the final step in the sequence
      +
      +
      Parameters:
      +
      match - the value matcher
      +
      Returns:
      +
      true if the matcher matches the value, otherwise false
      +
      +
      +
      +
    • +
    • +
      +

      and

      +
      +
      public abstract <U> Condition<U> and(Condition.Step<? super T,U> mapping)
      +
      Applies the mapping to the current value in the sequence
      +
      +
      Type Parameters:
      +
      U - the type of the next value
      +
      Parameters:
      +
      mapping - the current step in the sequence
      +
      Returns:
      +
      the condition for the next step in the sequence
      +
      +
      +
      +
    • +
    • +
      +

      then

      +
      +
      public final <U> Condition<U> then(Condition.Step<? super T,U> mapping)
      +
      An alias for and(Step), which applies the mapping to the current value in the + sequence.
      +
      +
      Type Parameters:
      +
      U - the type of the next value
      +
      Parameters:
      +
      mapping - the current step in the sequence
      +
      Returns:
      +
      the condition for the next step in the sequence
      +
      +
      +
      +
    • +
    • +
      +

      notMatched

      +
      +
      public static <T> Condition<T> notMatched()
      +
      Called by steps when a mismatch occurs.
      +
      +
      Type Parameters:
      +
      T - the type of the unmatched value
      +
      Returns:
      +
      a condition in the not matched state
      +
      +
      +
      +
    • +
    • +
      +

      matched

      +
      +
      public static <T> Condition<T> matched(T theValue, + Description mismatch)
      +
      Called by steps when a match occurs
      +
      +
      Type Parameters:
      +
      T - the type of the matched value
      +
      Parameters:
      +
      theValue - the value that was matched
      +
      mismatch - a description for potential future mismatches
      +
      Returns:
      +
      the condition in a matched state
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/CoreMatchers.html b/docs/javadoc/4.0/org/hamcrest/CoreMatchers.html new file mode 100644 index 00000000..18c402d8 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/CoreMatchers.html @@ -0,0 +1,1119 @@ + + + + +CoreMatchers (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class CoreMatchers

+
+
java.lang.Object +
org.hamcrest.CoreMatchers
+
+
+
+
+
public class CoreMatchers +extends Object
+
Builder methods for various matchers. +

+ CodeMatchers provides syntactic sugar for building matchers, or + chains of matchers. By using static imports on these methods, concise and + readable code calling the matchers can be maintained. +

+
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    + +
    +
    Unused
    +
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    static <T> Matcher<T>
    +
    allOf(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(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 + examined object.
    +
    +
    static <T> AnyOf<T>
    +
    anyOf(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<Object>
    + +
    +
    Creates a matcher that always matches, regardless of the examined object.
    +
    +
    static Matcher<Object>
    +
    anything(String description)
    +
    +
    Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String.
    +
    + +
    both(Matcher<? super LHS> matcher)
    +
    +
    Creates a matcher that matches when both of the specified matchers match the examined object.
    +
    +
    static Matcher<String>
    + +
    +
    Creates a matcher that matches if the examined String contains the specified + String anywhere.
    +
    +
    static Matcher<String>
    + +
    +
    Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
    +
    +
    static <T> Matcher<T>
    +
    describedAs(String description, + Matcher<T> matcher, + Object... values)
    +
    +
    Wraps an existing matcher, overriding its description with that specified.
    +
    + +
    either(Matcher<? super LHS> matcher)
    +
    +
    Creates a matcher that matches when either of the specified matchers match the examined object.
    +
    +
    static Matcher<String>
    +
    endsWith(String suffix)
    +
    +
    Creates a matcher that matches if the examined String ends with the specified + String.
    +
    +
    static Matcher<String>
    + +
    +
    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<Object>
    + +
    +
    Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
    +
    +
    static <U> Matcher<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<Iterable<? extends 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<Iterable<? extends 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<Iterable<? extends 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<Iterable<? extends 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(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(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<Object>
    + +
    +
    A shortcut to the frequently used not(nullValue()).
    +
    +
    static <T> Matcher<T>
    + +
    +
    A shortcut to the frequently used not(nullValue(X.class)).
    +
    +
    static Matcher<Object>
    + +
    +
    Creates a matcher that matches if examined object is null.
    +
    +
    static <T> Matcher<T>
    +
    nullValue(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<String>
    + +
    +
    + Creates a matcher that matches if the examined String starts with the specified + String.
    +
    +
    static Matcher<String>
    + +
    +
    + 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 Details

    +
      +
    • +
      +

      CoreMatchers

      +
      +
      public CoreMatchers()
      +
      Unused
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      allOf

      +
      +
      public static <T> Matcher<T> allOf(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - all the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - all the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anyOf

      +
      +
      public static <T> AnyOf<T> anyOf(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - any the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - any the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      LHS - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to combine, and both must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      LHS - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to combine, and either must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describedAs

      +
      +
      public static <T> Matcher<T> describedAs(String description, + Matcher<T> matcher, + 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())
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      description - the new description for the wrapped matcher
      +
      matcher - the matcher to wrap
      +
      values - optional values to insert into the tokenized description
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      everyItem

      +
      +
      public static <U> Matcher<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")))
      +
      +
      Type Parameters:
      +
      U - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher to apply to every item provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to wrap.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isA

      +
      +
      public static <T> Matcher<T> isA(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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anything

      +
      +
      public static Matcher<Object> anything()
      +
      Creates a matcher that always matches, regardless of the examined object.
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anything

      +
      +
      public static Matcher<Object> anything(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItem

      +
      +
      public static <T> Matcher<Iterable<? extends 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItem

      +
      +
      public static <T> Matcher<Iterable<? extends 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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      item - the item to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @SafeVarargs +public static <T> Matcher<Iterable<? extends 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @SafeVarargs +public static <T> Matcher<Iterable<? extends 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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      items - the items to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"}));
      + 
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      operand - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      equalToObject

      +
      +
      public static Matcher<Object> equalToObject(Object operand)
      +
      Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
      +
      +
      Parameters:
      +
      operand - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      any

      +
      +
      public static <T> Matcher<T> any(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 + 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(), any(Canoe.class));
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      instanceOf

      +
      +
      public static <T> Matcher<T> instanceOf(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));
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher whose sense should be inverted
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value that any examined object should not equal
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      notNullValue

      +
      +
      public static Matcher<Object> notNullValue()
      +
      A shortcut to the frequently used not(nullValue()). + For example: +
      assertThat(cheese, is(notNullValue()))
      + instead of: +
      assertThat(cheese, is(not(nullValue())))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      notNullValue

      +
      +
      public static <T> Matcher<T> notNullValue(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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - dummy parameter used to infer the generic type of the returned matcher
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      nullValue

      +
      +
      public static Matcher<Object> nullValue()
      +
      Creates a matcher that matches if examined object is null. + For example: +
      assertThat(cheese, is(nullValue())
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      nullValue

      +
      +
      public static <T> Matcher<T> nullValue(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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - dummy parameter used to infer the generic type of the returned matcher
      +
      Returns:
      +
      The 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.
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      target - the target instance against which others should be assessed
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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.
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      target - the target instance against which others should be assessed
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsString

      +
      +
      public static Matcher<String> containsString(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsStringIgnoringCase

      +
      +
      public static Matcher<String> containsStringIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      startsWith

      +
      +
      public static Matcher<String> startsWith(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      startsWithIgnoringCase

      +
      +
      public static Matcher<String> startsWithIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      endsWith

      +
      +
      public static Matcher<String> endsWith(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      endsWithIgnoringCase

      +
      +
      public static Matcher<String> endsWithIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/CustomMatcher.html b/docs/javadoc/4.0/org/hamcrest/CustomMatcher.html new file mode 100644 index 00000000..f3288f07 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/CustomMatcher.html @@ -0,0 +1,227 @@ + + + + +CustomMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class CustomMatcher<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
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. See CustomTypeSafeMatcher for a type safe variant of + this class that you probably want to use.

+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      CustomMatcher

      +
      +
      public CustomMatcher(String description)
      +
      Constructor
      +
      +
      Parameters:
      +
      description - the description of this matcher
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      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 + 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/4.0/org/hamcrest/CustomTypeSafeMatcher.html b/docs/javadoc/4.0/org/hamcrest/CustomTypeSafeMatcher.html new file mode 100644 index 00000000..52ab9b74 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/CustomTypeSafeMatcher.html @@ -0,0 +1,222 @@ + + + + +CustomTypeSafeMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class CustomTypeSafeMatcher<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T> +
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 (with type safety and null checks). + 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 + called the argument is guaranteed to be non-null and of the correct type.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      CustomTypeSafeMatcher

      +
      +
      public CustomTypeSafeMatcher(String description)
      +
      Constructor
      +
      +
      Parameters:
      +
      description - the description of this matcher
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      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 + 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/4.0/org/hamcrest/Description.NullDescription.html b/docs/javadoc/4.0/org/hamcrest/Description.NullDescription.html new file mode 100644 index 00000000..43426f8e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/Description.NullDescription.html @@ -0,0 +1,387 @@ + + + + +Description.NullDescription (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class Description.NullDescription

+
+
java.lang.Object +
org.hamcrest.Description.NullDescription
+
+
+
+
+
All Implemented Interfaces:
+
Description
+
+
+
Enclosing interface:
+
Description
+
+
+
public static final class Description.NullDescription +extends Object +implements Description
+
A description that consumes input but does nothing.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      NullDescription

      +
      +
      public NullDescription()
      +
      Constructor.
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      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
      +
      Parameters:
      +
      value - the value to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendList

      +
      +
      public Description appendList(String start, + String separator, + String end, + Iterable<? extends SelfDescribing> values)
      +
      Description copied from interface: Description
      +
      Appends a list of SelfDescribing objects + to the description.
      +
      +
      Specified by:
      +
      appendList in interface Description
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendText

      +
      +
      public Description appendText(String text)
      +
      Description copied from interface: Description
      +
      Appends some plain text to the description.
      +
      +
      Specified by:
      +
      appendText in interface Description
      +
      Parameters:
      +
      text - the text to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValue

      +
      +
      public Description appendValue(Object value)
      +
      Description copied from interface: Description
      +
      Appends an arbitrary value to the description.
      +
      +
      Specified by:
      +
      appendValue in interface Description
      +
      Parameters:
      +
      value - the object to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValueList

      +
      +
      public <T> Description appendValueList(String start, + String separator, + String end, + T... values)
      +
      Description copied from interface: Description
      +
      Appends a list of values to the description.
      +
      +
      Specified by:
      +
      appendValueList in interface Description
      +
      Type Parameters:
      +
      T - the description type.
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValueList

      +
      +
      public <T> Description appendValueList(String start, + String separator, + String end, + Iterable<T> values)
      +
      Description copied from interface: Description
      +
      Appends a list of values to the description.
      +
      +
      Specified by:
      +
      appendValueList in interface Description
      +
      Type Parameters:
      +
      T - the description type.
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      toString

      +
      +
      public String toString()
      +
      +
      Overrides:
      +
      toString in class Object
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/Description.html b/docs/javadoc/4.0/org/hamcrest/Description.html new file mode 100644 index 00000000..a17d35ac --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/Description.html @@ -0,0 +1,351 @@ + + + + +Description (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

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:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      appendText

      +
      +
      Description appendText(String text)
      +
      Appends some plain text to the description.
      +
      +
      Parameters:
      +
      text - the text to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendDescriptionOf

      +
      +
      Description appendDescriptionOf(SelfDescribing value)
      +
      Appends the description of a SelfDescribing value to this description.
      +
      +
      Parameters:
      +
      value - the value to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValue

      +
      +
      Description appendValue(Object value)
      +
      Appends an arbitrary value to the description.
      +
      +
      Parameters:
      +
      value - the object to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValueList

      +
      +
      <T> Description appendValueList(String start, + String separator, + String end, + T... values)
      +
      Appends a list of values to the description.
      +
      +
      Type Parameters:
      +
      T - the description type.
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendValueList

      +
      +
      <T> Description appendValueList(String start, + String separator, + String end, + Iterable<T> values)
      +
      Appends a list of values to the description.
      +
      +
      Type Parameters:
      +
      T - the description type.
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    • +
      +

      appendList

      +
      +
      Description appendList(String start, + String separator, + String end, + Iterable<? extends SelfDescribing> values)
      +
      Appends a list of SelfDescribing objects + to the description.
      +
      +
      Parameters:
      +
      start - the prefix.
      +
      separator - the separator.
      +
      end - the suffix.
      +
      values - the values to append.
      +
      Returns:
      +
      the update description when displaying the matcher error.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/DiagnosingMatcher.html b/docs/javadoc/4.0/org/hamcrest/DiagnosingMatcher.html new file mode 100644 index 00000000..f7c4bfb5 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/DiagnosingMatcher.html @@ -0,0 +1,286 @@ + + + + +DiagnosingMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class DiagnosingMatcher<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.DiagnosingMatcher<T>
+
+
+
+
+
+
Type Parameters:
+
T - the type of matcher being diagnosed.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
+
AllOf, IsInstanceOf, SamePropertyValuesAs
+
+
+
public abstract class DiagnosingMatcher<T> +extends BaseMatcher<T>
+
Convenient base class for Matchers of a specific type and that will report why the + received value has been rejected. + + Unlike the TypeSafeDiagnosingMatcher, this does not implement the null check + or validate the type, so subclasses need to be prepared to handle these conditions. + + To use, implement matches(Object, Description)
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      DiagnosingMatcher

      +
      +
      public DiagnosingMatcher()
      +
      Constructor
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public final boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatch

      +
      +
      public final void describeMismatch(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(Object item, + Description mismatchDescription)
      +
      Evaluates the matcher for argument item.
      +
      +
      Parameters:
      +
      item - the value to check
      +
      mismatchDescription - the description for the matcher
      +
      Returns:
      +
      true if item matches, otherwise false.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/FeatureMatcher.html b/docs/javadoc/4.0/org/hamcrest/FeatureMatcher.html new file mode 100644 index 00000000..e05dad97 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/FeatureMatcher.html @@ -0,0 +1,312 @@ + + + + +FeatureMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class 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:
+
CharSequenceLength, HasToString, IsArrayWithSize, IsCollectionWithSize, IsIterableWithSize, IsMapWithSize
+
+
+
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 Details

    +
      +
    • +
      +

      FeatureMatcher

      +
      +
      public FeatureMatcher(Matcher<? super U> subMatcher, + String featureDescription, + 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 Details

    +
      +
    • +
      +

      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>
      +
      Parameters:
      +
      actual - the item.
      +
      mismatch - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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 + 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.
      +
      +
      +
      +
    • +
    • +
      +

      matcher

      +
      +
      public static <T, +F> Matcher<T> matcher(Matcher<F> featureMatcher, + Function<T,F> extractor, + String featureDescription, + String featureName, + Class<T> expectedType)
      +
      Create a Matcher that matches a feature of an object. + +

      + Uses the extractor function to pull the feature from the object, and + applies the featureMatcher to that feature. The result of the + featureMatcher call is returned as the result of the created + Matcher. +

      +
      +
      Parameters:
      +
      featureMatcher - the Matcher for the expected feature value
      +
      extractor - Function to extract the feature from the object
      +
      featureDescription - descriptive text to use in describeTo
      +
      featureName - identifying text for mismatch message
      +
      expectedType - expected type to match against
      +
      Returns:
      +
      a Matcher that matches against the feature of the object
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/Matcher.html b/docs/javadoc/4.0/org/hamcrest/Matcher.html new file mode 100644 index 00000000..3fe2b88e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/Matcher.html @@ -0,0 +1,251 @@ + + + + +Matcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Interface Matcher<T>

+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
All Superinterfaces:
+
SelfDescribing
+
+
+
All Known Implementing Classes:
+
AllOf, AnyOf, ArrayAsIterableMatcher, BaseMatcher, BigDecimalCloseTo, CharSequenceLength, CombinableMatcher, CustomMatcher, CustomTypeSafeMatcher, DescribedAs, DiagnosingMatcher, Every, FeatureMatcher, HasEqualValues, HasItemInArray, HasProperty, HasPropertyWithValue, HasToString, HasXPath, Is, IsAnything, IsArray, IsArrayContainingInAnyOrder, IsArrayContainingInOrder, IsArrayWithSize, IsBlankString, IsCloseTo, IsCollectionContaining, IsCollectionWithSize, IsCompatibleType, IsEmptyCollection, IsEmptyIterable, IsEmptyString, IsEqual, IsEqualCompressingWhiteSpace, IsEqualIgnoringCase, IsEventFrom, IsIn, IsInstanceOf, IsIterableContaining, IsIterableContainingInAnyOrder, IsIterableContainingInOrder, IsIterableContainingInRelativeOrder, IsIterableContainingParallelRuns, IsIterableWithSize, IsMapContaining, IsMapWithSize, IsNaN, IsNot, IsNull, IsSame, MatchesPattern, OptionalEmpty, OptionalWithValue, SamePropertyValuesAs, StringContains, StringContainsInOrder, StringEndsWith, StringRegularExpression, StringStartsWith, SubstringMatcher, ThrowsException, 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. +

+

+ 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 Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatch

      +
      +
      void describeMismatch(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:
      +
      + +
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/MatcherAssert.html b/docs/javadoc/4.0/org/hamcrest/MatcherAssert.html new file mode 100644 index 00000000..5786f811 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/MatcherAssert.html @@ -0,0 +1,238 @@ + + + + +MatcherAssert (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class MatcherAssert

+
+
java.lang.Object +
org.hamcrest.MatcherAssert
+
+
+
+
+
public class MatcherAssert +extends Object
+
The Hamcrest entrypoint, static methods to check if matchers match a + given value.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      MatcherAssert

      +
      +
      public MatcherAssert()
      +
      Unused.
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      assertThat

      +
      +
      public static <T> void assertThat(T actual, + Matcher<? super T> matcher)
      +
      Checks that a value matches a matcher
      +
      +
      Type Parameters:
      +
      T - the type of the value
      +
      Parameters:
      +
      actual - the value to check
      +
      matcher - the matcher
      +
      +
      +
      +
    • +
    • +
      +

      assertThat

      +
      +
      public static <T> void assertThat(String reason, + T actual, + Matcher<? super T> matcher)
      +
      Checks that a value matches a matcher
      +
      +
      Type Parameters:
      +
      T - the type of the value
      +
      Parameters:
      +
      reason - a description of what is being matched
      +
      actual - the value to check
      +
      matcher - the matcher
      +
      +
      +
      +
    • +
    • +
      +

      assertThat

      +
      +
      public static void assertThat(String reason, + boolean assertion)
      +
      Checks that an assertion is true
      +
      +
      Parameters:
      +
      reason - a description of what is being checked
      +
      assertion - the result of the check
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/Matchers.html b/docs/javadoc/4.0/org/hamcrest/Matchers.html new file mode 100644 index 00000000..c1e6cd80 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/Matchers.html @@ -0,0 +1,4084 @@ + + + + +Matchers (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class Matchers

+
+
java.lang.Object +
org.hamcrest.Matchers
+
+
+
+
+
public class Matchers +extends Object
+
Builder methods for various matchers. +

+ Matchers provides syntactic sugar for building matchers, or + chains of matchers. By using static imports on these methods, concise and + readable code calling the matchers can be maintained. +

+
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    + +
    +
    Unused
    +
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    static <T> Matcher<T>
    +
    allOf(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<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<Map<? extends K,? extends V>>
    +
    aMapWithSize(Matcher<? super 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<Map<? extends K,? extends V>>
    + +
    +
    Creates a matcher for Maps that matches when the size() method returns + zero.
    +
    +
    static <T> Matcher<T>
    +
    any(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 + examined object.
    +
    +
    static <T> AnyOf<T>
    +
    anyOf(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<? super 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<? super 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<? 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 ANY of the specified matchers.
    +
    +
    static <T> AnyOf<T>
    +
    anyOf(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 ANY of the specified matchers.
    +
    +
    static <T> AnyOf<T>
    +
    anyOf(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 ANY of the specified matchers.
    +
    +
    static Matcher<Object>
    + +
    +
    Creates a matcher that always matches, regardless of the examined object.
    +
    +
    static Matcher<Object>
    +
    anything(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(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[]>
    + +
    +
    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(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(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 Integer> sizeMatcher)
    +
    +
    Creates a matcher for arrays that matches when the length of the array + satisfies the specified matcher.
    +
    +
    static Matcher<String>
    + +
    +
    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<String>
    + +
    +
    Creates a matcher of String that matches when the examined string contains + zero or more whitespace characters and nothing else.
    +
    + +
    both(Matcher<? super LHS> matcher)
    +
    +
    Creates a matcher that matches when both of the specified matchers match the examined object.
    +
    +
    static Matcher<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.
    +
    + +
    closeTo(BigDecimal operand, + 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 <T extends 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<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<Iterable<? extends E>>
    +
    contains(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<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 <E> Matcher<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 <T> Matcher<Iterable<? extends T>>
    +
    containsInAnyOrder(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<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<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<Iterable<? extends E>>
    + +
    +
    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<Iterable<? extends E>>
    +
    containsInRelativeOrder(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<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<String>
    + +
    +
    Creates a matcher that matches if the examined String contains the specified + String anywhere.
    +
    +
    static Matcher<String>
    + +
    +
    Creates a matcher that matches if the examined String contains the specified + String anywhere, ignoring case.
    +
    +
    static <T> Matcher<T>
    +
    describedAs(String description, + Matcher<T> matcher, + Object... values)
    +
    +
    Wraps an existing matcher, overriding its description with that specified.
    +
    + +
    either(Matcher<? super LHS> matcher)
    +
    +
    Creates a matcher that matches when either of the specified matchers match the examined object.
    +
    +
    static <E> Matcher<Collection<? extends E>>
    + +
    +
    Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
    +
    +
    static <E> Matcher<E[]>
    + +
    +
    Creates a matcher for arrays that matches when the length of the array + is zero.
    +
    +
    static <E> Matcher<Collection<E>>
    +
    emptyCollectionOf(Class<E> unusedToForceReturnType)
    +
    +
    Creates a matcher for Collections matching examined collections whose isEmpty + method returns true.
    +
    +
    static <E> Matcher<Iterable<? extends E>>
    + +
    +
    Creates a matcher for Iterables matching examined iterables that yield no items.
    +
    +
    static <E> Matcher<Iterable<E>>
    +
    emptyIterableOf(Class<E> unusedToForceReturnType)
    +
    +
    Creates a matcher for Iterables matching examined iterables that yield no items.
    +
    +
    static <T> Matcher<Optional<T>>
    + +
    +
    Matcher that expects empty Optional.
    +
    +
    static Matcher<String>
    + +
    +
    Creates a matcher of String that matches when the examined string is null, or + has zero length.
    +
    +
    static Matcher<String>
    + +
    +
    Creates a matcher of String that matches when the examined string has zero length.
    +
    +
    static Matcher<String>
    +
    endsWith(String suffix)
    +
    +
    Creates a matcher that matches if the examined String ends with the specified + String.
    +
    +
    static Matcher<String>
    + +
    +
    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<String>
    + +
    +
    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<String>
    +
    equalToIgnoringCase(String expectedString)
    +
    +
    Creates a matcher of String that matches when the examined string is equal to + the specified expectedString, ignoring case.
    +
    +
    static Matcher<String>
    + + +
    static Matcher<Object>
    + +
    +
    Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
    +
    + +
    eventFrom(Class<? extends EventObject> eventClass, + Object source)
    +
    +
    Creates a matcher of EventObject that matches any object + derived from eventClass announced by source.
    +
    + +
    eventFrom(Object source)
    +
    +
    Creates a matcher of EventObject that matches any EventObject + announced by source.
    +
    +
    static <U> Matcher<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 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 Comparable<T>>
    Matcher<T>
    + +
    +
    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<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<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<Iterable<? extends 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<Iterable<? extends 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<Iterable<? extends 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<Iterable<? extends 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<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<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.
    +
    + +
    hasLength(int length)
    +
    +
    Creates a matcher of CharSequence that matches when a char sequence has the length + of the specified argument.
    +
    + +
    hasLength(Matcher<? super Integer> lengthMatcher)
    +
    +
    Creates a matcher of CharSequence that matches when a char sequence has the length + that satisfies the specified matcher.
    +
    +
    static <T> Matcher<T>
    +
    hasProperty(String propertyName)
    +
    +
    Creates a matcher that matches when the examined object has a JavaBean property + with the specified name.
    +
    +
    static <T> Matcher<T>
    +
    hasProperty(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<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<Collection<? extends E>>
    +
    hasSize(Matcher<? super 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(String expectedToString)
    +
    +
    Creates a matcher that matches any examined object whose toString method + returns a value equalTo the specified string.
    +
    +
    static <T> Matcher<T>
    +
    hasToString(Matcher<? super String> toStringMatcher)
    +
    +
    Creates a matcher that matches any examined object whose toString method + returns a value that satisfies the specified matcher.
    +
    +
    static <V> Matcher<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<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<Node>
    + +
    +
    Creates a matcher of Nodes that matches when the examined node contains a node + at the specified xPath, with any content.
    +
    +
    static Matcher<Node>
    +
    hasXPath(String xPath, + 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<Node>
    +
    hasXPath(String xPath, + NamespaceContext namespaceContext, + Matcher<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 Matcher<Node>
    +
    hasXPath(String xPath, + Matcher<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 <T> Matcher<T>
    +
    in(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(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(Class<?> type)
    +
    +
    A shortcut to the frequently used is(instanceOf(SomeClass.class)).
    +
    +
    static Matcher<String>
    + +
    +
    Deprecated. +
    use is(emptyOrNullString()) instead
    +
    +
    +
    static Matcher<String>
    + +
    +
    Deprecated. +
    use is(emptyString()) instead
    +
    +
    +
    static <T> Matcher<T>
    +
    isIn(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<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<Iterable<E>>
    +
    iterableWithSize(Matcher<? super 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 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 Comparable<T>>
    Matcher<T>
    + +
    +
    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<String>
    + +
    +
    Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
    +
    +
    static Matcher<String>
    + +
    +
    Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
    +
    +
    static Matcher<String>
    + +
    +
    Validate a string with a regex.
    +
    +
    static Matcher<String>
    + +
    +
    Validate a string with 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<Double>
    + +
    +
    Creates a matcher of Doubles that matches when an examined double is not a number.
    +
    +
    static Matcher<Object>
    + +
    +
    A shortcut to the frequently used not(nullValue()).
    +
    +
    static <T> Matcher<T>
    + +
    +
    A shortcut to the frequently used not(nullValue(X.class)).
    +
    +
    static Matcher<Object>
    + +
    +
    Creates a matcher that matches if examined object is null.
    +
    +
    static <T> Matcher<T>
    +
    nullValue(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<Optional<T>>
    + +
    +
    Matcher for Optional that expects that value is present.
    +
    +
    static <T> Matcher<Optional<T>>
    +
    optionalWithValue(Matcher<? super T> matcher)
    +
    +
    Matcher for Optional that expects that value is present and matches matcher
    +
    +
    static <T> Matcher<Optional<T>>
    + +
    +
    Matcher for Optional that expects that value is present and is equal to value
    +
    +
    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, + 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<String>
    + +
    +
    + Creates a matcher that matches if the examined String starts with the specified + String.
    +
    +
    static Matcher<String>
    + +
    +
    + Creates a matcher that matches if the examined String starts with the specified + String, ignoring case
    +
    +
    static Matcher<String>
    + +
    +
    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<String>
    + +
    +
    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 extends Runnable>
    Matcher<T>
    + +
    +
    Matcher for Runnable that expects an exception to be thrown
    +
    +
    static <T extends Runnable, +U extends Throwable>
    Matcher<T>
    +
    throwsException(Class<U> throwableClass)
    +
    +
    Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class
    +
    +
    static <T extends Runnable, +U extends Throwable>
    Matcher<T>
    +
    throwsException(Class<U> throwableClass, + String message)
    +
    +
    Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class and has a message equal to the provided message
    +
    +
    static <T extends Runnable, +U extends Throwable>
    Matcher<T>
    +
    throwsException(Class<U> throwableClass, + Matcher<String> messageMatcher)
    +
    +
    Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class and has a message matching the provided messageMatcher
    +
    +
    static <T extends Runnable, +U extends Throwable>
    Matcher<T>
    +
    throwsException(U throwable)
    +
    +
    Matcher for Throwable that expects that the Runnable throws an exception equal to the provided throwable
    +
    +
    static <T extends Runnable>
    Matcher<T>
    + +
    +
    Matcher for Throwable that expects that the Runnable throws an exception with a message equal to the provided message
    +
    +
    static <T extends Runnable>
    Matcher<T>
    + +
    +
    Matcher for Throwable that expects that the Runnable throws an exception with a message matching the provided messageMatcher
    +
    +
    static <T> Matcher<Class<?>>
    + +
    +
    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 Details

    +
      +
    • +
      +

      Matchers

      +
      +
      public Matchers()
      +
      Unused
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      allOf

      +
      +
      public static <T> Matcher<T> allOf(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - all the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - all the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher that must pass.
      +
      second - second matcher that must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher that must pass.
      +
      second - second matcher that must pass.
      +
      third - third matcher that must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher that must pass.
      +
      second - second matcher that must pass.
      +
      third - third matcher that must pass.
      +
      fourth - fourth matcher that must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher that must pass.
      +
      second - second matcher that must pass.
      +
      third - third matcher that must pass.
      +
      fourth - fourth matcher that must pass.
      +
      fifth - fifth matcher that must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher that must pass.
      +
      second - second matcher that must pass.
      +
      third - third matcher that must pass.
      +
      fourth - fourth matcher that must pass.
      +
      fifth - fifth matcher that must pass.
      +
      sixth - sixth matcher that must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anyOf

      +
      +
      public static <T> AnyOf<T> anyOf(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - any the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - any the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anyOf

      +
      +
      public static <T> AnyOf<T> anyOf(Matcher<? super 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher to check.
      +
      second - second matcher to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anyOf

      +
      +
      public static <T> AnyOf<T> anyOf(Matcher<? super 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher to check.
      +
      second - second matcher to check.
      +
      third - third matcher to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anyOf

      +
      +
      public static <T> AnyOf<T> anyOf(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 ANY of the specified matchers. + For example: +
      assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher to check.
      +
      second - second matcher to check.
      +
      third - third matcher to check.
      +
      fourth - fourth matcher to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anyOf

      +
      +
      public static <T> AnyOf<T> anyOf(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 ANY of the specified matchers. + For example: +
      assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher to check.
      +
      second - second matcher to check.
      +
      third - third matcher to check.
      +
      fourth - fourth matcher to check.
      +
      fifth - fifth matcher to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anyOf

      +
      +
      public static <T> AnyOf<T> anyOf(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 ANY of the specified matchers. + For example: +
      assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      first - first matcher to check.
      +
      second - second matcher to check.
      +
      third - third matcher to check.
      +
      fourth - fourth matcher to check.
      +
      fifth - fifth matcher to check.
      +
      sixth - sixth matcher to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      LHS - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to combine, and both must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      LHS - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to combine, and either must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describedAs

      +
      +
      public static <T> Matcher<T> describedAs(String description, + Matcher<T> matcher, + 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())
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      description - the new description for the wrapped matcher
      +
      matcher - the matcher to wrap
      +
      values - optional values to insert into the tokenized description
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      everyItem

      +
      +
      public static <U> Matcher<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")))
      +
      +
      Type Parameters:
      +
      U - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher to apply to every item provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to wrap.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isA

      +
      +
      public static <T> Matcher<T> isA(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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anything

      +
      +
      public static Matcher<Object> anything()
      +
      Creates a matcher that always matches, regardless of the examined object.
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anything

      +
      +
      public static Matcher<Object> anything(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItem

      +
      +
      public static <T> Matcher<Iterable<? extends 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItem

      +
      +
      public static <T> Matcher<Iterable<? extends 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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      item - the item to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @SafeVarargs +public static <T> Matcher<Iterable<? extends 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @SafeVarargs +public static <T> Matcher<Iterable<? extends 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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      items - the items to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"}));
      + 
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      operand - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      equalToObject

      +
      +
      public static Matcher<Object> equalToObject(Object operand)
      +
      Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
      +
      +
      Parameters:
      +
      operand - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      any

      +
      +
      public static <T> Matcher<T> any(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 + 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));
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      instanceOf

      +
      +
      public static <T> Matcher<T> instanceOf(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));
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher whose sense should be inverted
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value that any examined object should not equal
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      notNullValue

      +
      +
      public static Matcher<Object> notNullValue()
      +
      A shortcut to the frequently used not(nullValue()). + For example: +
      assertThat(cheese, is(notNullValue()))
      + instead of: +
      assertThat(cheese, is(not(nullValue())))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      notNullValue

      +
      +
      public static <T> Matcher<T> notNullValue(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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - dummy parameter used to infer the generic type of the returned matcher
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      nullValue

      +
      +
      public static Matcher<Object> nullValue()
      +
      Creates a matcher that matches if examined object is null. + For example: +
      assertThat(cheese, is(nullValue())
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      nullValue

      +
      +
      public static <T> Matcher<T> nullValue(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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - dummy parameter used to infer the generic type of the returned matcher
      +
      Returns:
      +
      The 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.
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      target - the target instance against which others should be assessed
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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.
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      target - the target instance against which others should be assessed
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsString

      +
      +
      public static Matcher<String> containsString(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsStringIgnoringCase

      +
      +
      public static Matcher<String> containsStringIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      startsWith

      +
      +
      public static Matcher<String> startsWith(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      startsWithIgnoringCase

      +
      +
      public static Matcher<String> startsWithIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      endsWith

      +
      +
      public static Matcher<String> endsWith(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      endsWithIgnoringCase

      +
      +
      public static Matcher<String> endsWithIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesRegex

      +
      +
      public static Matcher<String> matchesRegex(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<String> matchesRegex(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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elementMatchers - the matchers that the elements of examined arrays should satisfy
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elementMatcher - the matcher to apply to elements in examined arrays
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      element - the element that should be present in examined arrays
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the items within an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers that must be satisfied by the items in the examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContaining

      +
      +
      public static <E> Matcher<E[]> arrayContaining(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContainingInAnyOrder

      +
      +
      public static <E> Matcher<E[]> arrayContainingInAnyOrder(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the entries of an examined array, in any order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayWithSize

      +
      +
      public static <E> Matcher<E[]> arrayWithSize(Matcher<? super 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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the length of an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      size - the length that an examined array must have for a positive match
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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())
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      aMapWithSize

      +
      +
      public static <K, +V> +Matcher<Map<? extends K,? extends V>> aMapWithSize(Matcher<? super 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))))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the size of an examined Map
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      aMapWithSize

      +
      +
      public static <K, +V> +Matcher<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)))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      Parameters:
      +
      size - the expected size of an examined Map
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anEmptyMap

      +
      +
      public static <K, +V> +Matcher<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()))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasSize

      +
      +
      public static <E> Matcher<Collection<? extends E>> hasSize(Matcher<? super 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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the size of an examined Collection
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasSize

      +
      +
      public static <E> Matcher<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))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      size - the expected size of an examined Collection
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      empty

      +
      +
      public static <E> Matcher<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()))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyCollectionOf

      +
      +
      public static <E> Matcher<Collection<E>> emptyCollectionOf(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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      unusedToForceReturnType - the type of the collection's content
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyIterable

      +
      +
      public static <E> Matcher<Iterable<? extends E>> emptyIterable()
      +
      Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
      assertThat(new ArrayList<String>(), is(emptyIterable()))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyIterableOf

      +
      +
      public static <E> Matcher<Iterable<E>> emptyIterableOf(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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      unusedToForceReturnType - the type of the iterable's content
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      contains

      +
      +
      @SafeVarargs +public static <E> Matcher<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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the items provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      contains

      +
      +
      public static <E> Matcher<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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      contains

      +
      +
      @SafeVarargs +public static <E> Matcher<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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      contains

      +
      +
      public static <E> Matcher<Iterable<? extends E>> contains(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInAnyOrder

      +
      +
      @SafeVarargs +public static <T> Matcher<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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInAnyOrder

      +
      +
      @SafeVarargs +public static <T> Matcher<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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the items provided by an examined Iterable in any order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInAnyOrder

      +
      +
      public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(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"))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInRelativeOrder

      +
      +
      @SafeVarargs +public static <E> Matcher<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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must be contained within items provided by an examined Iterable in the same relative order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInRelativeOrder

      +
      +
      @SafeVarargs +public static <E> Matcher<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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInRelativeOrder

      +
      +
      public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      iterableWithSize

      +
      +
      public static <E> Matcher<Iterable<E>> iterableWithSize(Matcher<? super 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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      iterableWithSize

      +
      +
      public static <E> Matcher<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))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      size - the number of items that should be yielded by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasEntry

      +
      +
      public static <K, +V> +Matcher<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")))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasEntry

      +
      +
      public static <K, +V> +Matcher<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"))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasKey

      +
      +
      public static <K> Matcher<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")))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      Parameters:
      +
      keyMatcher - the matcher that must be satisfied by at least one key
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasKey

      +
      +
      public static <K> Matcher<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"))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      Parameters:
      +
      key - the key that satisfying maps must contain
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasValue

      +
      +
      public static <V> Matcher<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")))
      +
      +
      Type Parameters:
      +
      V - the value type.
      +
      Parameters:
      +
      valueMatcher - the matcher that must be satisfied by at least one value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasValue

      +
      +
      public static <V> Matcher<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"))
      +
      +
      Type Parameters:
      +
      V - the value type.
      +
      Parameters:
      +
      value - the value that satisfying maps must contain
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      in

      +
      +
      public static <T> Matcher<T> in(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"))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      collection - the collection in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"})))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the array in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isIn

      +
      +
      @Deprecated +public static <T> Matcher<T> isIn(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      collection - the collection in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"}))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the array in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isOneOf

      +
      +
      @Deprecated +@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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the elements amongst which matching items will be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the elements amongst which matching items will be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      closeTo

      +
      +
      public static Matcher<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      notANumber

      +
      +
      public static Matcher<Double> notANumber()
      +
      Creates a matcher of Doubles that matches when an examined double is not a number. + For example: +
      assertThat(Double.NaN, is(notANumber()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      closeTo

      +
      +
      public static Matcher<BigDecimal> closeTo(BigDecimal operand, + 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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      comparesEqualTo

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      greaterThan

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      greaterThanOrEqualTo

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      lessThan

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      lessThanOrEqualTo

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      equalToIgnoringCase

      +
      +
      public static Matcher<String> equalToIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      equalToIgnoringWhiteSpace

      +
      +
      @Deprecated +public static Matcher<String> equalToIgnoringWhiteSpace(String expectedString)
      + +
      +
      Parameters:
      +
      expectedString - the expected value of matched strings
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      equalToCompressingWhiteSpace

      +
      +
      public static Matcher<String> equalToCompressingWhiteSpace(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyOrNullString

      +
      +
      public static Matcher<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()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyString

      +
      +
      public static Matcher<String> emptyString()
      +
      Creates a matcher of String that matches when the examined string has zero length. + For example: +
      assertThat("", is(emptyString()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isEmptyOrNullString

      +
      +
      @Deprecated +public static Matcher<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())
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isEmptyString

      +
      +
      @Deprecated +public static Matcher<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())
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      blankOrNullString

      +
      +
      public static Matcher<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()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      blankString

      +
      +
      public static Matcher<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()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesPattern

      +
      +
      public static Matcher<String> matchesPattern(Pattern pattern)
      +
      Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
      +
      +
      Parameters:
      +
      pattern - the text pattern to match.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesPattern

      +
      +
      public static Matcher<String> matchesPattern(String regex)
      +
      Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
      +
      +
      Parameters:
      +
      regex - the regex to match.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      stringContainsInOrder

      +
      +
      public static Matcher<String> stringContainsInOrder(Iterable<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      stringContainsInOrder

      +
      +
      public static Matcher<String> stringContainsInOrder(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasLength

      +
      +
      public static Matcher<CharSequence> hasLength(Matcher<? super Integer> lengthMatcher)
      +
      Creates a matcher of CharSequence that matches when a char sequence has the length + that satisfies the specified matcher. + For example: + +
      + assertThat("text", hasLength(lessThan(4)))
      + 
      +
      +
      Parameters:
      +
      lengthMatcher - a matcher for the expected length of the string
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasLength

      +
      +
      public static Matcher<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasToString

      +
      +
      public static <T> Matcher<T> hasToString(Matcher<? super 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      toStringMatcher - the matcher used to verify the toString result
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasToString

      +
      +
      public static <T> Matcher<T> hasToString(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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      expectedToString - the expected toString result
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      typeCompatibleWith

      +
      +
      public static <T> Matcher<Class<?>> typeCompatibleWith(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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      baseType - the base class to examine classes against
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      eventFrom

      +
      +
      public static Matcher<EventObject> eventFrom(Class<? extends EventObject> eventClass, + 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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      eventFrom

      +
      +
      public static Matcher<EventObject> eventFrom(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasProperty

      +
      +
      public static <T> Matcher<T> hasProperty(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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      propertyName - the name of the JavaBean property that examined beans should possess
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasProperty

      +
      +
      public static <T> Matcher<T> hasProperty(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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      samePropertyValuesAs

      +
      +
      public static <B> Matcher<B> samePropertyValuesAs(B expectedBean, + 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")
      +
      +
      Type Parameters:
      +
      B - the matcher type.
      +
      Parameters:
      +
      expectedBean - the bean against which examined beans are compared
      +
      ignoredProperties - do not check any of these named properties.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasXPath

      +
      +
      public static Matcher<Node> hasXPath(String xPath, + Matcher<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasXPath

      +
      +
      public static Matcher<Node> hasXPath(String xPath, + NamespaceContext namespaceContext, + Matcher<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasXPath

      +
      +
      public static Matcher<Node> hasXPath(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasXPath

      +
      +
      public static Matcher<Node> hasXPath(String xPath, + 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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyOptional

      +
      +
      public static <T> Matcher<Optional<T>> emptyOptional()
      +
      Matcher that expects empty Optional.
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      optionalWithValue

      +
      +
      public static <T> Matcher<Optional<T>> optionalWithValue()
      +
      Matcher for Optional that expects that value is present.
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      optionalWithValue

      +
      +
      public static <T> Matcher<Optional<T>> optionalWithValue(T value)
      +
      Matcher for Optional that expects that value is present and is equal to value
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Parameters:
      +
      value - to validate present optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      optionalWithValue

      +
      +
      public static <T> Matcher<Optional<T>> optionalWithValue(Matcher<? super T> matcher)
      +
      Matcher for Optional that expects that value is present and matches matcher
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Parameters:
      +
      matcher - matcher to validate present optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable> Matcher<T> throwsException()
      +
      Matcher for Runnable that expects an exception to be thrown
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(U throwable)
      +
      Matcher for Throwable that expects that the Runnable throws an exception equal to the provided throwable
      +
      +
      Type Parameters:
      +
      T - type of the Throwable
      +
      U - type of the Runnable
      +
      Parameters:
      +
      throwable - the Throwable class against which examined exceptions are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(Class<U> throwableClass)
      +
      Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class
      +
      +
      Type Parameters:
      +
      T - type of the Throwable
      +
      U - type of the Runnable
      +
      Parameters:
      +
      throwableClass - the Throwable class against which examined exceptions are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(Class<U> throwableClass, + String message)
      +
      Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class and has a message equal to the provided message
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      U - type of the Throwable
      +
      Parameters:
      +
      throwableClass - the Throwable class against which examined exceptions are compared
      +
      message - the String against which examined exception messages are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(Class<U> throwableClass, + Matcher<String> messageMatcher)
      +
      Matcher for Throwable that expects that the Runnable throws an exception of the provided throwableClass class and has a message matching the provided messageMatcher
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      U - type of the Throwable
      +
      Parameters:
      +
      throwableClass - the Throwable class against which examined exceptions are compared
      +
      messageMatcher - matcher to validate exception's message
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsExceptionWithMessage

      +
      +
      public static <T extends Runnable> Matcher<T> throwsExceptionWithMessage(String message)
      +
      Matcher for Throwable that expects that the Runnable throws an exception with a message equal to the provided message
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      Parameters:
      +
      message - the String against which examined exception messages are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsExceptionWithMessage

      +
      +
      public static <T extends Runnable> Matcher<T> throwsExceptionWithMessage(Matcher<String> messageMatcher)
      +
      Matcher for Throwable that expects that the Runnable throws an exception with a message matching the provided messageMatcher
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      Parameters:
      +
      messageMatcher - matcher to validate exception's message
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/SelfDescribing.html b/docs/javadoc/4.0/org/hamcrest/SelfDescribing.html new file mode 100644 index 00000000..c539d207 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/SelfDescribing.html @@ -0,0 +1,148 @@ + + + + +SelfDescribing (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Interface SelfDescribing

+
+
+ +
+
+
    + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    void
    +
    describeTo(Description description)
    +
    +
    Generates a description of the object.
    +
    +
    +
    +
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      describeTo

      +
      +
      void describeTo(Description description)
      +
      Generates a description of the object. The description may be part of 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/4.0/org/hamcrest/StringDescription.html b/docs/javadoc/4.0/org/hamcrest/StringDescription.html new file mode 100644 index 00000000..0566b014 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/StringDescription.html @@ -0,0 +1,318 @@ + + + + +StringDescription (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class StringDescription

+
+
java.lang.Object +
org.hamcrest.BaseDescription +
org.hamcrest.StringDescription
+
+
+
+
+
+
All Implemented Interfaces:
+
Description
+
+
+
public class StringDescription +extends BaseDescription
+
A Description that is stored as a string.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      StringDescription

      +
      +
      public StringDescription()
      +
      Creates a new description.
      +
      +
      +
    • +
    • +
      +

      StringDescription

      +
      +
      public StringDescription(Appendable out)
      +
      Creates a new description using the given appendable.
      +
      +
      Parameters:
      +
      out - the place to append the description.
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      toString

      +
      +
      public static 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 String asString(SelfDescribing selfDescribing)
      + +
      +
      Parameters:
      +
      selfDescribing - The object to be described.
      +
      Returns:
      +
      The description of the object.
      +
      +
      +
      +
    • +
    • +
      +

      append

      +
      +
      protected void append(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
      +
      Parameters:
      +
      str - the string to append.
      +
      +
      +
      +
    • +
    • +
      +

      append

      +
      +
      protected void append(char c)
      +
      Description copied from class: BaseDescription
      +
      Append the char c to the description.
      +
      +
      Specified by:
      +
      append in class BaseDescription
      +
      Parameters:
      +
      c - the char to append.
      +
      +
      +
      +
    • +
    • +
      +

      toString

      +
      +
      public String toString()
      +
      Returns the description as a string.
      +
      +
      Overrides:
      +
      toString in class Object
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/TypeSafeDiagnosingMatcher.html b/docs/javadoc/4.0/org/hamcrest/TypeSafeDiagnosingMatcher.html new file mode 100644 index 00000000..d1cfa4ea --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/TypeSafeDiagnosingMatcher.html @@ -0,0 +1,365 @@ + + + + +TypeSafeDiagnosingMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class TypeSafeDiagnosingMatcher<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matcher type.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
+
CombinableMatcher, Every, FeatureMatcher, HasEqualValues, HasPropertyWithValue, HasXPath, IsCollectionContaining, IsEventFrom, IsIterableContaining, IsIterableContainingInAnyOrder, IsIterableContainingInOrder, IsIterableContainingInRelativeOrder, IsIterableContainingParallelRuns, OptionalEmpty, OptionalWithValue, StringRegularExpression, ThrowsException
+
+
+
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(Object, Description).
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      TypeSafeDiagnosingMatcher

      +
      +
      protected TypeSafeDiagnosingMatcher(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(org.hamcrest.internal.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 Details

    +
      +
    • +
      +

      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.
      +
      +
      Parameters:
      +
      item - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matches

      +
      +
      public final boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatch

      +
      +
      public final void describeMismatch(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.
      +
      +
      +
      +
    • +
    • +
      +

      matcher

      +
      +
      public static <T> Matcher<T> matcher(Predicate<T> predicate, + String successDescription, + String failureDescription, + Class<T> expectedType)
      +
      Creates a TypeSafeDiagnosingMatcher that matches an item based on a Predicate. + +

      + If the predicate returns true, the Matcher will match and use the successDescription. + If the predicate returns false, the Matcher will not match and use the failureDescription. +

      +
      +
      Type Parameters:
      +
      T - Type of the item to match
      +
      Parameters:
      +
      predicate - Predicate to test the item. Should return true if the item matches, false otherwise.
      +
      successDescription - Description to use when the predicate matches
      +
      failureDescription - Description to use when the predicate does not match
      +
      expectedType - Expected type of the item to match
      +
      Returns:
      +
      Matcher that matches the item based on the predicate
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/TypeSafeMatcher.html b/docs/javadoc/4.0/org/hamcrest/TypeSafeMatcher.html new file mode 100644 index 00000000..ce9e2040 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/TypeSafeMatcher.html @@ -0,0 +1,334 @@ + + + + +TypeSafeMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class TypeSafeMatcher<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matcher type.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
Direct Known Subclasses:
+
ArrayAsIterableMatcher, BigDecimalCloseTo, CustomTypeSafeMatcher, HasItemInArray, HasProperty, IsArray, IsArrayContainingInAnyOrder, IsArrayContainingInOrder, IsBlankString, IsCloseTo, IsCompatibleType, IsEmptyCollection, IsEmptyIterable, IsEmptyString, IsEqualCompressingWhiteSpace, IsEqualIgnoringCase, IsMapContaining, IsNaN, MatchesPattern, 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.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      TypeSafeMatcher

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

      TypeSafeMatcher

      +
      +
      protected TypeSafeMatcher(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(org.hamcrest.internal.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 Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected abstract boolean matchesSafely(T item)
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      protected void describeMismatchSafely(T item, + Description mismatchDescription)
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      matches

      +
      +
      public final boolean matches(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 type safe item to match against.
      +
      Returns:
      +
      true if item matches, otherwise false.
      +
      See Also:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatch

      +
      +
      public final void describeMismatch(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/4.0/org/hamcrest/beans/HasProperty.html b/docs/javadoc/4.0/org/hamcrest/beans/HasProperty.html new file mode 100644 index 00000000..be287c97 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/HasProperty.html @@ -0,0 +1,294 @@ + + + + +HasProperty (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class HasProperty<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T> +
org.hamcrest.beans.HasProperty<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - The Matcher type.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class HasProperty<T> +extends TypeSafeMatcher<T>
+
A matcher that checks if 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 Details

    +
      +
    • +
      +

      HasProperty

      +
      +
      public HasProperty(String propertyName)
      +
      Constructor, best called from hasProperty(String).
      +
      +
      Parameters:
      +
      propertyName - the name of the property
      +
      See Also:
      +
      + +
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(T obj)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<T>
      +
      Parameters:
      +
      obj - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(T item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<T>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      propertyName - the name of the JavaBean property that examined beans should possess
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/beans/HasPropertyWithValue.html b/docs/javadoc/4.0/org/hamcrest/beans/HasPropertyWithValue.html new file mode 100644 index 00000000..ffc883f7 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/HasPropertyWithValue.html @@ -0,0 +1,377 @@ + + + + +HasPropertyWithValue (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class HasPropertyWithValue<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.beans.HasPropertyWithValue<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the Matcher type
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class HasPropertyWithValue<T> +extends TypeSafeDiagnosingMatcher<T>
+

A matcher that checks if an object has a JavaBean property with the + specified name and an expected value. 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 its 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 https://docs.oracle.com/javase/8/docs/technotes/guides/beans/index.html for + more information on JavaBeans. +

+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      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>
      +
      Parameters:
      +
      bean - the item.
      +
      mismatch - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasPropertyAtPath

      +
      +
      public static <T> Matcher<T> hasPropertyAtPath(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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/beans/PropertyAccessor.PropertyReadLens.html b/docs/javadoc/4.0/org/hamcrest/beans/PropertyAccessor.PropertyReadLens.html new file mode 100644 index 00000000..96e49629 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/PropertyAccessor.PropertyReadLens.html @@ -0,0 +1,233 @@ + + + + +PropertyAccessor.PropertyReadLens (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class PropertyAccessor.PropertyReadLens

+
+
java.lang.Object +
org.hamcrest.beans.PropertyAccessor.PropertyReadLens
+
+
+
+
+
Enclosing class:
+
PropertyAccessor
+
+
+
public class PropertyAccessor.PropertyReadLens +extends Object
+
Encapsulates a property in the parent object.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      PropertyReadLens

      +
      +
      public PropertyReadLens(String name, + Method readMethod)
      +
      Constructor.
      +
      +
      Parameters:
      +
      name - the name of the property
      +
      readMethod - the method that can be used to get the value of the property
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getName

      +
      +
      public String getName()
      +
      The name of the property
      +
      +
      Returns:
      +
      the name of the property.
      +
      +
      +
      +
    • +
    • +
      +

      getReadMethod

      +
      +
      public Method getReadMethod()
      +
      The read method for the property.
      +
      +
      Returns:
      +
      the read method for the property.
      +
      +
      +
      +
    • +
    • +
      +

      getValue

      +
      +
      public Object getValue()
      +
      The value of the property.
      +
      +
      Returns:
      +
      the value of the property.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/beans/PropertyAccessor.html b/docs/javadoc/4.0/org/hamcrest/beans/PropertyAccessor.html new file mode 100644 index 00000000..0457427b --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/PropertyAccessor.html @@ -0,0 +1,343 @@ + + + + +PropertyAccessor (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class PropertyAccessor

+
+
java.lang.Object +
org.hamcrest.beans.PropertyAccessor
+
+
+
+
+
public class PropertyAccessor +extends Object
+
Utility class to help with finding properties in an object. +

+ The properties can be either properties as described by the + JavaBean specification and APIs, or it will fall back to finding + fields with corresponding methods, enabling the property matchers + to work with newer classes like Records. +

+ See https://docs.oracle.com/javase/8/docs/technotes/guides/beans/index.html for + more information on JavaBeans.

+
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      NO_ARGUMENTS

      +
      +
      public static final Object[] NO_ARGUMENTS
      +
      Empty object array, used for documenting that we are deliberately passing no arguments to a method.
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      PropertyAccessor

      +
      +
      public PropertyAccessor(Object beanLikeObject)
      +
      Constructor.
      +
      +
      Parameters:
      +
      beanLikeObject - the object to search for properties.
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      fieldNames

      +
      +
      public Set<String> fieldNames()
      +
      The names of properties that were found in the object.
      +
      +
      Returns:
      +
      a set of field names
      +
      +
      +
      +
    • +
    • +
      +

      readLenses

      +
      + +
      The collection of lenses for all the properties that were found in the + object.
      +
      +
      Returns:
      +
      the collection of lenses
      +
      +
      +
      +
    • +
    • +
      +

      readLensFor

      +
      +
      public PropertyAccessor.PropertyReadLens readLensFor(String propertyName)
      +
      The read lens for the specified property.
      +
      +
      Parameters:
      +
      propertyName - the property to find the lens for.
      +
      Returns:
      +
      the read lens for the property
      +
      +
      +
      +
    • +
    • +
      +

      fieldValue

      +
      +
      public Object fieldValue(String propertyName)
      +
      The value of the specified property.
      +
      +
      Parameters:
      +
      propertyName - the name of the property
      +
      Returns:
      +
      the value of the given property name.
      +
      +
      +
      +
    • +
    • +
      +

      propertyDescriptorsFor

      +
      +
      public static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj, + Class<Object> stopClass) + throws 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:
      +
      IllegalArgumentException - if there's a introspection failure
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/beans/PropertyUtil.html b/docs/javadoc/4.0/org/hamcrest/beans/PropertyUtil.html new file mode 100644 index 00000000..dfb0b0e6 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/PropertyUtil.html @@ -0,0 +1,238 @@ + + + + +PropertyUtil (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class PropertyUtil

+
+
java.lang.Object +
org.hamcrest.beans.PropertyUtil
+
+
+
+
+
@Deprecated +public class PropertyUtil +extends Object
+
Deprecated. +
Replaced by PropertyAccessor
+
+
Utility class with static methods for accessing properties on JavaBean objects. + See https://docs.oracle.com/javase/8/docs/technotes/guides/beans/index.html for + more information on JavaBeans.
+
+
Since:
+
1.1.0
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      NO_ARGUMENTS

      +
      +
      public static final Object[] NO_ARGUMENTS
      +
      Deprecated.
      +
      Empty object array, used for documenting that we are deliberately passing no arguments to a method.
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getPropertyDescriptor

      +
      +
      public static PropertyDescriptor getPropertyDescriptor(String propertyName, + Object fromObj) + throws IllegalArgumentException
      +
      Deprecated.
      +
      Returns the description of the property with the provided + name on the provided object's interface.
      +
      +
      Parameters:
      +
      propertyName - the bean property name.
      +
      fromObj - the object to check.
      +
      Returns:
      +
      the descriptor of the property, or null if the property does not exist.
      +
      Throws:
      +
      IllegalArgumentException - if there's a introspection failure
      +
      +
      +
      +
    • +
    • +
      +

      propertyDescriptorsFor

      +
      +
      public static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj, + Class<Object> stopClass) + throws IllegalArgumentException
      +
      Deprecated.
      +
      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:
      +
      IllegalArgumentException - if there's a introspection failure
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/beans/SamePropertyValuesAs.html b/docs/javadoc/4.0/org/hamcrest/beans/SamePropertyValuesAs.html new file mode 100644 index 00000000..1732c544 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/SamePropertyValuesAs.html @@ -0,0 +1,286 @@ + + + + +SamePropertyValuesAs (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class SamePropertyValuesAs<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.DiagnosingMatcher<T> +
org.hamcrest.beans.SamePropertyValuesAs<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the matcher value type.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class SamePropertyValuesAs<T> +extends DiagnosingMatcher<T>
+
A matcher that checks if a given bean has the same property values + as an example bean.
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      SamePropertyValuesAs

      +
      +
      public SamePropertyValuesAs(T expectedBean, + List<String> ignoredProperties)
      +
      Constructor, best called from samePropertyValuesAs(Object, String...).
      +
      +
      Parameters:
      +
      expectedBean - the bean object with the expected values
      +
      ignoredProperties - list of property names that should be excluded from the match
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      protected boolean matches(Object actual, + Description mismatch)
      +
      Description copied from class: DiagnosingMatcher
      +
      Evaluates the matcher for argument item.
      +
      +
      Specified by:
      +
      matches in class DiagnosingMatcher<T>
      +
      Parameters:
      +
      actual - the value to check
      +
      mismatch - the description for the matcher
      +
      Returns:
      +
      true if item matches, otherwise false.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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, + 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")
      + 
      +
      +
      Type Parameters:
      +
      B - the matcher value type.
      +
      Parameters:
      +
      expectedBean - the bean against which examined beans are compared
      +
      ignoredProperties - do not check any of these named properties.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/beans/package-summary.html b/docs/javadoc/4.0/org/hamcrest/beans/package-summary.html new file mode 100644 index 00000000..6187184d --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/package-summary.html @@ -0,0 +1,127 @@ + + + + +org.hamcrest.beans (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.beans

+
+
+
+
package org.hamcrest.beans
+
+
Matchers of Java Bean properties and their values.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    A matcher that checks if an object has a JavaBean property with the + specified name.
    +
    + +
    +
    A matcher that checks if an object has a JavaBean property with the + specified name and an expected value.
    +
    + +
    +
    Utility class to help with finding properties in an object.
    +
    + +
    Deprecated. +
    Replaced by PropertyAccessor
    +
    + +
    +
    A matcher that checks if a given bean has the same property values + as an example bean.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/beans/package-tree.html b/docs/javadoc/4.0/org/hamcrest/beans/package-tree.html new file mode 100644 index 00000000..94e82c4d --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/beans/package-tree.html @@ -0,0 +1,97 @@ + + + + +org.hamcrest.beans Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.beans

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/ArrayAsIterableMatcher.html b/docs/javadoc/4.0/org/hamcrest/collection/ArrayAsIterableMatcher.html new file mode 100644 index 00000000..3e0b50ef --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/ArrayAsIterableMatcher.html @@ -0,0 +1,327 @@ + + + + +ArrayAsIterableMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class ArrayAsIterableMatcher<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<E[]> +
org.hamcrest.TypeSafeMatcher<E[]> +
org.hamcrest.collection.ArrayAsIterableMatcher<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - the collection element type
+
+
+
All Implemented Interfaces:
+
Matcher<E[]>, SelfDescribing
+
+
+
public class ArrayAsIterableMatcher<E> +extends TypeSafeMatcher<E[]>
+
A matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers.
+
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      iterableMatcher

      +
      +
      protected final TypeSafeDiagnosingMatcher<Iterable<? extends E>> iterableMatcher
      +
      The matchers to match iterable against
      +
      +
      +
    • +
    • +
      +

      matchers

      +
      +
      protected final Collection<Matcher<? super E>> matchers
      +
      The matchers to match items against
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(E[] item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<E[]>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(E[] item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<E[]>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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/4.0/org/hamcrest/collection/ArrayMatching.html b/docs/javadoc/4.0/org/hamcrest/collection/ArrayMatching.html new file mode 100644 index 00000000..7018f0cb --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/ArrayMatching.html @@ -0,0 +1,406 @@ + + + + +ArrayMatching (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class ArrayMatching

+
+
java.lang.Object +
org.hamcrest.collection.ArrayMatching
+
+
+
+
+
public class ArrayMatching +extends Object
+
Collected helper code for converting matchers between lists and iterables.
+
+
+
+
    + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    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(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[]>
    + +
    +
    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(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(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> List<Matcher<? super E>>
    +
    asEqualMatchers(E[] items)
    +
    +
    Converts item array to corresponding array of equalTo matchers
    +
    +
    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
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elementMatcher - the matcher to apply to elements in examined arrays
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      element - the element that should be present in examined arrays
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContainingInAnyOrder

      +
      +
      public static <E> Matcher<E[]> arrayContainingInAnyOrder(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the entries of an examined array, in any order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the items within an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers that must be satisfied by the items in the examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContaining

      +
      +
      public static <E> Matcher<E[]> arrayContaining(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      asEqualMatchers

      +
      +
      public static <E> List<Matcher<? super E>> asEqualMatchers(E[] items)
      +
      Converts item array to corresponding array of equalTo matchers
      +
      +
      Type Parameters:
      +
      E - type of array items
      +
      Parameters:
      +
      items - items to convert
      +
      Returns:
      +
      list of corresponding equaTo matchers
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/HasItemInArray.html b/docs/javadoc/4.0/org/hamcrest/collection/HasItemInArray.html new file mode 100644 index 00000000..96b4fd7a --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/HasItemInArray.html @@ -0,0 +1,265 @@ + + + + +HasItemInArray (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class HasItemInArray<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T[]> +
org.hamcrest.TypeSafeMatcher<T[]> +
org.hamcrest.collection.HasItemInArray<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the array element type
+
+
+
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 Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(T[] actual)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<T[]>
      +
      Parameters:
      +
      actual - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(T[] actual, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<T[]>
      +
      Parameters:
      +
      actual - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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/4.0/org/hamcrest/collection/IsArray.html b/docs/javadoc/4.0/org/hamcrest/collection/IsArray.html new file mode 100644 index 00000000..85862114 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsArray.html @@ -0,0 +1,353 @@ + + + + +IsArray (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsArray<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T[]> +
org.hamcrest.TypeSafeMatcher<T[]> +
org.hamcrest.collection.IsArray<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the array element type
+
+
+
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 Details

    +
      +
    • +
      +

      IsArray

      +
      +
      public IsArray(Matcher<? super T>[] elementMatchers)
      +
      Constructor, best called from array(Matcher[]).
      +
      +
      Parameters:
      +
      elementMatchers - matchers for expected values
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(T[] array)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<T[]>
      +
      Parameters:
      +
      array - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(T[] actual, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<T[]>
      +
      Parameters:
      +
      actual - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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 String descriptionStart()
      +
      Returns the string that starts the description. + + Can be overridden in subclasses to customise how the matcher is + described.
      +
      +
      Returns:
      +
      The description prefix.
      +
      +
      +
      +
    • +
    • +
      +

      descriptionSeparator

      +
      +
      protected String descriptionSeparator()
      +
      Returns the string that separates the elements in the description. + + Can be overridden in subclasses to customise how the matcher is + described.
      +
      +
      Returns:
      +
      The description separator.
      +
      +
      +
      +
    • +
    • +
      +

      descriptionEnd

      +
      +
      protected String descriptionEnd()
      +
      Returns the string that ends the description. + + Can be overridden in subclasses to customise how the matcher is + described.
      +
      +
      Returns:
      +
      The description suffix.
      +
      +
      +
      +
    • +
    • +
      +

      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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elementMatchers - the matchers that the elements of examined arrays should satisfy
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsArrayContainingInAnyOrder.html b/docs/javadoc/4.0/org/hamcrest/collection/IsArrayContainingInAnyOrder.html new file mode 100644 index 00000000..a2368111 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsArrayContainingInAnyOrder.html @@ -0,0 +1,389 @@ + + + + +IsArrayContainingInAnyOrder (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsArrayContainingInAnyOrder<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<E[]> +
org.hamcrest.TypeSafeMatcher<E[]> +
org.hamcrest.collection.IsArrayContainingInAnyOrder<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - the collection element type
+
+
+
All Implemented Interfaces:
+
Matcher<E[]>, SelfDescribing
+
+
+
@Deprecated +public class IsArrayContainingInAnyOrder<E> +extends TypeSafeMatcher<E[]>
+
Deprecated. +
As of release 2.1, replaced by ArrayMatching.
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(E[] item)
      +
      Deprecated.
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<E[]>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(E[] item, + Description mismatchDescription)
      +
      Deprecated.
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<E[]>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      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 + 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

      +
      +
      @Deprecated +public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
      +
      Deprecated. + +
      +
      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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContainingInAnyOrder

      +
      +
      @Deprecated +public static <E> Matcher<E[]> arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)
      +
      Deprecated. + +
      +
      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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContainingInAnyOrder

      +
      +
      @Deprecated +public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
      +
      Deprecated. + +
      +
      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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the entries of an examined array, in any order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsArrayContainingInOrder.html b/docs/javadoc/4.0/org/hamcrest/collection/IsArrayContainingInOrder.html new file mode 100644 index 00000000..b413ec54 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsArrayContainingInOrder.html @@ -0,0 +1,374 @@ + + + + +IsArrayContainingInOrder (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsArrayContainingInOrder<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<E[]> +
org.hamcrest.TypeSafeMatcher<E[]> +
org.hamcrest.collection.IsArrayContainingInOrder<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - the array element type
+
+
+
All Implemented Interfaces:
+
Matcher<E[]>, SelfDescribing
+
+
+
@Deprecated +public class IsArrayContainingInOrder<E> +extends TypeSafeMatcher<E[]>
+
Deprecated. +
As of release 2.1, replaced by ArrayMatching.
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(E[] item)
      +
      Deprecated.
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<E[]>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(E[] item, + Description mismatchDescription)
      +
      Deprecated.
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<E[]>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      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 + 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

      +
      +
      @Deprecated +public static <E> Matcher<E[]> arrayContaining(E... items)
      +
      Deprecated. + +
      +
      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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the items within an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContaining

      +
      +
      @Deprecated +public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
      +
      Deprecated. + +
      +
      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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers that must be satisfied by the items in the examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      arrayContaining

      +
      +
      @Deprecated +public static <E> Matcher<E[]> arrayContaining(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsArrayWithSize.html b/docs/javadoc/4.0/org/hamcrest/collection/IsArrayWithSize.html new file mode 100644 index 00000000..233d2a46 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsArrayWithSize.html @@ -0,0 +1,296 @@ + + + + +IsArrayWithSize (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsArrayWithSize<E>

+
+ +
+
+
+
Type Parameters:
+
E - the array element type
+
+
+
All Implemented Interfaces:
+
Matcher<E[]>, SelfDescribing
+
+
+
public class IsArrayWithSize<E> +extends FeatureMatcher<E[],Integer>
+
Matches if array size satisfies a size matcher.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      featureValueOf

      +
      +
      protected Integer featureValueOf(E[] actual)
      +
      Description copied from class: FeatureMatcher
      +
      Implement this to extract the interesting feature.
      +
      +
      Specified by:
      +
      featureValueOf in class FeatureMatcher<E[],Integer>
      +
      Parameters:
      +
      actual - the target object
      +
      Returns:
      +
      the feature to be matched
      +
      +
      +
      +
    • +
    • +
      +

      arrayWithSize

      +
      +
      public static <E> Matcher<E[]> arrayWithSize(Matcher<? super 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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the length of an examined array
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      size - the length that an examined array must have for a positive match
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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())
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsCollectionWithSize.html b/docs/javadoc/4.0/org/hamcrest/collection/IsCollectionWithSize.html new file mode 100644 index 00000000..6c612396 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsCollectionWithSize.html @@ -0,0 +1,269 @@ + + + + +IsCollectionWithSize (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsCollectionWithSize<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Collection<? extends E>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Collection<? extends E>> +
org.hamcrest.FeatureMatcher<Collection<? extends E>,Integer> +
org.hamcrest.collection.IsCollectionWithSize<E>
+
+
+
+
+
+
+
+
Type Parameters:
+
E - the collection element type
+
+
+
All Implemented Interfaces:
+
Matcher<Collection<? extends E>>, SelfDescribing
+
+
+
public class IsCollectionWithSize<E> +extends FeatureMatcher<Collection<? extends E>,Integer>
+
Matches if collection size satisfies a nested matcher.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsCollectionWithSize

      +
      +
      public IsCollectionWithSize(Matcher<? super Integer> sizeMatcher)
      +
      Constructor, best called from hasSize(int) or hasSize(Matcher).
      +
      +
      Parameters:
      +
      sizeMatcher - the expected size
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      featureValueOf

      +
      +
      protected Integer featureValueOf(Collection<? extends E> actual)
      +
      Description copied from class: FeatureMatcher
      +
      Implement this to extract the interesting feature.
      +
      +
      Specified by:
      +
      featureValueOf in class FeatureMatcher<Collection<? extends E>,Integer>
      +
      Parameters:
      +
      actual - the target object
      +
      Returns:
      +
      the feature to be matched
      +
      +
      +
      +
    • +
    • +
      +

      hasSize

      +
      +
      public static <E> Matcher<Collection<? extends E>> hasSize(Matcher<? super 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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the size of an examined Collection
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasSize

      +
      +
      public static <E> Matcher<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))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      size - the expected size of an examined Collection
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsEmptyCollection.html b/docs/javadoc/4.0/org/hamcrest/collection/IsEmptyCollection.html new file mode 100644 index 00000000..5fb16fa3 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsEmptyCollection.html @@ -0,0 +1,309 @@ + + + + +IsEmptyCollection (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsEmptyCollection<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Collection<? extends E>> +
org.hamcrest.TypeSafeMatcher<Collection<? extends E>> +
org.hamcrest.collection.IsEmptyCollection<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - the collection element type
+
+
+
All Implemented Interfaces:
+
Matcher<Collection<? extends E>>, SelfDescribing
+
+
+
public class IsEmptyCollection<E> +extends TypeSafeMatcher<Collection<? extends E>>
+
Tests if a collection is empty.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(Collection<? extends E> item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<Collection<? extends E>>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(Collection<? extends E> item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<Collection<? extends E>>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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()))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyCollectionOf

      +
      +
      public static <E> Matcher<Collection<E>> emptyCollectionOf(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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      unusedToForceReturnType - the type of the collection's content
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsEmptyIterable.html b/docs/javadoc/4.0/org/hamcrest/collection/IsEmptyIterable.html new file mode 100644 index 00000000..9d9da97d --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsEmptyIterable.html @@ -0,0 +1,305 @@ + + + + +IsEmptyIterable (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsEmptyIterable<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<? extends E>> +
org.hamcrest.TypeSafeMatcher<Iterable<? extends E>> +
org.hamcrest.collection.IsEmptyIterable<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - the iterable element type
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<? extends E>>, SelfDescribing
+
+
+
public class IsEmptyIterable<E> +extends TypeSafeMatcher<Iterable<? extends E>>
+
Tests if an iterable is empty.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(Iterable<? extends E> iterable)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<Iterable<? extends E>>
      +
      Parameters:
      +
      iterable - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(Iterable<? extends E> iter, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<Iterable<? extends E>>
      +
      Parameters:
      +
      iter - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<Iterable<? extends E>> emptyIterable()
      +
      Creates a matcher for Iterables matching examined iterables that yield no items. + For example: +
      assertThat(new ArrayList<String>(), is(emptyIterable()))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyIterableOf

      +
      +
      public static <E> Matcher<Iterable<E>> emptyIterableOf(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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      unusedToForceReturnType - the type of the iterable's content
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsIn.html b/docs/javadoc/4.0/org/hamcrest/collection/IsIn.html new file mode 100644 index 00000000..7ec6da4e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsIn.html @@ -0,0 +1,433 @@ + + + + +IsIn (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsIn<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.collection.IsIn<T>
+
+
+
+
+
+
Type Parameters:
+
T - the type of the objects in the collection
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class IsIn<T> +extends BaseMatcher<T>
+
Tests if a collection contains a matching object.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsIn

      +
      +
      public IsIn(Collection<T> collection)
      +
      Constructor, best called from in(Collection).
      +
      +
      Parameters:
      +
      collection - the expected element matchers
      +
      +
      +
      +
    • +
    • +
      +

      IsIn

      +
      +
      public IsIn(T[] elements)
      +
      Constructor, best called from in(Object[]).
      +
      +
      Parameters:
      +
      elements - the expected elements
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description buffer)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      collection - the collection in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      in

      +
      +
      public static <T> Matcher<T> in(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"))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      collection - the collection in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"}))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the array in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"})))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the array in which matching items must be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the elements amongst which matching items will be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      elements - the elements amongst which matching items will be found
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInAnyOrder.html b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInAnyOrder.html new file mode 100644 index 00000000..bbbddcbc --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInAnyOrder.html @@ -0,0 +1,409 @@ + + + + +IsIterableContainingInAnyOrder (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsIterableContainingInAnyOrder<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<? extends T>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Iterable<? extends T>> +
org.hamcrest.collection.IsIterableContainingInAnyOrder<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the type of items in the iterable.
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<? extends T>>, SelfDescribing
+
+
+
public class IsIterableContainingInAnyOrder<T> +extends TypeSafeDiagnosingMatcher<Iterable<? extends T>>
+
Tests if an iterable contains matching elements in any order.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(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<Iterable<? extends T>>
      +
      Parameters:
      +
      items - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInAnyOrder

      +
      +
      @SafeVarargs +public static <T> Matcher<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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the items provided by an examined Iterable in any order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInAnyOrder

      +
      +
      @SafeVarargs +public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Comparator<T> comparator, + 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 according to + the comparator 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("first", "second"), containsInAnyOrder(new StringLengthComparator(), "abcde", "ZYXWVU"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      comparator - the comparator to use to compare items to the items provided.
      +
      items - the items that must equal (according to the provided comparator) the items provided by + an examined Iterable in any order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInAnyOrder

      +
      +
      public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(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"))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInOrder.html b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInOrder.html new file mode 100644 index 00000000..785de1ec --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInOrder.html @@ -0,0 +1,367 @@ + + + + +IsIterableContainingInOrder (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsIterableContainingInOrder<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<? extends E>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Iterable<? extends E>> +
org.hamcrest.collection.IsIterableContainingInOrder<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - the type of items in the iterable.
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<? extends E>>, SelfDescribing
+
+
+
public class IsIterableContainingInOrder<E> +extends TypeSafeDiagnosingMatcher<Iterable<? extends E>>
+
Tests if an iterable contains matching elements in order.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(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<Iterable<? extends E>>
      +
      Parameters:
      +
      iterable - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must equal the items provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      contains

      +
      +
      public static <E> Matcher<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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher that must be satisfied by the single item provided by an + examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      contains

      +
      +
      @SafeVarargs +public static <E> Matcher<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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      contains

      +
      +
      public static <E> Matcher<Iterable<? extends E>> contains(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by + an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html new file mode 100644 index 00000000..d4b58cf2 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingInRelativeOrder.html @@ -0,0 +1,329 @@ + + + + +IsIterableContainingInRelativeOrder (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsIterableContainingInRelativeOrder<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<? extends E>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Iterable<? extends E>> +
org.hamcrest.collection.IsIterableContainingInRelativeOrder<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - the type of items in the iterable.
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<? extends E>>, SelfDescribing
+
+
+
public class IsIterableContainingInRelativeOrder<E> +extends TypeSafeDiagnosingMatcher<Iterable<? extends E>>
+
Tests if an iterable contains matching elements in relative order.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(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<Iterable<? extends E>>
      +
      Parameters:
      +
      iterable - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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"))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      items - the items that must be contained within items provided by an examined Iterable in the same relative order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInRelativeOrder

      +
      +
      @SafeVarargs +public static <E> Matcher<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")))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsInRelativeOrder

      +
      +
      public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(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"))))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingParallelRuns.html b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingParallelRuns.html new file mode 100644 index 00000000..b1b12425 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableContainingParallelRuns.html @@ -0,0 +1,306 @@ + + + + +IsIterableContainingParallelRuns (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsIterableContainingParallelRuns<E>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<E>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Iterable<E>> +
org.hamcrest.collection.IsIterableContainingParallelRuns<E>
+
+
+
+
+
+
+
Type Parameters:
+
E - Type of items to match.
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<E>>, SelfDescribing
+
+
+
public class IsIterableContainingParallelRuns<E> +extends TypeSafeDiagnosingMatcher<Iterable<E>>
+
A matcher like that can check an iterable for parallel runs of a list of matchers. It is similar + to IsIterableContainingInRelativeOrder, in fact behaving exactly + the same when numRuns = 1.
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(Iterable<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<Iterable<E>>
      +
      Parameters:
      +
      iterable - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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.
      +
      +
      +
      +
    • +
    • +
      +

      containsParallelRunsOf

      +
      +
      @SafeVarargs +public static <E> Matcher<Iterable<E>> containsParallelRunsOf(int numRuns, + 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, with numRuns + occurrences of the specified series of items being matched (possibly interspersed).
      +
      +
      +
    • +
    • +
      +

      containsParallelRunsOf

      +
      +
      @SafeVarargs +public static <E> Matcher<Iterable<E>> containsParallelRunsOf(int numRuns, + Matcher<? super E>... matchers)
      +
      +
      +
    • +
    • +
      +

      containsParallelRunsOf

      +
      +
      public static <E> Matcher<Iterable<E>> containsParallelRunsOf(int numRuns, + List<Matcher<? super E>> matchers)
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsIterableWithSize.html b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableWithSize.html new file mode 100644 index 00000000..33860fba --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsIterableWithSize.html @@ -0,0 +1,275 @@ + + + + +IsIterableWithSize (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsIterableWithSize<E>

+
+ +
+
+
+
Type Parameters:
+
E - the iterable element type
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<E>>, SelfDescribing
+
+
+
public class IsIterableWithSize<E> +extends FeatureMatcher<Iterable<E>,Integer>
+
Matches if iterable size satisfies a size matcher.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      featureValueOf

      +
      +
      protected Integer featureValueOf(Iterable<E> actual)
      +
      Description copied from class: FeatureMatcher
      +
      Implement this to extract the interesting feature.
      +
      +
      Specified by:
      +
      featureValueOf in class FeatureMatcher<Iterable<E>,Integer>
      +
      Parameters:
      +
      actual - the target object
      +
      Returns:
      +
      the feature to be matched
      +
      +
      +
      +
    • +
    • +
      +

      iterableWithSize

      +
      +
      public static <E> Matcher<Iterable<E>> iterableWithSize(Matcher<? super 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)))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      iterableWithSize

      +
      +
      public static <E> Matcher<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))
      +
      +
      Type Parameters:
      +
      E - the matcher type.
      +
      Parameters:
      +
      size - the number of items that should be yielded by an examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsMapContaining.html b/docs/javadoc/4.0/org/hamcrest/collection/IsMapContaining.html new file mode 100644 index 00000000..84cfd7bb --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsMapContaining.html @@ -0,0 +1,456 @@ + + + + +IsMapContaining (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsMapContaining<K,V>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Map<? extends K,? extends V>> +
org.hamcrest.TypeSafeMatcher<Map<? extends K,? extends V>> +
org.hamcrest.collection.IsMapContaining<K,V>
+
+
+
+
+
+
+
Type Parameters:
+
K - the type of the map keys
+
V - the type of the map values
+
+
+
All Implemented Interfaces:
+
Matcher<Map<? extends K,? extends V>>, SelfDescribing
+
+
+
public class IsMapContaining<K,V> +extends TypeSafeMatcher<Map<? extends K,? extends V>>
+
Matches if map keys, values or entries match the value matchers.
+
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    +
    IsMapContaining(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher)
    +
    +
    Constructor, best called from one of the static factory methods (hasKey, hasValue, + or hasEntry).
    +
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    void
    +
    describeMismatchSafely(Map<? extends K,? extends V> map, + Description mismatchDescription)
    +
    +
    Describe the mismatch.
    +
    +
    void
    +
    describeTo(Description description)
    +
    +
    Generates a description of the object.
    +
    +
    static <K, +V> Matcher<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<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<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<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<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<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.
    +
    +
    boolean
    +
    matchesSafely(Map<? extends K,? extends V> map)
    +
    +
    Check if the item matches.
    +
    +
    +
    +
    +
    +

    Methods inherited from class org.hamcrest.TypeSafeMatcher

    +describeMismatch, matches
    + +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(Map<? extends K,? extends V> map)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<Map<? extends K,? extends V>>
      +
      Parameters:
      +
      map - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(Map<? extends K,? extends V> map, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<Map<? extends K,? extends V>>
      +
      Parameters:
      +
      map - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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")))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasEntry

      +
      +
      public static <K, +V> +Matcher<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"))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasKey

      +
      +
      public static <K> Matcher<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")))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      Parameters:
      +
      keyMatcher - the matcher that must be satisfied by at least one key
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasKey

      +
      +
      public static <K> Matcher<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"))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      Parameters:
      +
      key - the key that satisfying maps must contain
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasValue

      +
      +
      public static <V> Matcher<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")))
      +
      +
      Type Parameters:
      +
      V - the value type.
      +
      Parameters:
      +
      valueMatcher - the matcher that must be satisfied by at least one value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasValue

      +
      +
      public static <V> Matcher<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"))
      +
      +
      Type Parameters:
      +
      V - the value type.
      +
      Parameters:
      +
      value - the value that satisfying maps must contain
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsMapWithSize.html b/docs/javadoc/4.0/org/hamcrest/collection/IsMapWithSize.html new file mode 100644 index 00000000..d3dd919e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsMapWithSize.html @@ -0,0 +1,309 @@ + + + + +IsMapWithSize (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsMapWithSize<K,V>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Map<? extends K,? extends V>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Map<? extends K,? extends V>> +
org.hamcrest.FeatureMatcher<Map<? extends K,? extends V>,Integer> +
org.hamcrest.collection.IsMapWithSize<K,V>
+
+
+
+
+
+
+
+
Type Parameters:
+
K - the map key type.
+
V - the map value type.
+
+
+
All Implemented Interfaces:
+
Matcher<Map<? extends K,? extends V>>, SelfDescribing
+
+
+
public final class IsMapWithSize<K,V> +extends FeatureMatcher<Map<? extends K,? extends V>,Integer>
+
Matches if map size satisfies a nested matcher.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      featureValueOf

      +
      +
      protected Integer featureValueOf(Map<? extends K,? extends V> actual)
      +
      Description copied from class: FeatureMatcher
      +
      Implement this to extract the interesting feature.
      +
      +
      Specified by:
      +
      featureValueOf in class FeatureMatcher<Map<? extends K,? extends V>,Integer>
      +
      Parameters:
      +
      actual - the target object
      +
      Returns:
      +
      the feature to be matched
      +
      +
      +
      +
    • +
    • +
      +

      aMapWithSize

      +
      +
      public static <K, +V> +Matcher<Map<? extends K,? extends V>> aMapWithSize(Matcher<? super 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))))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      Parameters:
      +
      sizeMatcher - a matcher for the size of an examined Map
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      aMapWithSize

      +
      +
      public static <K, +V> +Matcher<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)))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      Parameters:
      +
      size - the expected size of an examined Map
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anEmptyMap

      +
      +
      public static <K, +V> +Matcher<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()))
      +
      +
      Type Parameters:
      +
      K - the map key type.
      +
      V - the map value type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/IsUnmodifiable.html b/docs/javadoc/4.0/org/hamcrest/collection/IsUnmodifiable.html new file mode 100644 index 00000000..b84ba94e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/IsUnmodifiable.html @@ -0,0 +1,223 @@ + + + + +IsUnmodifiable (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsUnmodifiable

+
+
java.lang.Object +
org.hamcrest.collection.IsUnmodifiable
+
+
+
+
+
public class IsUnmodifiable +extends Object
+
This class contains static factory methods for creating Matchers that test if a collection is unmodifiable. + +

+ The main matcher is isUnmodifiableCollection() which tries to determine if a collection is unmodifiable. + Other matchers are provided to test specific cases, such as isUnmodifiableJdkCollection(), + isModifiableJdkCollection() and isUnmodifiableCustomCollection(). +

+
+
+
+ +
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      isUnmodifiableCollection

      +
      +
      public static <E> Matcher<Collection<? extends E>> isUnmodifiableCollection()
      +
      Creates matcher that matches when collection is unmodifiable. + + It looks for any of the known modifiable or unmodifiable JDK collections, if not found it tries to instantiate + the collection and call all modification methods to see if any of them succeed. This instantiation can fail if + the collection does not have a constructor that can be called with default values.
      +
      +
      Type Parameters:
      +
      E - the type of elements in the collection
      +
      Returns:
      +
      The matcher
      +
      +
      +
      +
    • +
    • +
      +

      isUnmodifiableJdkCollection

      +
      +
      public static <E> Matcher<Collection<? extends E>> isUnmodifiableJdkCollection()
      +
      Creates a matcher that matches when the collection is one of the known unmodifiable JDK collections.
      +
      +
      Type Parameters:
      +
      E - the type of elements in the collection
      +
      Returns:
      +
      The matcher
      +
      +
      +
      +
    • +
    • +
      +

      isModifiableJdkCollection

      +
      +
      public static <E> Matcher<Collection<? extends E>> isModifiableJdkCollection()
      +
      Creates a matcher that matches when the collection is one of the known modifiable JDK collections.
      +
      +
      Type Parameters:
      +
      E - the type of elements in the collection
      +
      Returns:
      +
      The matcher
      +
      +
      +
      +
    • +
    • +
      +

      isUnmodifiableCustomCollection

      +
      +
      public static <E> Matcher<Collection<? extends E>> isUnmodifiableCustomCollection()
      +
      Creates a matcher that matches when the collection is unmodifiable by calling all modification methods to see if + any of them succeed. This instantiation can fail if the collection does not have a constructor that can be called + with default values.
      +
      +
      Type Parameters:
      +
      E - the type of elements in the collection
      +
      Returns:
      +
      The matcher
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/package-summary.html b/docs/javadoc/4.0/org/hamcrest/collection/package-summary.html new file mode 100644 index 00000000..ff11b7c6 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/package-summary.html @@ -0,0 +1,181 @@ + + + + +org.hamcrest.collection (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.collection

+
+
+
+
package org.hamcrest.collection
+
+
Matchers of arrays and collections.
+
+
+
+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/collection/package-tree.html b/docs/javadoc/4.0/org/hamcrest/collection/package-tree.html new file mode 100644 index 00000000..da4f1d3f --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/collection/package-tree.html @@ -0,0 +1,110 @@ + + + + +org.hamcrest.collection Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.collection

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/comparator/ComparatorMatcherBuilder.html b/docs/javadoc/4.0/org/hamcrest/comparator/ComparatorMatcherBuilder.html new file mode 100644 index 00000000..5314304a --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/comparator/ComparatorMatcherBuilder.html @@ -0,0 +1,322 @@ + + + + +ComparatorMatcherBuilder (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class ComparatorMatcherBuilder<T>

+
+
java.lang.Object +
org.hamcrest.comparator.ComparatorMatcherBuilder<T>
+
+
+
+
+
Type Parameters:
+
T - the type of the value being compared/matched.
+
+
+
public final class ComparatorMatcherBuilder<T> +extends Object
+
Builder for matchers that allow matchers to use a corresponding Compartor
+
+
+
+
    + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    + +
    comparedBy(Comparator<T> comparator)
    +
    +
    Creates a matcher factory for matchers of Comparatorss of T.
    +
    + + +
    +
    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.
    +
    + +
    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.
    +
    + + +
    +
    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.
    +
    + +
    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.
    +
    + + +
    +
    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 Comparable<T>>
    ComparatorMatcherBuilder<T>
    + +
    +
    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 Details

    +
      +
    • +
      +

      usingNaturalOrdering

      +
      +
      public static <T extends Comparable<T>> +ComparatorMatcherBuilder<T> usingNaturalOrdering()
      +
      Creates a matcher factory for matchers of Comparables. + For example: +
      assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      comparedBy

      +
      +
      public static <T> ComparatorMatcherBuilder<T> comparedBy(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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      comparator - the comparator for the matcher to use.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/comparator/package-summary.html b/docs/javadoc/4.0/org/hamcrest/comparator/package-summary.html new file mode 100644 index 00000000..a896d685 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/comparator/package-summary.html @@ -0,0 +1,108 @@ + + + + +org.hamcrest.comparator (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.comparator

+
+
+
+
package org.hamcrest.comparator
+
+
Helper classes for building matcher comparators.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    Builder for matchers that allow matchers to use a corresponding Compartor
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/comparator/package-tree.html b/docs/javadoc/4.0/org/hamcrest/comparator/package-tree.html new file mode 100644 index 00000000..c2c0fbb2 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/comparator/package-tree.html @@ -0,0 +1,76 @@ + + + + +org.hamcrest.comparator Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.comparator

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/AllOf.html b/docs/javadoc/4.0/org/hamcrest/core/AllOf.html new file mode 100644 index 00000000..09ed9449 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/AllOf.html @@ -0,0 +1,318 @@ + + + + +AllOf (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class AllOf<T>

+
+ +
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
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 Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(Object o, + Description mismatch)
      +
      Description copied from class: DiagnosingMatcher
      +
      Evaluates the matcher for argument item.
      +
      +
      Specified by:
      +
      matches in class DiagnosingMatcher<T>
      +
      Parameters:
      +
      o - the value to check
      +
      mismatch - the description for the matcher
      +
      Returns:
      +
      true if item matches, otherwise false.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - all the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - all the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/AnyOf.html b/docs/javadoc/4.0/org/hamcrest/core/AnyOf.html new file mode 100644 index 00000000..e9cc101d --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/AnyOf.html @@ -0,0 +1,372 @@ + + + + +AnyOf (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class AnyOf<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.AnyOf<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
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 Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - any the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matchers - any the matchers must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matches

      +
      +
      protected boolean matches(Object o, + boolean shortcut)
      +
      Evaluates the argument o against the delegate matchers. + + Evaluation will stop at the first matcher that evaluates to the value of the + shortcut argument.
      +
      +
      Parameters:
      +
      o - the value to check
      +
      shortcut - the match result to be checked against all delegate matchers
      +
      Returns:
      +
      the value of shortcut if all delegate matchers give the same value
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description, + String operator)
      +
      Describe this matcher to description
      +
      +
      Parameters:
      +
      description - the description target
      +
      operator - the separate to use when joining the matcher descriptions
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html b/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html new file mode 100644 index 00000000..a0e53b3b --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.CombinableBothMatcher.html @@ -0,0 +1,207 @@ + + + + +CombinableMatcher.CombinableBothMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class CombinableMatcher.CombinableBothMatcher<X>

+
+
java.lang.Object +
org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<X>
+
+
+
+
+
Type Parameters:
+
X - the combined matcher type
+
+
+
Enclosing class:
+
CombinableMatcher<T>
+
+
+
public static final class CombinableMatcher.CombinableBothMatcher<X> +extends Object
+
Allows syntactic sugar of using both and and.
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      CombinableBothMatcher

      +
      +
      public CombinableBothMatcher(Matcher<? super X> matcher)
      +
      Constructor, best called from CombinableMatcher.both(Matcher).
      +
      +
      Parameters:
      +
      matcher - the first matcher
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      and

      +
      +
      public CombinableMatcher<X> and(Matcher<? super X> other)
      +
      Specify the second matcher in a CombinableMatcher pair.
      +
      +
      Parameters:
      +
      other - the second matcher
      +
      Returns:
      +
      the combined matcher
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html b/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html new file mode 100644 index 00000000..1d93bc9c --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.CombinableEitherMatcher.html @@ -0,0 +1,207 @@ + + + + +CombinableMatcher.CombinableEitherMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class CombinableMatcher.CombinableEitherMatcher<X>

+
+
java.lang.Object +
org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher<X>
+
+
+
+
+
Type Parameters:
+
X - the combined matcher type
+
+
+
Enclosing class:
+
CombinableMatcher<T>
+
+
+
public static final class CombinableMatcher.CombinableEitherMatcher<X> +extends Object
+
Allows syntactic sugar of using either and or.
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      CombinableEitherMatcher

      +
      +
      public CombinableEitherMatcher(Matcher<? super X> matcher)
      +
      Constructor, best called from CombinableMatcher.either(Matcher)
      +
      +
      Parameters:
      +
      matcher - the matcher
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      or

      +
      +
      public CombinableMatcher<X> or(Matcher<? super X> other)
      +
      Specify the second matcher in a CombinableMatcher pair.
      +
      +
      Parameters:
      +
      other - the second matcher
      +
      Returns:
      +
      the combined matcher
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.html b/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.html new file mode 100644 index 00000000..bb137a26 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/CombinableMatcher.html @@ -0,0 +1,381 @@ + + + + +CombinableMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class CombinableMatcher<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.core.CombinableMatcher<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the type of matcher being combined.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class CombinableMatcher<T> +extends TypeSafeDiagnosingMatcher<T>
+
Allows matchers of the same type to be combined using + either/or, or + both/and. + + For example: + +
 import static org.hamcrest.core.CombinableMatcher.either;
+ import static org.hamcrest.core.CombinableMatcher.both;
+ import static org.hamcrest.Matchers.equalTo;
+ import static org.hamcrest.Matchers.not;
+
+ Matcher<Integer> either_3_or_4 = either(equalTo(3)).or(equalTo(4));
+ Matcher<Integer> neither_3_nor_4 = both(not(equalTo(3))).and(not(equalTo(4)));
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      CombinableMatcher

      +
      +
      public CombinableMatcher(Matcher<? super T> matcher)
      +
      Constructor, best called from either or both.
      +
      +
      Parameters:
      +
      matcher - the starting matcher
      +
      See Also:
      +
      + +
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      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>
      +
      Parameters:
      +
      item - the item.
      +
      mismatch - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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)
      +
      Specify the second matcher in a CombinableMatcher pair.
      +
      +
      Parameters:
      +
      other - the second matcher
      +
      Returns:
      +
      the combined matcher
      +
      +
      +
      +
    • +
    • +
      +

      or

      +
      +
      public CombinableMatcher<T> or(Matcher<? super T> other)
      +
      Specify the second matcher in a CombinableMatcher pair.
      +
      +
      Parameters:
      +
      other - the second matcher
      +
      Returns:
      +
      the combined matcher
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      LHS - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to combine, and both must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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")))
      +
      +
      Type Parameters:
      +
      LHS - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to combine, and either must pass.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/DescribedAs.html b/docs/javadoc/4.0/org/hamcrest/core/DescribedAs.html new file mode 100644 index 00000000..39132221 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/DescribedAs.html @@ -0,0 +1,305 @@ + + + + +DescribedAs (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class DescribedAs<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.DescribedAs<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class DescribedAs<T> +extends BaseMatcher<T>
+
Provides a custom description to another matcher.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      DescribedAs

      +
      +
      public DescribedAs(String descriptionTemplate, + Matcher<T> matcher, + Object[] values)
      +
      Constructor, best called from describedAs(String, Matcher, Object...).
      +
      +
      Parameters:
      +
      descriptionTemplate - the new description for the wrapped matcher
      +
      matcher - the matcher to wrap
      +
      values - optional values to insert into the tokenised description
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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(String descriptionTemplate, + Matcher<T> matcher, + 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())
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      descriptionTemplate - the new description for the wrapped matcher
      +
      matcher - the matcher to wrap
      +
      values - optional values to insert into the tokenised description
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/Every.html b/docs/javadoc/4.0/org/hamcrest/core/Every.html new file mode 100644 index 00000000..96cf787e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/Every.html @@ -0,0 +1,265 @@ + + + + +Every (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class Every<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<? extends T>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Iterable<? extends T>> +
org.hamcrest.core.Every<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the type of the items in the iterable
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<? extends T>>, SelfDescribing
+
+
+
public class Every<T> +extends TypeSafeDiagnosingMatcher<Iterable<? extends T>>
+
A matcher that applies a delegate matcher to every item in an Iterable.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Every

      +
      +
      public Every(Matcher<? super T> matcher)
      +
      Constructor, best called from everyItem(Matcher).
      +
      +
      Parameters:
      +
      matcher - a matcher used to check every item in the iterable.
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(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<Iterable<? extends T>>
      +
      Parameters:
      +
      collection - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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")))
      +
      +
      Type Parameters:
      +
      U - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher to apply to every item provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/Is.html b/docs/javadoc/4.0/org/hamcrest/core/Is.html new file mode 100644 index 00000000..94e24f6a --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/Is.html @@ -0,0 +1,354 @@ + + + + +Is (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class Is<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.Is<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
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 Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher to wrap.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isA

      +
      +
      public static <T> Matcher<T> isA(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)))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsAnything.html b/docs/javadoc/4.0/org/hamcrest/core/IsAnything.html new file mode 100644 index 00000000..7b650486 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsAnything.html @@ -0,0 +1,286 @@ + + + + +IsAnything (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsAnything<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsAnything<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class IsAnything<T> +extends BaseMatcher<T>
+
A matcher that always returns true.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsAnything

      +
      +
      public IsAnything()
      +
      Constructor, best called from anything().
      +
      +
      +
    • +
    • +
      +

      IsAnything

      +
      +
      public IsAnything(String message)
      +
      Constructor, best called from anything(String).
      +
      +
      Parameters:
      +
      message - matcher description
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(Object o)
      +
      Always returns true.
      +
      +
      Parameters:
      +
      o - the object against which the matcher is evaluated.
      +
      Returns:
      +
      true
      +
      See Also:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<Object> anything()
      +
      Creates a matcher that always matches, regardless of the examined object.
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      anything

      +
      +
      public static Matcher<Object> anything(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsCollectionContaining.html b/docs/javadoc/4.0/org/hamcrest/core/IsCollectionContaining.html new file mode 100644 index 00000000..7ef5109a --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsCollectionContaining.html @@ -0,0 +1,392 @@ + + + + +IsCollectionContaining (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsCollectionContaining<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<? extends T>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Iterable<? extends T>> +
org.hamcrest.core.IsCollectionContaining<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the collection element type
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<? extends T>>, SelfDescribing
+
+
+
@Deprecated +public class IsCollectionContaining<T> +extends TypeSafeDiagnosingMatcher<Iterable<? extends T>>
+
Deprecated. +
As of release 2.1, replaced by IsIterableContaining.
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(Iterable<? extends 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<Iterable<? extends T>>
      +
      Parameters:
      +
      collection - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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 + 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

      +
      +
      @Deprecated +public static <T> Matcher<Iterable<? extends T>> hasItem(Matcher<? super T> itemMatcher)
      +
      Deprecated. + +
      +
      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItem

      +
      +
      @Deprecated +public static <T> Matcher<Iterable<? extends 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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      item - the item to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @Deprecated +@SafeVarargs +public static <T> Matcher<Iterable<? extends T>> hasItems(Matcher<? super T>... itemMatchers)
      +
      Deprecated. + +
      +
      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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @Deprecated +@SafeVarargs +public static <T> Matcher<Iterable<? extends T>> hasItems(T... items)
      +
      Deprecated. + +
      +
      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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      items - the items to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsEqual.html b/docs/javadoc/4.0/org/hamcrest/core/IsEqual.html new file mode 100644 index 00000000..2119bd06 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsEqual.html @@ -0,0 +1,303 @@ + + + + +IsEqual (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsEqual<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsEqual<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
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) method.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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"}));
      + 
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      operand - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      equalToObject

      +
      +
      public static Matcher<Object> equalToObject(Object operand)
      +
      Creates an IsEqual matcher that does not enforce the values being + compared to be of the same static type.
      +
      +
      Parameters:
      +
      operand - the value to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsInstanceOf.html b/docs/javadoc/4.0/org/hamcrest/core/IsInstanceOf.html new file mode 100644 index 00000000..73cf488d --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsInstanceOf.html @@ -0,0 +1,297 @@ + + + + +IsInstanceOf (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsInstanceOf

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<Object>, SelfDescribing
+
+
+
public class IsInstanceOf +extends DiagnosingMatcher<Object>
+
Tests whether the value is an instance of a class. + Classes of basic types will be converted to the relevant "Object" classes
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsInstanceOf

      +
      +
      public IsInstanceOf(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 Details

    +
      +
    • +
      +

      matches

      +
      +
      protected boolean matches(Object item, + Description mismatch)
      +
      Description copied from class: DiagnosingMatcher
      +
      Evaluates the matcher for argument item.
      +
      +
      Specified by:
      +
      matches in class DiagnosingMatcher<Object>
      +
      Parameters:
      +
      item - the value to check
      +
      mismatch - the description for the matcher
      +
      Returns:
      +
      true if item matches, otherwise false.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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));
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      any

      +
      +
      public static <T> Matcher<T> any(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));
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - the type to check.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsIterableContaining.html b/docs/javadoc/4.0/org/hamcrest/core/IsIterableContaining.html new file mode 100644 index 00000000..72861636 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsIterableContaining.html @@ -0,0 +1,367 @@ + + + + +IsIterableContaining (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsIterableContaining<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Iterable<? extends T>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Iterable<? extends T>> +
org.hamcrest.core.IsIterableContaining<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the type of items in the iterable
+
+
+
All Implemented Interfaces:
+
Matcher<Iterable<? extends T>>, SelfDescribing
+
+
+
public class IsIterableContaining<T> +extends TypeSafeDiagnosingMatcher<Iterable<? extends T>>
+
Tests if an iterable contains matching elements.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(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<Iterable<? extends T>>
      +
      Parameters:
      +
      collection - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<Iterable<? extends 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatcher - the matcher to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItem

      +
      +
      public static <T> Matcher<Iterable<? extends 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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      item - the item to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @SafeVarargs +public static <T> Matcher<Iterable<? extends 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      itemMatchers - the matchers to apply to items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasItems

      +
      +
      @SafeVarargs +public static <T> Matcher<Iterable<? extends 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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      items - the items to compare against the items provided by the examined Iterable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsNot.html b/docs/javadoc/4.0/org/hamcrest/core/IsNot.html new file mode 100644 index 00000000..905aae72 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsNot.html @@ -0,0 +1,292 @@ + + + + +IsNot (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsNot<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsNot<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class IsNot<T> +extends BaseMatcher<T>
+
Calculates the logical negation of a matcher.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsNot

      +
      +
      public IsNot(Matcher<T> matcher)
      +
      Constructor, best called from not(Object) or + not(Matcher).
      +
      +
      Parameters:
      +
      matcher - the matcher to negate
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      matcher - the matcher whose sense should be inverted
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value that any examined object should not equal
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsNull.html b/docs/javadoc/4.0/org/hamcrest/core/IsNull.html new file mode 100644 index 00000000..c8d907ff --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsNull.html @@ -0,0 +1,336 @@ + + + + +IsNull (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsNull<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsNull<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class IsNull<T> +extends BaseMatcher<T>
+
Is the value null?
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<Object> nullValue()
      +

      Creates a matcher that matches if examined object is null. +

      + For example: +
      assertThat(cheese, is(nullValue())
      +
      +
      Returns:
      +
      The matcher
      +
      +
      +
      +
    • +
    • +
      +

      notNullValue

      +
      +
      public static Matcher<Object> notNullValue()
      +
      A shortcut to the frequently used not(nullValue()). + For example: +
      assertThat(cheese, is(notNullValue()))
      + instead of: +
      assertThat(cheese, is(not(nullValue())))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      nullValue

      +
      +
      public static <T> Matcher<T> nullValue(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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - dummy parameter used to infer the generic type of the returned matcher
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      notNullValue

      +
      +
      public static <T> Matcher<T> notNullValue(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))))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      type - dummy parameter used to infer the generic type of the returned matcher
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/IsSame.html b/docs/javadoc/4.0/org/hamcrest/core/IsSame.html new file mode 100644 index 00000000..88cbb3f6 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/IsSame.html @@ -0,0 +1,288 @@ + + + + +IsSame (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsSame<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsSame<T>
+
+
+
+
+
+
Type Parameters:
+
T - the matched value type
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class IsSame<T> +extends BaseMatcher<T>
+
Is the value the same object as another value?
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matches

      +
      +
      public boolean matches(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:
      +
      + +
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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.
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      target - the target instance against which others should be assessed
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      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.
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      target - the target instance against which others should be assessed
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/StringContains.html b/docs/javadoc/4.0/org/hamcrest/core/StringContains.html new file mode 100644 index 00000000..1a645104 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/StringContains.html @@ -0,0 +1,294 @@ + + + + +StringContains (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class StringContains

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class StringContains +extends SubstringMatcher
+
Tests if the argument is a string that contains a specific substring.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      StringContains

      +
      +
      public StringContains(String substring)
      +
      Constructor, best used with containsString(String).
      +
      +
      Parameters:
      +
      substring - the expected substring.
      +
      +
      +
      +
    • +
    • +
      +

      StringContains

      +
      +
      public StringContains(boolean ignoringCase, + String substring)
      + +
      +
      Parameters:
      +
      ignoringCase - whether to ignore case when matching
      +
      substring - the expected substring.
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      evalSubstringOf

      +
      +
      protected boolean evalSubstringOf(String s)
      +
      Description copied from class: SubstringMatcher
      +
      Checks if the input matches the specific substring.
      +
      +
      Specified by:
      +
      evalSubstringOf in class SubstringMatcher
      +
      Parameters:
      +
      s - the string to check
      +
      Returns:
      +
      the result of the match
      +
      +
      +
      +
    • +
    • +
      +

      containsString

      +
      +
      public static Matcher<String> containsString(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      containsStringIgnoringCase

      +
      +
      public static Matcher<String> containsStringIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/StringEndsWith.html b/docs/javadoc/4.0/org/hamcrest/core/StringEndsWith.html new file mode 100644 index 00000000..d71d42ad --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/StringEndsWith.html @@ -0,0 +1,294 @@ + + + + +StringEndsWith (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class StringEndsWith

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class StringEndsWith +extends SubstringMatcher
+
Tests if the argument is a string that ends with a specific substring.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      StringEndsWith

      +
      +
      public StringEndsWith(String suffix)
      +
      Constructor, best used with endsWith(String).
      +
      +
      Parameters:
      +
      suffix - the expected end of the string.
      +
      +
      +
      +
    • +
    • +
      +

      StringEndsWith

      +
      +
      public StringEndsWith(boolean ignoringCase, + String suffix)
      +
      Constructor, best used with endsWith(String) or + endsWithIgnoringCase(String).
      +
      +
      Parameters:
      +
      ignoringCase - whether to ignore case when matching
      +
      suffix - the expected end of the string.
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      evalSubstringOf

      +
      +
      protected boolean evalSubstringOf(String s)
      +
      Description copied from class: SubstringMatcher
      +
      Checks if the input matches the specific substring.
      +
      +
      Specified by:
      +
      evalSubstringOf in class SubstringMatcher
      +
      Parameters:
      +
      s - the string to check
      +
      Returns:
      +
      the result of the match
      +
      +
      +
      +
    • +
    • +
      +

      endsWith

      +
      +
      public static Matcher<String> endsWith(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      endsWithIgnoringCase

      +
      +
      public static Matcher<String> endsWithIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/StringRegularExpression.html b/docs/javadoc/4.0/org/hamcrest/core/StringRegularExpression.html new file mode 100644 index 00000000..5fabef55 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/StringRegularExpression.html @@ -0,0 +1,284 @@ + + + + +StringRegularExpression (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class StringRegularExpression

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class StringRegularExpression +extends TypeSafeDiagnosingMatcher<String>
+
A matcher that checks a string against a regular expression.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      StringRegularExpression

      +
      +
      protected StringRegularExpression(Pattern pattern)
      +
      Constructor, best used from matchesRegex(String).
      +
      +
      Parameters:
      +
      pattern - the regular expression to match against
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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(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<String>
      +
      Parameters:
      +
      actual - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesRegex

      +
      +
      public static Matcher<String> matchesRegex(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<String> matchesRegex(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/4.0/org/hamcrest/core/StringStartsWith.html b/docs/javadoc/4.0/org/hamcrest/core/StringStartsWith.html new file mode 100644 index 00000000..9f4b54cf --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/StringStartsWith.html @@ -0,0 +1,300 @@ + + + + +StringStartsWith (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class StringStartsWith

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class StringStartsWith +extends SubstringMatcher
+
Tests if the argument is a string that starts with a specific substring.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      StringStartsWith

      +
      +
      public StringStartsWith(String prefix)
      +
      Constructor, best used with startsWith(String).
      +
      +
      Parameters:
      +
      prefix - the expected start of the string.
      +
      +
      +
      +
    • +
    • +
      +

      StringStartsWith

      +
      +
      public StringStartsWith(boolean ignoringCase, + String prefix)
      +
      Constructor, best used with startsWith(String) or + startsWithIgnoringCase(String).
      +
      +
      Parameters:
      +
      ignoringCase - whether to ignore case when matching
      +
      prefix - the expected start of the string.
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      evalSubstringOf

      +
      +
      protected boolean evalSubstringOf(String s)
      +
      Description copied from class: SubstringMatcher
      +
      Checks if the input matches the specific substring.
      +
      +
      Specified by:
      +
      evalSubstringOf in class SubstringMatcher
      +
      Parameters:
      +
      s - the string to check
      +
      Returns:
      +
      the result of the match
      +
      +
      +
      +
    • +
    • +
      +

      startsWith

      +
      +
      public static Matcher<String> startsWith(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      startsWithIgnoringCase

      +
      +
      public static Matcher<String> startsWithIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/SubstringMatcher.html b/docs/javadoc/4.0/org/hamcrest/core/SubstringMatcher.html new file mode 100644 index 00000000..d5d2a0e9 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/SubstringMatcher.html @@ -0,0 +1,359 @@ + + + + +SubstringMatcher (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class SubstringMatcher

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
Direct Known Subclasses:
+
StringContains, StringEndsWith, StringStartsWith
+
+
+
public abstract class SubstringMatcher +extends TypeSafeMatcher<String>
+
Common behaviour for matchers that check substrings.
+
+
See Also:
+
+ +
+
+
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      substring

      +
      +
      protected final String substring
      +
      The substring to match
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      SubstringMatcher

      +
      +
      protected SubstringMatcher(String relationship, + boolean ignoringCase, + String substring)
      +
      Build a SubstringMatcher.
      +
      +
      Parameters:
      +
      relationship - a description of the matcher, such as "containing", "ending with", or "starting with"
      +
      ignoringCase - true for case-insensitive match
      +
      substring - the substring to match
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(String item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(String item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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 String converted(String arg)
      +
      Helper method to allow subclasses to handle case insensitivity.
      +
      +
      Parameters:
      +
      arg - the string to adjust for case
      +
      Returns:
      +
      the input string in lowercase if ignoring case, otherwise the original string
      +
      +
      +
      +
    • +
    • +
      +

      evalSubstringOf

      +
      +
      protected abstract boolean evalSubstringOf(String string)
      +
      Checks if the input matches the specific substring.
      +
      +
      Parameters:
      +
      string - the string to check
      +
      Returns:
      +
      the result of the match
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/package-summary.html b/docs/javadoc/4.0/org/hamcrest/core/package-summary.html new file mode 100644 index 00000000..062d429c --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/package-summary.html @@ -0,0 +1,192 @@ + + + + +org.hamcrest.core (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.core

+
+
+
+
package org.hamcrest.core
+
+
Fundamental matchers of objects and values, and composite matchers.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    Calculates the logical conjunction of multiple matchers.
    +
    + +
    +
    Calculates the logical disjunction of multiple matchers.
    +
    + +
    +
    Allows matchers of the same type to be combined using + either/or, or + both/and.
    +
    + +
    +
    Allows syntactic sugar of using both and and.
    +
    + +
    +
    Allows syntactic sugar of using either and or.
    +
    + +
    +
    Provides a custom description to another matcher.
    +
    + +
    +
    A matcher that applies a delegate matcher to every item in an Iterable.
    +
    +
    Is<T>
    +
    +
    Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive.
    +
    + +
    +
    A matcher that always returns true.
    +
    + +
    Deprecated. +
    As of release 2.1, replaced by IsIterableContaining.
    +
    + +
    +
    Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) method.
    +
    + +
    +
    Tests whether the value is an instance of a class.
    +
    + +
    +
    Tests if an iterable contains matching elements.
    +
    + +
    +
    Calculates the logical negation of a matcher.
    +
    + +
    +
    Is the value null?
    +
    + +
    +
    Is the value the same object as another value?
    +
    + +
    +
    Tests if the argument is a string that contains a specific substring.
    +
    + +
    +
    Tests if the argument is a string that ends with a specific substring.
    +
    + +
    +
    A matcher that checks a string against a regular expression.
    +
    + +
    +
    Tests if the argument is a string that starts with a specific substring.
    +
    + +
    +
    Common behaviour for matchers that check substrings.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/core/package-tree.html b/docs/javadoc/4.0/org/hamcrest/core/package-tree.html new file mode 100644 index 00000000..085b63af --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/core/package-tree.html @@ -0,0 +1,115 @@ + + + + +org.hamcrest.core Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.core

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/exception/ThrowsException.html b/docs/javadoc/4.0/org/hamcrest/exception/ThrowsException.html new file mode 100644 index 00000000..fd1c8d82 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/exception/ThrowsException.html @@ -0,0 +1,432 @@ + + + + +ThrowsException (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class ThrowsException<T extends Runnable>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.exception.ThrowsException<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the type of the matched Runnable
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class ThrowsException<T extends Runnable> +extends TypeSafeDiagnosingMatcher<T>
+
Tests if a Runnable throws a matching exception.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      ThrowsException

      +
      +
      public ThrowsException(IsInstanceOf classMatcher, + Matcher<? super String> messageMatcher)
      +
      Constructor, best called from one of the static throwsException() methods.
      +
      +
      Parameters:
      +
      classMatcher - the matcher for the type of the exception
      +
      messageMatcher - the matcher for the exception message
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable> Matcher<T> throwsException()
      +
      Matcher for Runnable that expects an exception to be thrown
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(U throwable)
      +
      Matcher for Throwable that expects that the Runnable throws an exception equal + to the provided throwable
      +
      +
      Type Parameters:
      +
      T - type of the Throwable
      +
      U - type of the Runnable
      +
      Parameters:
      +
      throwable - the Throwable class against which examined exceptions are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(Class<U> throwableClass)
      +
      Matcher for Throwable that expects that the Runnable throws an exception of the + provided throwableClass class
      +
      +
      Type Parameters:
      +
      T - type of the Throwable
      +
      U - type of the Runnable
      +
      Parameters:
      +
      throwableClass - the Throwable class against which examined exceptions are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(Class<U> throwableClass, + String exactMessage)
      +
      Matcher for Throwable that expects that the Runnable throws an exception of the + provided throwableClass class and has a message equal to the provided + message
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      U - type of the Throwable
      +
      Parameters:
      +
      throwableClass - the Throwable class against which examined exceptions are compared
      +
      exactMessage - the String against which examined exception messages are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsException

      +
      +
      public static <T extends Runnable, +U extends Throwable> +Matcher<T> throwsException(Class<U> throwableClass, + Matcher<String> messageMatcher)
      +
      Matcher for Throwable that expects that the Runnable throws an exception of the provided + throwableClass class and has a message matching the provided + messageMatcher
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      U - type of the Throwable
      +
      Parameters:
      +
      throwableClass - the Throwable class against which examined exceptions are compared
      +
      messageMatcher - matcher to validate exception's message
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsExceptionWithMessage

      +
      +
      public static <T extends Runnable> Matcher<T> throwsExceptionWithMessage(String exactMessage)
      +
      Matcher for Throwable that expects that the Runnable throws an exception with a message equal to the provided message
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      Parameters:
      +
      exactMessage - the String against which examined exception messages are compared
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      throwsExceptionWithMessage

      +
      +
      public static <T extends Runnable> Matcher<T> throwsExceptionWithMessage(Matcher<String> messageMatcher)
      +
      Matcher for Throwable that expects that the Runnable throws an exception with a message matching the provided messageMatcher
      +
      +
      Type Parameters:
      +
      T - type of the Runnable
      +
      Parameters:
      +
      messageMatcher - matcher to validate exception's message
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(T runnable, + 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<T extends Runnable>
      +
      Parameters:
      +
      runnable - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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/4.0/org/hamcrest/exception/package-summary.html b/docs/javadoc/4.0/org/hamcrest/exception/package-summary.html new file mode 100644 index 00000000..f505bf22 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/exception/package-summary.html @@ -0,0 +1,108 @@ + + + + +org.hamcrest.exception (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.exception

+
+
+
+
package org.hamcrest.exception
+
+
Matchers of exceptions.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    Tests if a Runnable throws a matching exception.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/exception/package-tree.html b/docs/javadoc/4.0/org/hamcrest/exception/package-tree.html new file mode 100644 index 00000000..4859336f --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/exception/package-tree.html @@ -0,0 +1,84 @@ + + + + +org.hamcrest.exception Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.exception

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/io/FileMatchers.FileStatus.html b/docs/javadoc/4.0/org/hamcrest/io/FileMatchers.FileStatus.html new file mode 100644 index 00000000..f05be70a --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/io/FileMatchers.FileStatus.html @@ -0,0 +1,145 @@ + + + + +FileMatchers.FileStatus (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Interface FileMatchers.FileStatus

+
+
+
+
+
Enclosing class:
+
FileMatchers
+
+
+
public static interface FileMatchers.FileStatus
+
Checks the status of a File.
+
+
+
+
    + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    boolean
    +
    check(File actual)
    +
    +
    Checks the give file against a status.
    +
    +
    +
    +
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      check

      +
      +
      boolean check(File actual)
      +
      Checks the give file against a status.
      +
      +
      Parameters:
      +
      actual - the file to check
      +
      Returns:
      +
      true if the file status matches, otherwise false.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/io/FileMatchers.html b/docs/javadoc/4.0/org/hamcrest/io/FileMatchers.html new file mode 100644 index 00000000..b3d43712 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/io/FileMatchers.html @@ -0,0 +1,486 @@ + + + + +FileMatchers (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class FileMatchers

+
+
java.lang.Object +
org.hamcrest.io.FileMatchers
+
+
+
+
+
public final class FileMatchers +extends Object
+
Matchers for properties of files.
+
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      anExistingDirectory

      +
      +
      public static Matcher<File> anExistingDirectory()
      +
      A matcher that checks if a directory exists.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      anExistingFileOrDirectory

      +
      +
      public static Matcher<File> anExistingFileOrDirectory()
      +
      A matcher that checks if a file or directory exists.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      anExistingFile

      +
      +
      public static Matcher<File> anExistingFile()
      +
      A matcher that checks if a file exists.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      aReadableFile

      +
      +
      public static Matcher<File> aReadableFile()
      +
      A matcher that checks if a file is readable.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      aWritableFile

      +
      +
      public static Matcher<File> aWritableFile()
      +
      A matcher that checks if a directory is writable.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      aFileWithSize

      +
      +
      public static Matcher<File> aFileWithSize(long size)
      +
      A matcher that checks if a file has a specific size.
      +
      +
      Parameters:
      +
      size - the expected size
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      aFileWithSize

      +
      +
      public static Matcher<File> aFileWithSize(Matcher<Long> expected)
      +
      A matcher that checks if a file size matches an expected size.
      +
      +
      Parameters:
      +
      expected - matcher for the expected size
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      aFileNamed

      +
      +
      public static Matcher<File> aFileNamed(Matcher<String> expected)
      +
      A matcher that checks if a file name matches an expected name.
      +
      +
      Parameters:
      +
      expected - the expected name
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      aFileWithCanonicalPath

      +
      +
      public static Matcher<File> aFileWithCanonicalPath(Matcher<String> expected)
      +
      A matcher that checks if a file canonical path matches an expected path.
      +
      +
      Parameters:
      +
      expected - the expected path
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      aFileWithAbsolutePath

      +
      +
      public static Matcher<File> aFileWithAbsolutePath(Matcher<String> expected)
      +
      A matcher that checks if a file absolute path matches an expected path.
      +
      +
      Parameters:
      +
      expected - the expected path
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      matchesContentOf

      +
      +
      public static Matcher<File> matchesContentOf(File expected)
      +
      Matcher for matching file content with given file
      +
      +
      Parameters:
      +
      expected - The file has expected content
      +
      Returns:
      +
      A FeatureMatcher that takes the content of a file as feature
      +
      +
      +
      +
    • +
    • +
      +

      aFileWithContent

      +
      +
      public static Matcher<File> aFileWithContent(Matcher<String> expected)
      +
      Matcher for matching file content with given String Matcher
      +
      +
      Parameters:
      +
      expected - The expected content Matcher
      +
      Returns:
      +
      A FeatureMatcher that takes the content of a file as feature
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/io/PathMatchers.html b/docs/javadoc/4.0/org/hamcrest/io/PathMatchers.html new file mode 100644 index 00000000..4dded988 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/io/PathMatchers.html @@ -0,0 +1,563 @@ + + + + +PathMatchers (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class PathMatchers

+
+
java.lang.Object +
org.hamcrest.io.PathMatchers
+
+
+
+
+
public final class PathMatchers +extends Object
+
Matchers for properties of files.
+
+
+
+ +
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      anExistingDirectory

      +
      +
      public static Matcher<Path> anExistingDirectory()
      +
      A matcher that checks if a directory exists.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      anExistingFileOrDirectory

      +
      +
      public static Matcher<Path> anExistingFileOrDirectory()
      +
      A matcher that checks if a file or directory exists.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      anExistingFile

      +
      +
      public static Matcher<Path> anExistingFile()
      +
      A matcher that checks if a file exists.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      isReadable

      +
      +
      public static Matcher<Path> isReadable()
      +
      A matcher that checks if a file or directory is readable.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      isWritable

      +
      +
      public static Matcher<Path> isWritable()
      +
      A matcher that checks if a file/directory is writable.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      isExecutable

      +
      +
      public static Matcher<Path> isExecutable()
      +
      A matcher that checks if a file/directory is executable.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      isSameFile

      +
      +
      public static Matcher<Path> isSameFile(Path target)
      +
      A matcher that checks if a file/directory is the same file.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      isSymbolicLink

      +
      +
      public static Matcher<Path> isSymbolicLink()
      +
      A matcher that checks if a file/directory is a symbolic link.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      isHidden

      +
      +
      public static Matcher<Path> isHidden()
      +
      A matcher that checks if a file/directory is hidden.
      +
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasSizeEqualTo

      +
      +
      public static Matcher<Path> hasSizeEqualTo(long size)
      +
      A matcher that checks if a file has a specific size.
      +
      +
      Parameters:
      +
      size - the expected size
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasSize

      +
      +
      public static Matcher<Path> hasSize(Matcher<Long> expected)
      +
      A matcher that checks if a file size matches an expected size.
      +
      +
      Parameters:
      +
      expected - matcher for the expected size
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasFileName

      +
      +
      public static Matcher<Path> hasFileName(Matcher<Path> expected)
      +
      A matcher that checks if a file name matches an expected name.
      +
      +
      Parameters:
      +
      expected - the expected name
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasFileNameString

      +
      +
      public static Matcher<Path> hasFileNameString(Matcher<String> expected)
      +
      A matcher that checks if a file name matches an expected String.
      +
      +
      Parameters:
      +
      expected - the expected name
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasRealPath

      +
      +
      public static Matcher<Path> hasRealPath(Matcher<Path> expected)
      +
      A matcher that checks if a file real path matches an expected path.
      +
      +
      Parameters:
      +
      expected - the expected path
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasRealPathString

      +
      +
      public static Matcher<Path> hasRealPathString(Matcher<String> expected)
      +
      A matcher that checks if a file real path matches an expected String.
      +
      +
      Parameters:
      +
      expected - the expected path
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasCanonicalPathString

      +
      +
      @Deprecated +public static Matcher<Path> hasCanonicalPathString(Matcher<String> expected)
      +
      Deprecated. +
      Use hasRealPath(Matcher) instead. Provided for backward compatibility with FileMatchers.
      +
      +
      A matcher that checks if a file canonical path matches an expected path.
      +
      +
      Parameters:
      +
      expected - the expected path
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasAbsolutePath

      +
      +
      public static Matcher<Path> hasAbsolutePath(Matcher<Path> expected)
      +
      A matcher that checks if a file absolute path matches an expected path.
      +
      +
      Parameters:
      +
      expected - the expected path
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasAbsolutePathString

      +
      +
      public static Matcher<Path> hasAbsolutePathString(Matcher<String> expected)
      +
      A matcher that checks if a file absolute path matches an expected String.
      +
      +
      Parameters:
      +
      expected - the expected path String
      +
      Returns:
      +
      the file matcher
      +
      +
      +
      +
    • +
    • +
      +

      hasFileSystem

      +
      +
      public static Matcher<Path> hasFileSystem(Matcher<FileSystem> expected)
      +
      A matcher that checks if a file's FileSystem matches an expected FileSystem.
      +
      +
      Parameters:
      +
      expected -
      +
      Returns:
      +
      +
      +
      +
    • +
    • +
      +

      matchesContentOf

      +
      +
      public static Matcher<Path> matchesContentOf(Path expected)
      +
      Matcher for matching file content with given file path. + +

      + Note: line endings in the file are preserved in their platform dependent form, + so both files must contain the same line endings to match. +

      +
      +
      Parameters:
      +
      expected - The file with the expected content
      +
      Returns:
      +
      A FeatureMatcher that takes the content of a file path as feature
      +
      +
      +
      +
    • +
    • +
      +

      hasContent

      +
      +
      public static Matcher<Path> hasContent(Matcher<String> expected)
      +
      Matcher for matching file content with given String Matcher. + +

      + Note: line endings in the file are converted to '\n' to avoid platform dependent test results +

      +
      +
      Parameters:
      +
      expected - The expected content Matcher
      +
      Returns:
      +
      A FeatureMatcher that takes the content of a file as feature
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/io/package-summary.html b/docs/javadoc/4.0/org/hamcrest/io/package-summary.html new file mode 100644 index 00000000..1bb3d0de --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/io/package-summary.html @@ -0,0 +1,118 @@ + + + + +org.hamcrest.io (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.io

+
+
+
+
package org.hamcrest.io
+
+
Matchers that perform file comparisons.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    +
    +
    +
    Class
    +
    Description
    + +
    +
    Matchers for properties of files.
    +
    + +
    +
    Checks the status of a File.
    +
    + +
    +
    Matchers for properties of files.
    +
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/io/package-tree.html b/docs/javadoc/4.0/org/hamcrest/io/package-tree.html new file mode 100644 index 00000000..14e4826b --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/io/package-tree.html @@ -0,0 +1,83 @@ + + + + +org.hamcrest.io Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.io

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+

Interface Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/number/BigDecimalCloseTo.html b/docs/javadoc/4.0/org/hamcrest/number/BigDecimalCloseTo.html new file mode 100644 index 00000000..db02574e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/number/BigDecimalCloseTo.html @@ -0,0 +1,293 @@ + + + + +BigDecimalCloseTo (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class BigDecimalCloseTo

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<BigDecimal>, SelfDescribing
+
+
+
public class BigDecimalCloseTo +extends TypeSafeMatcher<BigDecimal>
+
A matcher that checks a BigDecimal is close to an expected value.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(BigDecimal item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<BigDecimal>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(BigDecimal item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<BigDecimal>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<BigDecimal> closeTo(BigDecimal operand, + 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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/number/IsCloseTo.html b/docs/javadoc/4.0/org/hamcrest/number/IsCloseTo.html new file mode 100644 index 00000000..644f086d --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/number/IsCloseTo.html @@ -0,0 +1,286 @@ + + + + +IsCloseTo (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsCloseTo

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<Double>, SelfDescribing
+
+
+
public class IsCloseTo +extends TypeSafeMatcher<Double>
+
Is the value a number equal to a value within some range of acceptable error?
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsCloseTo

      +
      +
      public IsCloseTo(double value, + double error)
      +
      Constructor, best called from closeTo(double, double).
      +
      +
      Parameters:
      +
      value - the expected value
      +
      error - the acceptable difference from the expected value
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(Double item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<Double>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(Double item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<Double>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/number/IsNaN.html b/docs/javadoc/4.0/org/hamcrest/number/IsNaN.html new file mode 100644 index 00000000..7c95cf23 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/number/IsNaN.html @@ -0,0 +1,234 @@ + + + + +IsNaN (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsNaN

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<Double>, SelfDescribing
+
+
+
public final class IsNaN +extends TypeSafeMatcher<Double>
+
Is the value a number actually not a number (NaN)?
+
+
+
+ +
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(Double item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<Double>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(Double item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<Double>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<Double> notANumber()
      +
      Creates a matcher of Doubles that matches when an examined double is not a number. + For example: +
      assertThat(Double.NaN, is(notANumber()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/number/OrderingComparison.html b/docs/javadoc/4.0/org/hamcrest/number/OrderingComparison.html new file mode 100644 index 00000000..93ae8708 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/number/OrderingComparison.html @@ -0,0 +1,275 @@ + + + + +OrderingComparison (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class OrderingComparison

+
+
java.lang.Object +
org.hamcrest.number.OrderingComparison
+
+
+
+
+
public class OrderingComparison +extends Object
+
Static methods for building ordering comparisons.
+
+
+
+
    + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    static <T extends 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 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 Comparable<T>>
    Matcher<T>
    + +
    +
    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 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 Comparable<T>>
    Matcher<T>
    + +
    +
    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 Details

    +
      +
    • +
      +

      comparesEqualTo

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      greaterThan

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return greater + than zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      greaterThanOrEqualTo

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return greater + than or equal to zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      lessThan

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return less + than zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      lessThanOrEqualTo

      +
      +
      public static <T extends 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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      value - the value which, when passed to the compareTo method of the examined object, should return less + than or equal to zero
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/number/package-summary.html b/docs/javadoc/4.0/org/hamcrest/number/package-summary.html new file mode 100644 index 00000000..c9f0d485 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/number/package-summary.html @@ -0,0 +1,120 @@ + + + + +org.hamcrest.number (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.number

+
+
+
+
package org.hamcrest.number
+
+
Matchers that perform numeric comparisons.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    A matcher that checks a BigDecimal is close to an expected value.
    +
    + +
    +
    Is the value a number equal to a value within some range of acceptable error?
    +
    + +
    +
    Is the value a number actually not a number (NaN)?
    +
    + +
    +
    Static methods for building ordering comparisons.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/number/package-tree.html b/docs/javadoc/4.0/org/hamcrest/number/package-tree.html new file mode 100644 index 00000000..b51103df --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/number/package-tree.html @@ -0,0 +1,87 @@ + + + + +org.hamcrest.number Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.number

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/object/HasEqualValues.html b/docs/javadoc/4.0/org/hamcrest/object/HasEqualValues.html new file mode 100644 index 00000000..df3ff3c4 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/object/HasEqualValues.html @@ -0,0 +1,236 @@ + + + + +HasEqualValues (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class HasEqualValues<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.object.HasEqualValues<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the type of the object being matched.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class HasEqualValues<T> +extends TypeSafeDiagnosingMatcher<T>
+
A matcher that checks if an object as equal fields values to an expected object.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      HasEqualValues

      +
      +
      public HasEqualValues(T expectedObject)
      +
      Constructor
      +
      +
      Parameters:
      +
      expectedObject - the object with expected field values.
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      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>
      +
      Parameters:
      +
      item - the item.
      +
      mismatch - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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/4.0/org/hamcrest/object/HasToString.html b/docs/javadoc/4.0/org/hamcrest/object/HasToString.html new file mode 100644 index 00000000..fb125db8 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/object/HasToString.html @@ -0,0 +1,269 @@ + + + + +HasToString (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class HasToString<T>

+
+ +
+
+
+
Type Parameters:
+
T - The Matcher type.
+
+
+
All Implemented Interfaces:
+
Matcher<T>, SelfDescribing
+
+
+
public class HasToString<T> +extends FeatureMatcher<T,String>
+
A Matcher that checks the output of the toString() method.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      featureValueOf

      +
      +
      protected String featureValueOf(T actual)
      +
      Description copied from class: FeatureMatcher
      +
      Implement this to extract the interesting feature.
      +
      +
      Specified by:
      +
      featureValueOf in class FeatureMatcher<T,String>
      +
      Parameters:
      +
      actual - the target object
      +
      Returns:
      +
      the feature to be matched
      +
      +
      +
      +
    • +
    • +
      +

      hasToString

      +
      +
      public static <T> Matcher<T> hasToString(Matcher<? super 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")))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      toStringMatcher - the matcher used to verify the toString result
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasToString

      +
      +
      public static <T> Matcher<T> hasToString(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"))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      expectedToString - the expected toString result
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/object/IsCompatibleType.html b/docs/javadoc/4.0/org/hamcrest/object/IsCompatibleType.html new file mode 100644 index 00000000..c276fe3e --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/object/IsCompatibleType.html @@ -0,0 +1,286 @@ + + + + +IsCompatibleType (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsCompatibleType<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Class<?>> +
org.hamcrest.TypeSafeMatcher<Class<?>> +
org.hamcrest.object.IsCompatibleType<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - the type of the class
+
+
+
All Implemented Interfaces:
+
Matcher<Class<?>>, SelfDescribing
+
+
+
public class IsCompatibleType<T> +extends TypeSafeMatcher<Class<?>>
+
A matcher of Class that matches when the specified baseType is assignable from the examined class.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsCompatibleType

      +
      +
      public IsCompatibleType(Class<T> type)
      +
      Constructor, best called from typeCompatibleWith(Class).
      +
      +
      Parameters:
      +
      type - the expected type
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(Class<?> cls)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<Class<?>>
      +
      Parameters:
      +
      cls - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(Class<?> cls, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<Class<?>>
      +
      Parameters:
      +
      cls - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<Class<?>> typeCompatibleWith(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))
      +
      +
      Type Parameters:
      +
      T - the matcher type.
      +
      Parameters:
      +
      baseType - the base class to examine classes against
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/object/IsEventFrom.html b/docs/javadoc/4.0/org/hamcrest/object/IsEventFrom.html new file mode 100644 index 00000000..0976eea2 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/object/IsEventFrom.html @@ -0,0 +1,288 @@ + + + + +IsEventFrom (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsEventFrom

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<EventObject>, SelfDescribing
+
+
+
public class IsEventFrom +extends TypeSafeDiagnosingMatcher<EventObject>
+
Tests if the value is an event announced by a specific object.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsEventFrom

      +
      +
      public IsEventFrom(Class<?> eventClass, + Object source)
      +
      Constructor, best called from eventFrom(Object) or eventFrom(Class, Object).
      +
      +
      Parameters:
      +
      eventClass - the expected class of the event
      +
      source - the expected source of the event
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(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<EventObject>
      +
      Parameters:
      +
      item - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<EventObject> eventFrom(Class<? extends EventObject> eventClass, + 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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      eventFrom

      +
      +
      public static Matcher<EventObject> eventFrom(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/object/package-summary.html b/docs/javadoc/4.0/org/hamcrest/object/package-summary.html new file mode 100644 index 00000000..f2cf0e3c --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/object/package-summary.html @@ -0,0 +1,120 @@ + + + + +org.hamcrest.object (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.object

+
+
+
+
package org.hamcrest.object
+
+
Matchers that inspect objects and classes.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    A matcher that checks if an object as equal fields values to an expected object.
    +
    + +
    +
    A Matcher that checks the output of the toString() method.
    +
    + +
    +
    A matcher of Class that matches when the specified baseType is assignable from the examined class.
    +
    + +
    +
    Tests if the value is an event announced by a specific object.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/object/package-tree.html b/docs/javadoc/4.0/org/hamcrest/object/package-tree.html new file mode 100644 index 00000000..a842c692 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/object/package-tree.html @@ -0,0 +1,95 @@ + + + + +org.hamcrest.object Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.object

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/optional/OptionalEmpty.html b/docs/javadoc/4.0/org/hamcrest/optional/OptionalEmpty.html new file mode 100644 index 00000000..15709355 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/optional/OptionalEmpty.html @@ -0,0 +1,253 @@ + + + + +OptionalEmpty (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class OptionalEmpty<T>

+
+ +
+
+
+
Type Parameters:
+
T - type of Optional value
+
+
+
All Implemented Interfaces:
+
Matcher<Optional<T>>, SelfDescribing
+
+
+
public class OptionalEmpty<T> +extends TypeSafeDiagnosingMatcher<Optional<T>>
+
Matcher that expects an empty Optional.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      OptionalEmpty

      +
      +
      public OptionalEmpty()
      +
      Constructor, best called from emptyOptional().
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      emptyOptional

      +
      +
      public static <T> Matcher<Optional<T>> emptyOptional()
      +
      Matcher that expects empty Optional.
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(Optional<T> value, + 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<Optional<T>>
      +
      Parameters:
      +
      value - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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/4.0/org/hamcrest/optional/OptionalWithValue.html b/docs/javadoc/4.0/org/hamcrest/optional/OptionalWithValue.html new file mode 100644 index 00000000..432738d8 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/optional/OptionalWithValue.html @@ -0,0 +1,303 @@ + + + + +OptionalWithValue (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class OptionalWithValue<T>

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<Optional<T>> +
org.hamcrest.TypeSafeDiagnosingMatcher<Optional<T>> +
org.hamcrest.optional.OptionalWithValue<T>
+
+
+
+
+
+
+
Type Parameters:
+
T - type of Optional value
+
+
+
All Implemented Interfaces:
+
Matcher<Optional<T>>, SelfDescribing
+
+
+
public class OptionalWithValue<T> +extends TypeSafeDiagnosingMatcher<Optional<T>>
+
Matcher for Optional that expects that value is present.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      OptionalWithValue

      +
      +
      public OptionalWithValue(Matcher<? super T> matcher)
      +
      Constructor.
      +
      +
      Parameters:
      +
      matcher - matcher to validate present optional value
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      optionalWithValue

      +
      +
      public static <T> Matcher<Optional<T>> optionalWithValue()
      +
      Matcher for Optional that expects that value is present.
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      optionalWithValue

      +
      +
      public static <T> Matcher<Optional<T>> optionalWithValue(T value)
      +
      Matcher for Optional that expects that value is present and is equal to value
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Parameters:
      +
      value - to validate present optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      optionalWithValue

      +
      +
      public static <T> Matcher<Optional<T>> optionalWithValue(Matcher<? super T> matcher)
      +
      Matcher for Optional that expects that value is present and matches matcher
      +
      +
      Type Parameters:
      +
      T - type of optional value
      +
      Parameters:
      +
      matcher - matcher to validate present optional value
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(Optional<T> value, + 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<Optional<T>>
      +
      Parameters:
      +
      value - the item.
      +
      mismatchDescription - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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/4.0/org/hamcrest/optional/package-summary.html b/docs/javadoc/4.0/org/hamcrest/optional/package-summary.html new file mode 100644 index 00000000..f0b0a493 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/optional/package-summary.html @@ -0,0 +1,112 @@ + + + + +org.hamcrest.optional (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.optional

+
+
+
+
package org.hamcrest.optional
+
+
Matchers that perform comparisons on Optional instances.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    Matcher that expects an empty Optional.
    +
    + +
    +
    Matcher for Optional that expects that value is present.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/optional/package-tree.html b/docs/javadoc/4.0/org/hamcrest/optional/package-tree.html new file mode 100644 index 00000000..a4be105f --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/optional/package-tree.html @@ -0,0 +1,85 @@ + + + + +org.hamcrest.optional Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.optional

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/package-summary.html b/docs/javadoc/4.0/org/hamcrest/package-summary.html new file mode 100644 index 00000000..5b4b588b --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/package-summary.html @@ -0,0 +1,222 @@ + + + + +org.hamcrest (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest

+
+
+
+
package org.hamcrest
+
+
Top level matcher classes and interfaces.
+
+
+
+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/package-tree.html b/docs/javadoc/4.0/org/hamcrest/package-tree.html new file mode 100644 index 00000000..d3af7edd --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/package-tree.html @@ -0,0 +1,113 @@ + + + + +org.hamcrest Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+

Interface Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/CharSequenceLength.html b/docs/javadoc/4.0/org/hamcrest/text/CharSequenceLength.html new file mode 100644 index 00000000..c3bf299b --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/CharSequenceLength.html @@ -0,0 +1,271 @@ + + + + +CharSequenceLength (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class CharSequenceLength

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<CharSequence>, SelfDescribing
+
+
+
public class CharSequenceLength +extends FeatureMatcher<CharSequence,Integer>
+
A Matcher that checks the length of a string.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      featureValueOf

      +
      +
      protected Integer featureValueOf(CharSequence actual)
      +
      Description copied from class: FeatureMatcher
      +
      Implement this to extract the interesting feature.
      +
      +
      Specified by:
      +
      featureValueOf in class FeatureMatcher<CharSequence,Integer>
      +
      Parameters:
      +
      actual - the target object
      +
      Returns:
      +
      the feature to be matched
      +
      +
      +
      +
    • +
    • +
      +

      hasLength

      +
      +
      public static Matcher<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasLength

      +
      +
      public static Matcher<CharSequence> hasLength(Matcher<? super 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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/IsBlankString.html b/docs/javadoc/4.0/org/hamcrest/text/IsBlankString.html new file mode 100644 index 00000000..86527144 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/IsBlankString.html @@ -0,0 +1,233 @@ + + + + +IsBlankString (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsBlankString

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public final class IsBlankString +extends TypeSafeMatcher<String>
+
Matches blank Strings (and null).
+
+
+
+ +
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(String item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      blankOrNullString

      +
      +
      public static Matcher<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()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/IsEmptyString.html b/docs/javadoc/4.0/org/hamcrest/text/IsEmptyString.html new file mode 100644 index 00000000..3316982c --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/IsEmptyString.html @@ -0,0 +1,286 @@ + + + + +IsEmptyString (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsEmptyString

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public final class IsEmptyString +extends TypeSafeMatcher<String>
+
Matches empty Strings (and null).
+
+
+
+ +
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(String item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<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())
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyString

      +
      +
      public static Matcher<String> emptyString()
      +
      Creates a matcher of String that matches when the examined string has zero length. + For example: +
      assertThat("", is(emptyString()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      isEmptyOrNullString

      +
      +
      @Deprecated +public static Matcher<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())
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      emptyOrNullString

      +
      +
      public static Matcher<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()))
      +
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/IsEqualCompressingWhiteSpace.html b/docs/javadoc/4.0/org/hamcrest/text/IsEqualCompressingWhiteSpace.html new file mode 100644 index 00000000..209d8645 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/IsEqualCompressingWhiteSpace.html @@ -0,0 +1,351 @@ + + + + +IsEqualCompressingWhiteSpace (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsEqualCompressingWhiteSpace

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<String> +
org.hamcrest.TypeSafeMatcher<String> +
org.hamcrest.text.IsEqualCompressingWhiteSpace
+
+
+
+
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class IsEqualCompressingWhiteSpace +extends TypeSafeMatcher<String>
+
Tests if a string is equal to another string, compressing any changes in whitespace.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsEqualCompressingWhiteSpace

      +
      +
      public IsEqualCompressingWhiteSpace(String string)
      +
      Constructor, best called from equalToCompressingWhiteSpace(String).
      +
      +
      Parameters:
      +
      string - the expected string
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getString

      +
      +
      protected String getString()
      +
      Gets the string
      +
      +
      Returns:
      +
      the string
      +
      +
      +
      +
    • +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(String item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(String item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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 String stripSpaces(String toBeStripped)
      +
      Strips spaces
      +
      +
      Parameters:
      +
      toBeStripped - the string to be stripped
      +
      Returns:
      +
      the stripped string
      +
      +
      +
      +
    • +
    • +
      +

      equalToIgnoringWhiteSpace

      +
      +
      @Deprecated +public static Matcher<String> equalToIgnoringWhiteSpace(String expectedString)
      + +
      +
      Parameters:
      +
      expectedString - the expected value of matched strings
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      equalToCompressingWhiteSpace

      +
      +
      public static Matcher<String> equalToCompressingWhiteSpace(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/IsEqualIgnoringCase.html b/docs/javadoc/4.0/org/hamcrest/text/IsEqualIgnoringCase.html new file mode 100644 index 00000000..92c536ab --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/IsEqualIgnoringCase.html @@ -0,0 +1,280 @@ + + + + +IsEqualIgnoringCase (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class IsEqualIgnoringCase

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class IsEqualIgnoringCase +extends TypeSafeMatcher<String>
+
Tests if a string is equal to another string, regardless of the case.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      IsEqualIgnoringCase

      +
      +
      public IsEqualIgnoringCase(String string)
      +
      Constructor, best called from equalToIgnoringCase(String).
      +
      +
      Parameters:
      +
      string - the expected string
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(String item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(String item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<String> equalToIgnoringCase(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/MatchesPattern.html b/docs/javadoc/4.0/org/hamcrest/text/MatchesPattern.html new file mode 100644 index 00000000..5401a9a0 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/MatchesPattern.html @@ -0,0 +1,277 @@ + + + + +MatchesPattern (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class MatchesPattern

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class MatchesPattern +extends TypeSafeMatcher<String>
+
Tests if a string matches a regular expression.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    + +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      protected boolean matchesSafely(String item)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<String> matchesPattern(Pattern pattern)
      +
      Creates a matcher of String that matches when the examined string + exactly matches the given Pattern.
      +
      +
      Parameters:
      +
      pattern - the text pattern to match.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      matchesPattern

      +
      +
      public static Matcher<String> matchesPattern(String regex)
      +
      Creates a matcher of String that matches when the examined string + exactly matches the given regular expression, treated as a Pattern.
      +
      +
      Parameters:
      +
      regex - the regex to match.
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/StringContainsInOrder.html b/docs/javadoc/4.0/org/hamcrest/text/StringContainsInOrder.html new file mode 100644 index 00000000..8c8983b3 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/StringContainsInOrder.html @@ -0,0 +1,307 @@ + + + + +StringContainsInOrder (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class StringContainsInOrder

+
+
java.lang.Object +
org.hamcrest.BaseMatcher<String> +
org.hamcrest.TypeSafeMatcher<String> +
org.hamcrest.text.StringContainsInOrder
+
+
+
+
+
+
+
All Implemented Interfaces:
+
Matcher<String>, SelfDescribing
+
+
+
public class StringContainsInOrder +extends TypeSafeMatcher<String>
+
Tests if a string contains the given substrings in order.
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      StringContainsInOrder

      +
      +
      public StringContainsInOrder(Iterable<String> substrings)
      +
      Constructor, best called from stringContainsInOrder(Iterable)
      +
      +
      Parameters:
      +
      substrings - the substrings that must be contained within matching strings
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(String s)
      +
      Description copied from class: TypeSafeMatcher
      +
      Check if the item matches. The item will already have been checked for + the specific type and will never be null. Subclasses should implement this.
      +
      +
      Specified by:
      +
      matchesSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      s - the type safe item to match against.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeMismatchSafely

      +
      +
      public void describeMismatchSafely(String item, + Description mismatchDescription)
      +
      Description copied from class: TypeSafeMatcher
      +
      Describe the mismatch. The item will already have been checked for + the specific type and will never be null. Subclasses should override this.
      +
      +
      Overrides:
      +
      describeMismatchSafely in class TypeSafeMatcher<String>
      +
      Parameters:
      +
      item - the type safe item to match against.
      +
      mismatchDescription - the mismatch description.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<String> stringContainsInOrder(Iterable<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      stringContainsInOrder

      +
      +
      public static Matcher<String> stringContainsInOrder(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/package-summary.html b/docs/javadoc/4.0/org/hamcrest/text/package-summary.html new file mode 100644 index 00000000..a302e769 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/package-summary.html @@ -0,0 +1,132 @@ + + + + +org.hamcrest.text (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.text

+
+
+
+
package org.hamcrest.text
+
+
Matchers that perform text comparisons.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    A Matcher that checks the length of a string.
    +
    + +
    +
    Matches blank Strings (and null).
    +
    + +
    +
    Matches empty Strings (and null).
    +
    + +
    +
    Tests if a string is equal to another string, compressing any changes in whitespace.
    +
    + +
    +
    Tests if a string is equal to another string, regardless of the case.
    +
    + +
    +
    Tests if a string matches a regular expression.
    +
    + +
    +
    Tests if a string contains the given substrings in order.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/text/package-tree.html b/docs/javadoc/4.0/org/hamcrest/text/package-tree.html new file mode 100644 index 00000000..f24f4ac8 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/text/package-tree.html @@ -0,0 +1,98 @@ + + + + +org.hamcrest.text Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.text

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/xml/HasXPath.html b/docs/javadoc/4.0/org/hamcrest/xml/HasXPath.html new file mode 100644 index 00000000..38a6f1f3 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/xml/HasXPath.html @@ -0,0 +1,415 @@ + + + + +HasXPath (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+

Class HasXPath

+
+ +
+
+
+
All Implemented Interfaces:
+
Matcher<Node>, SelfDescribing
+
+
+
public class HasXPath +extends TypeSafeDiagnosingMatcher<Node>
+
Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+
+
+
+ +
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      NO_NAMESPACE_CONTEXT

      +
      +
      public static final NamespaceContext NO_NAMESPACE_CONTEXT
      +
      Null NamespaceContext, used to document deliberate use + of no namespace.
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      HasXPath

      +
      +
      public HasXPath(String xPathExpression, + Matcher<String> valueMatcher)
      +
      Constructor, best called from one of the hasXPath static factory methods.
      +
      +
      Parameters:
      +
      xPathExpression - the target xpath
      +
      valueMatcher - matcher for the expected value
      +
      +
      +
      +
    • +
    • +
      +

      HasXPath

      +
      +
      public HasXPath(String xPathExpression, + NamespaceContext namespaceContext, + Matcher<String> valueMatcher)
      +
      Constructor, best called from one of the hasXPath static factory methods.
      +
      +
      Parameters:
      +
      xPathExpression - the target xpath
      +
      namespaceContext - the namespace for matching nodes
      +
      valueMatcher - matcher for the expected value
      +
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      matchesSafely

      +
      +
      public boolean matchesSafely(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<Node>
      +
      Parameters:
      +
      item - the item.
      +
      mismatch - the mismatch description.
      +
      Returns:
      +
      boolean true/false depending if item matches matcher.
      +
      +
      +
      +
    • +
    • +
      +

      describeTo

      +
      +
      public void describeTo(Description description)
      +
      Description copied from interface: SelfDescribing
      +
      Generates a description of the object. The description may be part of 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<Node> hasXPath(String xPath, + Matcher<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasXPath

      +
      +
      public static Matcher<Node> hasXPath(String xPath, + NamespaceContext namespaceContext, + Matcher<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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasXPath

      +
      +
      public static Matcher<Node> hasXPath(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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    • +
      +

      hasXPath

      +
      +
      public static Matcher<Node> hasXPath(String xPath, + 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
      +
      Returns:
      +
      The matcher.
      +
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/xml/package-summary.html b/docs/javadoc/4.0/org/hamcrest/xml/package-summary.html new file mode 100644 index 00000000..2c1411d1 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/xml/package-summary.html @@ -0,0 +1,108 @@ + + + + +org.hamcrest.xml (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+ +
+
+

Package org.hamcrest.xml

+
+
+
+
package org.hamcrest.xml
+
+
Matchers of XML documents.
+
+
+
+
    +
  • + +
  • +
  • +
    +
    Classes
    +
    +
    Class
    +
    Description
    + +
    +
    Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
    +
    +
    +
    +
  • +
+
+
+
+ + diff --git a/docs/javadoc/4.0/org/hamcrest/xml/package-tree.html b/docs/javadoc/4.0/org/hamcrest/xml/package-tree.html new file mode 100644 index 00000000..e4839349 --- /dev/null +++ b/docs/javadoc/4.0/org/hamcrest/xml/package-tree.html @@ -0,0 +1,84 @@ + + + + +org.hamcrest.xml Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For Package org.hamcrest.xml

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/overview-summary.html b/docs/javadoc/4.0/overview-summary.html new file mode 100644 index 00000000..02650df2 --- /dev/null +++ b/docs/javadoc/4.0/overview-summary.html @@ -0,0 +1,25 @@ + + + + +Hamcrest 4.0 API + + + + + + + + + + +
+ +

index.html

+
+ + diff --git a/docs/javadoc/4.0/overview-tree.html b/docs/javadoc/4.0/overview-tree.html new file mode 100644 index 00000000..82ce17a0 --- /dev/null +++ b/docs/javadoc/4.0/overview-tree.html @@ -0,0 +1,199 @@ + + + + +Class Hierarchy (Hamcrest 4.0 API) + + + + + + + + + + + + + +
+ +
+
+
+
+

Hierarchy For All Packages

+
+Package Hierarchies: + +
+

Class Hierarchy

+ +
+
+

Interface Hierarchy

+ +
+
+
+ + diff --git a/docs/javadoc/4.0/package-search-index.js b/docs/javadoc/4.0/package-search-index.js new file mode 100644 index 00000000..ae91919d --- /dev/null +++ b/docs/javadoc/4.0/package-search-index.js @@ -0,0 +1 @@ +packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"org.hamcrest"},{"l":"org.hamcrest.beans"},{"l":"org.hamcrest.collection"},{"l":"org.hamcrest.comparator"},{"l":"org.hamcrest.core"},{"l":"org.hamcrest.exception"},{"l":"org.hamcrest.io"},{"l":"org.hamcrest.number"},{"l":"org.hamcrest.object"},{"l":"org.hamcrest.optional"},{"l":"org.hamcrest.text"},{"l":"org.hamcrest.xml"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/javadoc/4.0/resource-files/copy.svg b/docs/javadoc/4.0/resource-files/copy.svg new file mode 100644 index 00000000..b07ac7e8 --- /dev/null +++ b/docs/javadoc/4.0/resource-files/copy.svg @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Bold.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Bold.woff new file mode 100644 index 00000000..63a79c04 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Bold.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Bold.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Bold.woff2 new file mode 100644 index 00000000..06655540 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Bold.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-BoldOblique.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-BoldOblique.woff new file mode 100644 index 00000000..dead2908 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-BoldOblique.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-BoldOblique.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-BoldOblique.woff2 new file mode 100644 index 00000000..89328f3c Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-BoldOblique.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Oblique.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Oblique.woff new file mode 100644 index 00000000..6c62443d Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Oblique.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Oblique.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Oblique.woff2 new file mode 100644 index 00000000..8a50fa15 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans-Oblique.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans.woff new file mode 100644 index 00000000..a0f1efa9 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans.woff2 new file mode 100644 index 00000000..fecdbd87 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSans.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Bold.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Bold.woff new file mode 100644 index 00000000..9f646ba0 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Bold.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Bold.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Bold.woff2 new file mode 100644 index 00000000..346de2da Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Bold.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-BoldOblique.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-BoldOblique.woff new file mode 100644 index 00000000..7a6b3ac0 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-BoldOblique.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-BoldOblique.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-BoldOblique.woff2 new file mode 100644 index 00000000..ede24ef6 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-BoldOblique.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Oblique.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Oblique.woff new file mode 100644 index 00000000..892833b9 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Oblique.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Oblique.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Oblique.woff2 new file mode 100644 index 00000000..9e905143 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono-Oblique.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono.woff new file mode 100644 index 00000000..e94e844d Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono.woff2 new file mode 100644 index 00000000..9460c050 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSansMono.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Bold.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Bold.woff new file mode 100644 index 00000000..0f38846c Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Bold.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Bold.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Bold.woff2 new file mode 100644 index 00000000..d65a5e95 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Bold.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-BoldItalic.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-BoldItalic.woff new file mode 100644 index 00000000..63fd5e38 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-BoldItalic.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-BoldItalic.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-BoldItalic.woff2 new file mode 100644 index 00000000..e29307ea Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-BoldItalic.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Italic.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Italic.woff new file mode 100644 index 00000000..5df6d001 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Italic.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Italic.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Italic.woff2 new file mode 100644 index 00000000..61ff1463 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif-Italic.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif.woff b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif.woff new file mode 100644 index 00000000..280e3783 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif.woff differ diff --git a/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif.woff2 b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif.woff2 new file mode 100644 index 00000000..bbd32cde Binary files /dev/null and b/docs/javadoc/4.0/resource-files/fonts/DejaVuLGCSerif.woff2 differ diff --git a/docs/javadoc/4.0/resource-files/fonts/dejavu.css b/docs/javadoc/4.0/resource-files/fonts/dejavu.css new file mode 100644 index 00000000..b450caa3 --- /dev/null +++ b/docs/javadoc/4.0/resource-files/fonts/dejavu.css @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + */ + +/* DejaVu fonts v2.37 */ + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('DejaVuLGCSansMono.woff2') format('woff2'), + url('DejaVuLGCSansMono.woff') format('woff'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('DejaVuLGCSansMono-Oblique.woff2') format('woff2'), + url('DejaVuLGCSansMono-Oblique.woff') format('woff'); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('DejaVuLGCSansMono-Bold.woff2') format('woff2'), + url('DejaVuLGCSansMono-Bold.woff') format('woff'); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('DejaVuLGCSansMono-BoldOblique.woff2') format('woff2'), + url('DejaVuLGCSansMono-BoldOblique.woff') format('woff'); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: 'DejaVu Sans'; + src: url('DejaVuLGCSans.woff2') format('woff2'), + url('DejaVuLGCSans.woff') format('woff'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Sans'; + src: url('DejaVuLGCSans-Oblique.woff2') format('woff2'), + url('DejaVuLGCSans-Oblique.woff') format('woff'); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: 'DejaVu Sans'; + src: url('DejaVuLGCSans-Bold.woff2') format('woff2'), + url('DejaVuLGCSans-Bold.woff') format('woff'); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Sans'; + src: url('DejaVuLGCSans-BoldOblique.woff2') format('woff2'), + url('DejaVuLGCSans-BoldOblique.woff') format('woff'); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: 'DejaVu Serif'; + src: url('DejaVuLGCSerif.woff2') format('woff2'), + url('DejaVuLGCSerif.woff') format('woff'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Serif'; + src: url('DejaVuLGCSerif-Italic.woff2') format('woff2'), + url('DejaVuLGCSerif-Italic.woff') format('woff'); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: 'DejaVu Serif'; + src: url('DejaVuLGCSerif-Bold.woff2') format('woff2'), + url('DejaVuLGCSerif-Bold.woff') format('woff'); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Serif'; + src: url('DejaVuLGCSerif-BoldItalic.woff2') format('woff2'), + url('DejaVuLGCSerif-BoldItalic.woff') format('woff'); + font-weight: bold; + font-style: italic; +} diff --git a/docs/javadoc/4.0/resource-files/glass.png b/docs/javadoc/4.0/resource-files/glass.png new file mode 100644 index 00000000..a7f591f4 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/glass.png differ diff --git a/docs/javadoc/4.0/resource-files/jquery-ui.min.css b/docs/javadoc/4.0/resource-files/jquery-ui.min.css new file mode 100644 index 00000000..693327f0 --- /dev/null +++ b/docs/javadoc/4.0/resource-files/jquery-ui.min.css @@ -0,0 +1,6 @@ +/*! jQuery UI - v1.13.2 - 2023-02-27 +* http://jqueryui.com +* Includes: core.css, autocomplete.css, menu.css +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;-ms-filter:"alpha(opacity=0)"}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} \ No newline at end of file diff --git a/docs/javadoc/4.0/resource-files/link.svg b/docs/javadoc/4.0/resource-files/link.svg new file mode 100644 index 00000000..2bbac382 --- /dev/null +++ b/docs/javadoc/4.0/resource-files/link.svg @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/docs/javadoc/4.0/resource-files/stylesheet.css b/docs/javadoc/4.0/resource-files/stylesheet.css new file mode 100644 index 00000000..8086e0d8 --- /dev/null +++ b/docs/javadoc/4.0/resource-files/stylesheet.css @@ -0,0 +1,1461 @@ +/* + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + */ + +/* + * Javadoc style sheet + */ + +@import url('fonts/dejavu.css'); + +/* + * These CSS custom properties (variables) define the core color and font + * properties used in this stylesheet. + */ +:root { + /* body, block and code fonts */ + --body-font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + --block-font-family: 'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + --code-font-family: 'DejaVu Sans Mono', monospace; + /* Base font sizes for body and code elements */ + --body-font-size: 14px; + --block-font-size: 14px; + --code-font-size: 14px; + --nav-font-size: 13.2px; + /* Line height for continuous text blocks */ + --block-line-height: 1.4em; + /* Text colors for body and block elements */ + --body-text-color: #353833; + --block-text-color: #474747; + /* Background colors for various structural elements */ + --body-background-color: #ffffff; + --section-background-color: #f8f8f8; + --detail-background-color: #ffffff; + /* Colors for navigation bar and table captions */ + --navbar-background-color: #4D7A97; + --navbar-text-color: #ffffff; + /* Background color for subnavigation and various headers */ + --subnav-background-color: #dee3e9; + /* Background and text colors for selected tabs and navigation items */ + --selected-background-color: #f8981d; + --selected-text-color: #253441; + --selected-link-color: #1f389c; + /* Background colors for generated tables */ + --even-row-color: #ffffff; + --odd-row-color: #eeeeef; + /* Text color for page title */ + --title-color: #2c4557; + /* Text colors for links */ + --link-color: #4A6782; + --link-color-active: #bb7a2a; + /* Snippet colors */ + --snippet-background-color: #ebecee; + --snippet-text-color: var(--block-text-color); + --snippet-highlight-color: #f7c590; + /* Border colors for structural elements and user defined tables */ + --border-color: #ededed; + --table-border-color: #000000; + /* Search input colors */ + --search-input-background-color: #ffffff; + --search-input-text-color: #000000; + --search-input-placeholder-color: #909090; + /* Highlight color for active search tag target */ + --search-tag-highlight-color: #ffff00; + /* Adjustments for icon and active background colors of copy-to-clipboard buttons */ + --copy-icon-brightness: 100%; + --copy-button-background-color-active: rgba(168, 168, 176, 0.3); + /* Colors for invalid tag notifications */ + --invalid-tag-background-color: #ffe6e6; + --invalid-tag-text-color: #000000; + /* Navigation bar dimensions */ + --top-nav-height: 44px; + --sub-nav-height: 34px; + --nav-height: calc(var(--top-nav-height) + var(--sub-nav-height)); + scroll-behavior: smooth; +} +/* + * Styles for individual HTML elements. + * + * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular + * HTML element throughout the page. + */ +body { + background-color:var(--body-background-color); + color:var(--body-text-color); + font-family:var(--body-font-family); + font-size:var(--body-font-size); + margin:0; + padding:0; + height:100%; + width:100%; +} +main [id] { + scroll-margin-top: calc(var(--nav-height) + 6px); +} +a:link, a:visited { + text-decoration:none; + color:var(--link-color); +} +a[href]:hover, a[href]:active { + text-decoration:none; + color:var(--link-color-active); +} +pre { + font-family:var(--code-font-family); + font-size:var(--code-font-size); +} +h1 { + font-size:1.428em; +} +h2 { + font-size:1.285em; +} +h3 { + font-size:1.14em; +} +h4 { + font-size:1.072em; +} +h5 { + font-size:1.001em; +} +h6 { + font-size:0.93em; +} +/* Disable font boosting for selected elements */ +h1, h2, h3, h4, h5, h6, div.member-signature { + max-height: 1000em; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:var(--code-font-family); +} +:not(h1, h2, h3, h4, h5, h6) > code, +:not(h1, h2, h3, h4, h5, h6) > tt { + font-size:var(--code-font-size); + line-height:1.4em; +} +dt code { + font-family:var(--code-font-family); + font-size:1em; + padding-top:4px; +} +.summary-table dt code { + font-family:var(--code-font-family); + font-size:1em; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +button { + font-family: var(--body-font-family); + font-size: 1em; +} +hr { + border-color: #aaa; +} +/* + * Styles for HTML generated by javadoc. + * + * These are style classes that are used by the standard doclet to generate HTML documentation. + */ + +/* + * Styles for document title and copyright. + */ +.about-language { + flex: 0 0 auto; + padding:0 20px; + margin:0; + font-size:0.915em; + max-width: 50%; + white-space: nowrap; +} +.legal-copy { +} +/* + * Styles for navigation bar. + */ +@media screen { + header { + position:sticky; + top:0; + z-index:2; + background: var(--body-background-color); + } +} +.nav-content { + display:flex; + flex-direction: row; + align-items: center; + width: 100%; + height: 100%; +} +.top-nav { + background-color:var(--navbar-background-color); + color:var(--navbar-text-color); + width:100%; + height:var(--top-nav-height); + overflow:visible; + font-size:0.857em; + position:relative; +} +.top-nav nav.toc { + display: none; + flex-direction: column; +} +.top-nav nav.toc button.show-sidebar, +.top-nav nav.toc button.hide-sidebar { + display: none; +} +button#navbar-toggle-button { + display:none; +} +ul.nav-list { + display:inline-flex; + margin:0; + padding-left:4px; + flex: 1 1 auto; + white-space: nowrap; +} +ul.nav-list li { + list-style:none; + padding: 5px 6px; + text-transform:uppercase; + height: 1.2em; +} +div.sub-nav { + background-color:var(--subnav-background-color); + width:100%; + overflow:hidden; + font-size:var(--nav-font-size); + height: var(--sub-nav-height); +} +ol.sub-nav-list { + flex: 1 1 90%; + line-height: 1.8em; + display: inline-flex; + overflow: auto; + scroll-snap-type: x mandatory; + scroll-padding-left: 13px; + scrollbar-width: none; + padding-left:6px; + white-space: nowrap; + margin:0; +} +ol.sub-nav-list::-webkit-scrollbar { + display: none; +} +ol.sub-nav-list li { + list-style:none; + scroll-snap-align: start; +} +ol.sub-nav-list li:not(:first-child) { + list-style-type: " > "; + margin-left: 20px; +} +ol.sub-nav-list a { + padding: 3px; +} +ol.sub-nav-list a.current-selection { + background-color: var(--section-background-color); + border-radius: 4px; +} +.sub-nav .nav-list-search { + flex: 1 1 10%; + margin:0; + padding:6px; + position:relative; + white-space: nowrap; +} +.top-nav .nav-list a:link, .top-nav .nav-list a:active, .top-nav .nav-list a:visited { + color:var(--navbar-text-color); + text-decoration:none; + text-transform:uppercase; +} +.top-nav .nav-list a:hover { + color:var(--link-color-active); +} +.nav-bar-cell1-rev { + background-color:var(--selected-background-color); + color:var(--selected-text-color); + margin: 0 5px; +} +.skip-nav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* + * Hide navigation links and search box in print layout + */ +@media print { + ul.nav-list, div.sub-nav { + display:none; + } +} +/* + * Styles for page header. + */ +.title { + color:var(--title-color); + margin:10px 0; +} +.sub-title { + margin:5px 0 0 0; +} +ul.contents-list { + margin: 0 0 15px 0; + padding: 0; + list-style: none; +} +ul.contents-list li { + font-size:0.93em; +} +/* + * Styles for headings. + */ +body.class-declaration-page .summary h2, +body.class-declaration-page .details h2, +body.class-use-page h2, +body.module-declaration-page .block-list h2 { + font-style: italic; + padding:0; + margin:15px 0; + overflow-x:auto; +} +body.class-declaration-page .summary h3, +body.class-declaration-page .details h3 { + background-color:var(--subnav-background-color); + border:1px solid var(--border-color); + margin:0 0 6px -8px; + padding:7px 5px; + overflow-x:auto; +} +/* + * Styles for page layout containers. + */ +.main-grid { + display: flex; + flex-direction: row; +} +.main-grid main { + flex: 2.6 1 0; + min-width: 240px +} +.main-grid nav.toc { + flex: 1 1 0; + min-width: 240px; +} +main { + clear:both; + padding:10px 20px; + position:relative; +} +section[id$=-description] :is(dl, ol, ul, p, div, blockquote, pre):last-child, +section[id$=-description] :is(dl, ol, ul):last-child > :is(li, dd):last-child { + margin-bottom:4px; +} +dl.notes > dt { + font-family: var(--body-font-family); + font-size:0.856em; + font-weight:bold; + margin:10px 0 0 0; + color:var(--body-text-color); +} +dl.notes > dd { + margin:5px 10px 10px 15px; + font-size:var(--block-font-size); + font-family:var(--block-font-family); +} +dl.notes > dd > ul, dl.notes > dd > ol { + margin-bottom: 1em; + margin-top: 1em; +} +dl.name-value > dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +dl.name-value > dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* + * Styles for table of contents. + */ +.main-grid nav.toc { + background-color: var(--section-background-color); + border-right: 1px solid var(--border-color); + position: sticky; + top: calc(var(--nav-height)); + max-height: calc(100vh - var(--nav-height)); + display: flex; + flex-direction: column; + font-family: var(--body-font-family); + z-index: 1; +} +.main-grid nav.toc div.toc-header { + background-color: var(--section-background-color); + border-right: 1px solid var(--border-color); + top: var(--nav-height); + z-index: 1; + padding: 15px 20px; +} +.main-grid nav.toc > ol.toc-list { + max-height: calc(100vh - var(--nav-height) - 100px); + padding-left: 12px; +} +.main-grid nav.toc button { + position: absolute; + bottom: 16px; + z-index: 3; + background-color: var(--section-background-color); + color: #666666; + font-size: 0.76rem; + border: none; + cursor: pointer; + padding: 6px 10px; + white-space: nowrap; +} +.main-grid nav.toc button.hide-sidebar { + right: 0; +} +.main-grid nav.toc button.show-sidebar { + left: 0; + display: none; +} +.main-grid nav.toc button span { + display: none; +} +.main-grid nav.toc button:hover { + color: var(--body-text-color); + border: 1px solid var(--subnav-background-color); +} +.main-grid nav.toc button:active { + background-color: var(--subnav-background-color); + color: var(--link-color-active); +} +.main-grid nav.toc button:hover span, +.main-grid nav.toc button:active span { + display: inline; +} +.main-grid nav.toc button:hover { + box-shadow: 1px 1px 5px rgba(0,0,0,0.2); +} +.main-grid nav.toc.hide-sidebar { + min-width: revert; + max-width: 28px; +} +.main-grid nav.toc.hide-sidebar div.toc-header, +.main-grid nav.toc.hide-sidebar ol.toc-list, +.main-grid nav.toc.hide-sidebar button.hide-sidebar { + display: none; +} +.main-grid nav.toc.hide-sidebar button.show-sidebar { + display: inline; +} +nav.toc div.toc-header { + padding: 15px; + display: inline-flex; + align-items: center; + color: var(--body-text-color); + background-color: var(--body-background-color); + font-size: 0.856em; + font-weight: bold; + white-space: nowrap; + overflow-x: hidden; + position: sticky; + min-height: 20px; +} +nav.toc > ol.toc-list { + overflow: hidden auto; + overscroll-behavior: contain; +} +nav.toc ol.toc-list { + list-style: none; + padding-left: 8px; + margin: 0; +} +nav.toc ol.toc-list ol.toc-list { + margin-left: 8px; +} +nav.toc ol.toc-list li { + margin: 0; + font-size: var(--nav-font-size); + overflow-x: hidden; +} +a.current-selection { + font-weight: bold; +} +nav.toc a { + display: block; + padding: 8px; +} +nav.toc a.current-selection { + background-color: var(--subnav-background-color); +} +/* + * Styles for lists. + */ +li.circle { + list-style:circle; +} +ul.horizontal li { + display:inline; + font-size:0.9em; +} +div.inheritance { + margin:0; + padding:0; +} +div.inheritance div.inheritance { + margin-left:2em; +} +main > div.inheritance { + overflow-x:auto; +} +ul.block-list, +ul.details-list, +ul.member-list, +ul.summary-list { + margin:4px 0 10px 0; + padding:0; +} +ul.block-list > li, +ul.details-list > li, +ul.member-list > li, +ul.summary-list > li { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.ref-list { + padding:0; + margin:0; +} +ul.ref-list > li { + list-style:none; +} +.summary-table dl, .summary-table dl dt, .summary-table dl dd { + margin-top:0; + margin-bottom:1px; +} +dl.notes > dd > ul.tag-list, dl.notes > dd > ul.tag-list-long { + padding-left: 0; + margin: 0; + list-style: none; +} +ul.tag-list li { + display: inline; +} +ul.tag-list li:not(:last-child):after, +ul.tag-list-long li:not(:last-child):after +{ + content: ", "; + white-space: pre-wrap; +} +ul.preview-feature-list { + list-style: none; + margin:0; + padding:0.1em; + line-height: 1.6em; +} +/* + * Styles for tables. + */ +.summary-table, .details-table { + width:100%; + border-spacing:0; + border:1px solid var(--border-color); + border-top:0; + padding:0; +} +.caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:var(--selected-text-color); + clear:none; + overflow:hidden; + padding: 10px 0 0 1px; + margin:0; +} +.caption a:link, .caption a:visited { + color:var(--selected-link-color); +} +.caption a:hover, +.caption a:active { + color:var(--navbar-text-color); +} +.caption span { + font-weight:bold; + white-space:nowrap; + padding:5px 12px 7px 12px; + display:inline-block; + float:left; + background-color:var(--selected-background-color); + border: none; + height:16px; +} +div.table-tabs { + padding: 10px 0 0 1px; + margin: 0; +} +div.table-tabs > button { + border: none; + cursor: pointer; + padding: 5px 12px 7px 12px; + font-weight: bold; + margin-right: 8px; +} +div.table-tabs > .active-table-tab { + background: var(--selected-background-color); + color: var(--selected-text-color); +} +div.table-tabs > button.table-tab { + background: var(--navbar-background-color); + color: var(--navbar-text-color); +} +.two-column-search-results { + display: grid; + grid-template-columns: minmax(400px, max-content) minmax(400px, auto); +} +div.checkboxes { + line-height: 2em; +} +div.checkboxes > span { + margin-left: 10px; +} +div.checkboxes > label { + margin-left: 8px; + white-space: nowrap; +} +div.checkboxes > label > input { + margin: 0 2px; +} +.two-column-summary { + display: grid; + grid-template-columns: minmax(25%, max-content) minmax(25%, auto); +} +.three-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(20%, max-content) minmax(20%, auto); +} +.three-column-release-summary { + display: grid; + grid-template-columns: minmax(40%, max-content) minmax(10%, max-content) minmax(40%, auto); +} +.four-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(15%, max-content) minmax(15%, max-content) minmax(15%, auto); +} +@media screen and (max-width: 1000px) { + .four-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); + } +} +@media screen and (max-width: 800px) { + .two-column-search-results { + display: grid; + grid-template-columns: minmax(40%, max-content) minmax(40%, auto); + } + .three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(25%, auto); + } + .three-column-release-summary { + display: grid; + grid-template-columns: minmax(70%, max-content) minmax(30%, max-content) + } + .three-column-summary .col-last, + .three-column-release-summary .col-last{ + grid-column-end: span 2; + } +} +@media screen and (max-width: 600px) { + .two-column-summary { + display: grid; + grid-template-columns: 1fr; + } +} +.summary-table > div, .details-table > div { + text-align:left; + padding: 8px 3px 3px 7px; + overflow: auto hidden; + scrollbar-width: thin; +} +.col-first, .col-second, .col-last, .col-constructor-name, .col-summary-item-name { + vertical-align:top; + padding-right:0; + padding-top:8px; + padding-bottom:3px; +} +.table-header { + background:var(--subnav-background-color); + font-weight: bold; +} +/* Sortable table columns */ +.table-header[onclick] { + cursor: pointer; +} +.table-header[onclick]::after { + content:""; + display:inline-block; + background-image:url('data:image/svg+xml; utf8, \ + \ + '); + background-size:100% 100%; + width:9px; + height:14px; + margin-left:4px; + margin-bottom:-3px; +} +.table-header[onclick].sort-asc::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); + +} +.table-header[onclick].sort-desc::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); +} +.col-first, .col-first { + font-size:0.93em; +} +.col-second, .col-second, .col-last, .col-constructor-name, .col-summary-item-name, .col-last { + font-size:0.93em; +} +.col-first, .col-second, .col-constructor-name { + vertical-align:top; + overflow: auto; +} +.col-last { + white-space:normal; +} +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-constructor-name a:link, .col-constructor-name a:visited, +.col-summary-item-name a:link, .col-summary-item-name a:visited { + font-weight:bold; +} +.even-row-color, .even-row-color .table-header { + background-color:var(--even-row-color); +} +.odd-row-color, .odd-row-color .table-header { + background-color:var(--odd-row-color); +} +/* + * Styles for contents. + */ +div.block { + font-size:var(--block-font-size); + font-family:var(--block-font-family); + line-height:var(--block-line-height); +} +.col-last div { + padding-top:0; +} +.col-last a { + padding-bottom:3px; +} +.module-signature, +.package-signature, +.type-signature, +.member-signature { + font-family:var(--code-font-family); + font-size:1em; + margin:8px 0 14px 0; + white-space: pre-wrap; +} +.module-signature, +.package-signature, +.type-signature { + margin-top: 0; +} +.member-signature .type-parameters-long, +.member-signature .parameters, +.member-signature .exceptions { + display: inline-block; + vertical-align: top; + white-space: pre; +} +.member-signature .type-parameters { + white-space: normal; +} +/* + * Styles for formatting effect. + */ +.source-line-no { + /* Color of line numbers in source pages can be set via custom property below */ + color:var(--source-linenumber-color, green); + padding:0 30px 0 0; +} +.block { + display:block; + margin:0 10px 5px 0; + color:var(--block-text-color); +} +.deprecated-label, .description-from-type-label, .implementation-label, .member-name-link, +.package-hierarchy-label, .type-name-label, .type-name-link, .search-tag-link, .preview-label, .restricted-label { + font-weight:bold; +} +.deprecation-comment, .help-footnote, .preview-comment, .restricted-comment { + font-style:italic; +} +.deprecation-block, .preview-block, .restricted-block { + font-size:1em; + font-family:var(--block-font-family); + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +div.block div.deprecation-comment { + font-style:normal; +} +details.invalid-tag, span.invalid-tag { + font-size:1em; + font-family:var(--block-font-family); + color: var(--invalid-tag-text-color); + background: var(--invalid-tag-background-color); + border: thin solid var(--table-border-color); + border-radius:2px; + padding: 2px 4px; + display:inline-block; +} +details summary { + cursor: pointer; +} +/* + * Styles specific to HTML5 elements. + */ +main, nav, header, footer, section { + display:block; +} +/* + * Styles for javadoc search. + */ +.ui-menu .ui-state-active { + /* Overrides the color of selection used in jQuery UI */ + background: var(--selected-background-color); + color: var(--selected-text-color); + /* Workaround for browser bug, see JDK-8275889 */ + margin: -1px 0; + border-top: 1px solid var(--selected-background-color); + border-bottom: 1px solid var(--selected-background-color); +} +.ui-autocomplete-category { + font-weight:bold; + font-size:15px; + padding:7px 0 7px 3px; + background-color:var(--navbar-background-color); + color:var(--navbar-text-color); + box-sizing: border-box; +} +.ui-autocomplete { + max-height:85%; + max-width:65%; + overflow:auto; + white-space:nowrap; + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); + overscroll-behavior: contain; +} +ul.ui-autocomplete { + position:fixed; + z-index:10; + background-color: var(--body-background-color); +} +ul.ui-autocomplete li { + float:left; + clear:both; + min-width:100%; + box-sizing: border-box; +} +ul.ui-autocomplete li.ui-static-link { + position:sticky; + bottom:0; + left:0; + background: var(--subnav-background-color); + padding: 5px 0; + font-family: var(--body-font-family); + font-size: 0.93em; + font-weight: bolder; + z-index: 10; +} +li.ui-static-link a, li.ui-static-link a:visited { + text-decoration:none; + color:var(--link-color); + float:right; + margin-right:20px; +} +.ui-autocomplete .result-item { + font-size: inherit; +} +.ui-autocomplete .result-highlight { + font-weight:bold; +} +.ui-menu .ui-menu-item-wrapper { + padding-top: 0.4em; + padding-bottom: 0.4em; +} +.ui-menu .ui-menu-item-wrapper { + padding-top: 5px; + padding-bottom: 5px; +} +input[type="text"] { + background-image:url('glass.png'); + background-size:13px; + background-repeat:no-repeat; + background-position:2px 3px; + background-color: var(--search-input-background-color); + color: var(--search-input-text-color); + border-color: var(--border-color); + border-radius: 4px; + padding-left:20px; + font-size: var(--nav-font-size); + height: 17px; +} +input#search-input, input#page-search-input { + width: calc(180px + 10vw); + margin: 0; +} +input#search-input { + margin: 0 4px; + padding-right: 18px; + max-width: 340px; +} +input.filter-input { + width: 40%; + max-width: 140px; + margin: 0 4px; + padding-right: 18px; +} +input#reset-search, input.reset-filter { + background-color: transparent; + background-image:url('x.png'); + background-repeat:no-repeat; + background-size:contain; + border:0; + border-radius:0; + width:12px; + height:12px; + font-size:0; + display:none; +} +input#reset-search { + position:absolute; + right:15px; + top:11px; +} +input.reset-filter { + position: relative; + right: 20px; + top: 0; +} +input::placeholder { + color:var(--search-input-placeholder-color); + opacity: 1; +} +.search-tag-desc-result { + font-style:italic; + font-size:11px; +} +.search-tag-holder-result { + font-style:italic; + font-size:12px; +} +.search-tag-result:target { + background-color:var(--search-tag-highlight-color); +} +details.page-search-details { + display: inline-block; +} +div#result-container { + font-size: 1em; +} +div#result-container a.search-result-link { + padding: 0; + margin: 4px 0; + width: 100%; +} +#result-container .result-highlight { + font-weight:bolder; +} +.page-search-info { + background-color: var(--subnav-background-color); + border-radius: 3px; + border: 0 solid var(--border-color); + padding: 0 8px; + overflow: hidden; + height: 0; + transition: all 0.2s ease; +} +div.table-tabs > button.table-tab { + background: var(--navbar-background-color); + color: var(--navbar-text-color); +} +.page-search-header { + padding: 5px 12px 7px 12px; + font-weight: bold; + margin-right: 3px; + background-color:var(--navbar-background-color); + color:var(--navbar-text-color); + display: inline-block; +} +button.page-search-header { + border: none; + cursor: pointer; +} +span#page-search-link { + text-decoration: underline; +} +.module-graph span, .sealed-graph span { + display:none; + position:absolute; +} +.module-graph:hover span, .sealed-graph:hover span { + display:block; + margin: -100px 0 0 100px; + z-index: 5; +} +.inherited-list { + margin: 10px 0 10px 0; +} +.horizontal-scroll { + overflow: auto hidden; +} +section.class-description { + line-height: 1.4; +} +.summary section[class$="-summary"], .details section[class$="-details"], +.class-uses .detail, .serialized-class-details { + padding: 0 20px 5px 10px; + border: 1px solid var(--border-color); + background-color: var(--section-background-color); +} +.inherited-list, section[class$="-details"] .detail { + padding:0 0 5px 8px; + background-color:var(--detail-background-color); + border:none; +} +.vertical-separator { + padding: 0 5px; +} +.help-section { + font-size: var(--block-font-size); + line-height: var(--block-line-height); +} +ul.help-section-list { + margin: 0; +} +ul.help-subtoc > li { + display: inline-block; + padding-right: 5px; + font-size: smaller; +} +ul.help-subtoc > li::before { + content: "\2022" ; + padding-right:2px; +} +.help-note { + font-style: italic; +} +/* + * Indicator icon for external links. + */ +main a[href*="://"]::after { + content:""; + display:inline-block; + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); + background-size:100% 100%; + width:7px; + height:7px; + margin-left:2px; + margin-bottom:4px; +} +main a[href*="://"]:hover::after, +main a[href*="://"]:focus::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); +} +/* + * Styles for header/section anchor links + */ +a.anchor-link { + opacity: 0; + transition: opacity 0.1s; +} +:hover > a.anchor-link { + opacity: 80%; +} +a.anchor-link:hover, +a.anchor-link:focus-visible, +a.anchor-link.visible { + opacity: 100%; +} +a.anchor-link > img { + width: 0.9em; + height: 0.9em; +} +/* + * Styles for copy-to-clipboard buttons + */ +button.copy { + opacity: 70%; + border: none; + border-radius: 3px; + position: relative; + background:none; + transition: opacity 0.3s; + cursor: pointer; +} +:hover > button.copy { + opacity: 80%; +} +button.copy:hover, +button.copy:active, +button.copy:focus-visible, +button.copy.visible { + opacity: 100%; +} +button.copy img { + position: relative; + background: none; + filter: brightness(var(--copy-icon-brightness)); +} +button.copy:active { + background-color: var(--copy-button-background-color-active); +} +button.copy span { + color: var(--body-text-color); + position: relative; + top: -0.1em; + transition: all 0.1s; + font-size: 0.76rem; + line-height: 1.2em; + opacity: 0; +} +button.copy:hover span, +button.copy:focus-visible span, +button.copy.visible span { + opacity: 100%; +} +/* search page copy button */ +button#page-search-copy { + margin-left: 0.4em; + padding:0.3em; + top:0.13em; +} +button#page-search-copy img { + width: 1.2em; + height: 1.2em; + padding: 0.01em 0; + top: 0.15em; +} +button#page-search-copy span { + color: var(--body-text-color); + line-height: 1.2em; + padding: 0.2em; + top: -0.18em; +} +div.page-search-info:hover button#page-search-copy span { + opacity: 100%; +} +/* snippet copy button */ +button.snippet-copy { + position: absolute; + top: 6px; + right: 6px; + height: 1.7em; + padding: 2px; +} +button.snippet-copy img { + width: 18px; + height: 18px; + padding: 0.05em 0; +} +button.snippet-copy span { + line-height: 1.2em; + padding: 0.2em; + position: relative; + top: -0.5em; +} +div.snippet-container:hover button.snippet-copy span { + opacity: 100%; +} +/* + * Styles for user-provided tables. + * + * borderless: + * No borders, vertical margins, styled caption. + * This style is provided for use with existing doc comments. + * In general, borderless tables should not be used for layout purposes. + * + * plain: + * Plain borders around table and cells, vertical margins, styled caption. + * Best for small tables or for complex tables for tables with cells that span + * rows and columns, when the "striped" style does not work well. + * + * striped: + * Borders around the table and vertical borders between cells, striped rows, + * vertical margins, styled caption. + * Best for tables that have a header row, and a body containing a series of simple rows. + */ + +table.borderless, +table.plain, +table.striped { + margin-top: 10px; + margin-bottom: 10px; +} +table.borderless > caption, +table.plain > caption, +table.striped > caption { + font-weight: bold; + font-size: smaller; +} +table.borderless th, table.borderless td, +table.plain th, table.plain td, +table.striped th, table.striped td { + padding: 2px 5px; +} +table.borderless, +table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th, +table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td { + border: none; +} +table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr { + background-color: transparent; +} +table.plain { + border-collapse: collapse; + border: 1px solid var(--table-border-color); +} +table.plain > thead > tr, table.plain > tbody tr, table.plain > tr { + background-color: transparent; +} +table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th, +table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td { + border: 1px solid var(--table-border-color); +} +table.striped { + border-collapse: collapse; + border: 1px solid var(--table-border-color); +} +table.striped > thead { + background-color: var(--subnav-background-color); +} +table.striped > thead > tr > th, table.striped > thead > tr > td { + border: 1px solid var(--table-border-color); +} +table.striped > tbody > tr:nth-child(even) { + background-color: var(--odd-row-color) +} +table.striped > tbody > tr:nth-child(odd) { + background-color: var(--even-row-color) +} +table.striped > tbody > tr > th, table.striped > tbody > tr > td { + border-left: 1px solid var(--table-border-color); + border-right: 1px solid var(--table-border-color); +} +table.striped > tbody > tr > th { + font-weight: normal; +} +/** + * Tweak style for small screens. + */ +@media screen and (max-width: 1050px) { + .summary section[class$="-summary"], .details section[class$="-details"], + .class-uses .detail, .serialized-class-details { + padding: 0 10px 5px 8px; + } + input#search-input { + width: 22vw; + } +} +@media screen and (max-width: 920px) { + .main-grid nav.toc { + display: none; + } + .top-nav nav.toc { + display: none; + position: absolute; + top: var(--top-nav-height); + left: 40vw; + width: 60vw; + z-index: 7; + background-color: var(--section-background-color); + box-sizing: border-box; + } + .top-nav nav.toc div.toc-header { + padding: 6px 15px; + font-size: 0.94em; + background-color: var(--section-background-color); + top: calc(var(--top-nav-height) + 10px); + } + .top-nav nav.toc ol.toc-list li { + font-size: 1.04em; + } + nav.toc a:link, nav.toc a:visited { + text-decoration:none; + color:var(--link-color); + } + nav.toc a[href]:hover, nav.toc a[href]:focus { + text-decoration:none; + color:var(--link-color-active); + } + :root { + scroll-behavior: auto; + } + header { + max-height: 100vh; + overflow-y: visible; + overscroll-behavior: contain; + } + nav { + overflow: visible; + } + ul.nav-list { + display: none; + position: absolute; + top: var(--top-nav-height); + overflow: auto; + z-index: 7; + background-color: var(--navbar-background-color); + width: 40%; + padding: 0; + box-sizing: border-box; + } + ul.nav-list li { + float: none; + padding: 6px; + margin-left: 10px; + margin-top: 2px; + } + .top-nav a:link, .top-nav a:active, .top-nav a:visited { + display: block; + } + .top-nav div.nav-menu-button { + flex: 1 1 auto; + } + .sub-nav ol.sub-nav-list { + margin-left: 4px; + padding-left: 4px; + } + button#navbar-toggle-button { + width: 3.4em; + height: 2.8em; + background-color: transparent; + display: block; + border: 0; + margin: 0 10px; + cursor: pointer; + font-size: 10px; + } + button#navbar-toggle-button .nav-bar-toggle-icon { + display: block; + width: 24px; + height: 3px; + margin: 4px 0; + border-radius: 2px; + background-color: var(--navbar-text-color); + } + button#navbar-toggle-button.expanded span.nav-bar-toggle-icon:nth-child(1) { + transform: rotate(45deg); + transform-origin: 10% 10%; + width: 26px; + } + button#navbar-toggle-button.expanded span.nav-bar-toggle-icon:nth-child(2) { + opacity: 0; + } + button#navbar-toggle-button.expanded span.nav-bar-toggle-icon:nth-child(3) { + transform: rotate(-45deg); + transform-origin: 10% 90%; + width: 26px; + } +} +@media screen and (max-width: 800px) { + .about-language { + padding-right: 16px; + max-width: 90%; + } + ul.nav-list li { + margin-left: 5px; + } + main { + padding: 10px 12px; + } + body { + -webkit-text-size-adjust: none; + } +} +@media screen and (max-width: 600px) { + .nav-list-search > a { + display: none; + } + input#search-input { + width: 18vw; + } + .summary section[class$="-summary"], .details section[class$="-details"], + .class-uses .detail, .serialized-class-details { + padding: 0; + } +} +pre.snippet { + background-color: var(--snippet-background-color); + color: var(--snippet-text-color); + padding: 10px; + margin: 12px 0; + overflow: auto; + white-space: pre; +} +div.snippet-container { + position: relative; +} +@media screen and (max-width: 800px) { + pre.snippet { + padding-top: 26px; + } + button.snippet-copy { + top: 4px; + right: 4px; + } +} +pre.snippet .italic { + font-style: italic; +} +pre.snippet .bold { + font-weight: bold; +} +pre.snippet .highlighted { + background-color: var(--snippet-highlight-color); + border-radius: 10%; +} diff --git a/docs/javadoc/4.0/resource-files/x.png b/docs/javadoc/4.0/resource-files/x.png new file mode 100644 index 00000000..30548a75 Binary files /dev/null and b/docs/javadoc/4.0/resource-files/x.png differ diff --git a/docs/javadoc/4.0/script-files/jquery-3.7.1.min.js b/docs/javadoc/4.0/script-files/jquery-3.7.1.min.js new file mode 100644 index 00000000..7f37b5d9 --- /dev/null +++ b/docs/javadoc/4.0/script-files/jquery-3.7.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=x.widget.extend({},this.options[t]),n=0;n
"),i=e.children()[0];return x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthC(E(s),E(n))?o.important="horizontal":o.important="vertical",c.using.call(this,t,o)}),l.offset(x.extend(u,{using:t}))})},x.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,l=s-o,a=o+e.collisionWidth-n-s;e.collisionWidth>n?0n?0",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=x(t.target),i=x(x.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){x.contains(this.element[0],x.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=x(t.target).closest(".ui-menu-item"),i=x(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=x(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case x.ui.keyCode.PAGE_UP:this.previousPage(t);break;case x.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case x.ui.keyCode.HOME:this._move("first","first",t);break;case x.ui.keyCode.END:this._move("last","last",t);break;case x.ui.keyCode.UP:this.previous(t);break;case x.ui.keyCode.DOWN:this.next(t);break;case x.ui.keyCode.LEFT:this.collapse(t);break;case x.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case x.ui.keyCode.ENTER:case x.ui.keyCode.SPACE:this._activate(t);break;case x.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=x(this),e=t.prev(),i=x("").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=x(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!x.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(x.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(x.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=x("
    ").appendTo(this._appendTo()).menu({role:null}).hide().attr({unselectable:"on"}).menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(t,e){var i,s;if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){x(t.target).trigger(t.originalEvent)});s=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:s})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(s.value),(i=e.item.attr("aria-label")||s.value)&&String.prototype.trim.call(i).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(x("
    ").text(i))},100))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==x.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=x("
    ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||x.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?x(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(x.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=x.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").append(x("
    ").text(e.label)).appendTo(t)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),x.extend(x.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(x.ui.autocomplete.escapeRegex(e),"i");return x.grep(t,function(t){return i.test(t.label||t.value||t)})}}),x.widget("ui.autocomplete",x.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1").text(e))},100))}});x.ui.autocomplete}); \ No newline at end of file diff --git a/docs/javadoc/4.0/script-files/script.js b/docs/javadoc/4.0/script-files/script.js new file mode 100644 index 00000000..b5b30fc8 --- /dev/null +++ b/docs/javadoc/4.0/script-files/script.js @@ -0,0 +1,467 @@ +/* + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + */ + +var moduleSearchIndex; +var packageSearchIndex; +var typeSearchIndex; +var memberSearchIndex; +var tagSearchIndex; + +var oddRowColor = "odd-row-color"; +var evenRowColor = "even-row-color"; +var sortAsc = "sort-asc"; +var sortDesc = "sort-desc"; +var tableTab = "table-tab"; +var activeTableTab = "active-table-tab"; + +const linkIcon = "Link icon"; +const linkToSection = "Link to this section"; + +function loadScripts(doc, tag) { + createElem(doc, tag, 'script-files/search.js'); + + createElem(doc, tag, 'module-search-index.js'); + createElem(doc, tag, 'package-search-index.js'); + createElem(doc, tag, 'type-search-index.js'); + createElem(doc, tag, 'member-search-index.js'); + createElem(doc, tag, 'tag-search-index.js'); +} + +function createElem(doc, tag, path) { + var script = doc.createElement(tag); + var scriptElement = doc.getElementsByTagName(tag)[0]; + script.src = pathtoroot + path; + scriptElement.parentNode.insertBefore(script, scriptElement); +} + +// Helper for making content containing release names comparable lexicographically +function makeComparable(s) { + return s.toLowerCase().replace(/(\d+)/g, + function(n, m) { + return ("000" + m).slice(-4); + }); +} + +// Switches between two styles depending on a condition +function toggleStyle(classList, condition, trueStyle, falseStyle) { + if (condition) { + classList.remove(falseStyle); + classList.add(trueStyle); + } else { + classList.remove(trueStyle); + classList.add(falseStyle); + } +} + +// Sorts the rows in a table lexicographically by the content of a specific column +function sortTable(header, columnIndex, columns) { + var container = header.parentElement; + var descending = header.classList.contains(sortAsc); + container.querySelectorAll("div.table-header").forEach( + function(header) { + header.classList.remove(sortAsc); + header.classList.remove(sortDesc); + } + ) + var cells = container.children; + var rows = []; + for (var i = columns; i < cells.length; i += columns) { + rows.push(Array.prototype.slice.call(cells, i, i + columns)); + } + var comparator = function(a, b) { + var ka = makeComparable(a[columnIndex].textContent); + var kb = makeComparable(b[columnIndex].textContent); + if (ka < kb) + return descending ? 1 : -1; + if (ka > kb) + return descending ? -1 : 1; + return 0; + }; + var sorted = rows.sort(comparator); + var visible = 0; + sorted.forEach(function(row) { + if (row[0].style.display !== 'none') { + var isEvenRow = visible++ % 2 === 0; + } + row.forEach(function(cell) { + toggleStyle(cell.classList, isEvenRow, evenRowColor, oddRowColor); + container.appendChild(cell); + }) + }); + toggleStyle(header.classList, descending, sortDesc, sortAsc); +} + +// Toggles the visibility of a table category in all tables in a page +function toggleGlobal(checkbox, selected, columns) { + const display = checkbox.checked ? '' : 'none'; + const selectOther = selected === "other"; + const selectAll = selected === "all"; + if (selectAll) { + document.querySelectorAll('.checkboxes input[type="checkbox"]').forEach(c => { + c.checked = checkbox.checked; + }); + } + document.querySelectorAll("div.table-tabs").forEach(t => { + const id = t.parentElement.getAttribute("id"); + const selectedClass = id + "-tab" + (selectOther ? "" : selected); + var visible = 0; + t.parentElement.querySelectorAll('div.' + id) + .forEach(function(elem) { + if (selectAll + || (!selectOther && elem.classList.contains(selectedClass)) + || (selectOther && elem.className.indexOf(selectedClass) < 0)) { + elem.style.display = display; + } + if (elem.style.display === '') { + var isEvenRow = visible++ % (columns * 2) < columns; + toggleStyle(elem.classList, isEvenRow, evenRowColor, oddRowColor); + } + }); + var displaySection = visible === 0 ? 'none' : ''; + t.parentElement.style.display = displaySection; + document.querySelector("li#contents-" + id).style.display = displaySection; + }) +} + +// Shows the elements of a table belonging to a specific category +function show(tableId, selected, columns) { + if (tableId !== selected) { + document.querySelectorAll('div.' + tableId + ':not(.' + selected + ')') + .forEach(function(elem) { + elem.style.display = 'none'; + }); + } + document.querySelectorAll('div.' + selected) + .forEach(function(elem, index) { + elem.style.display = ''; + var isEvenRow = index % (columns * 2) < columns; + toggleStyle(elem.classList, isEvenRow, evenRowColor, oddRowColor); + }); + updateTabs(tableId, selected); +} + +function updateTabs(tableId, selected) { + document.getElementById(tableId + '.tabpanel') + .setAttribute('aria-labelledby', selected); + document.querySelectorAll('button[id^="' + tableId + '"]') + .forEach(function(tab, index) { + if (selected === tab.id || (tableId === selected && index === 0)) { + tab.className = activeTableTab; + tab.setAttribute('aria-selected', true); + tab.setAttribute('tabindex',0); + } else { + tab.className = tableTab; + tab.setAttribute('aria-selected', false); + tab.setAttribute('tabindex',-1); + } + }); +} + +function switchTab(e) { + var selected = document.querySelector('[aria-selected=true]'); + if (selected) { + if ((e.keyCode === 37 || e.keyCode === 38) && selected.previousSibling) { + // left or up arrow key pressed: move focus to previous tab + selected.previousSibling.click(); + selected.previousSibling.focus(); + e.preventDefault(); + } else if ((e.keyCode === 39 || e.keyCode === 40) && selected.nextSibling) { + // right or down arrow key pressed: move focus to next tab + selected.nextSibling.click(); + selected.nextSibling.focus(); + e.preventDefault(); + } + } +} + +var updateSearchResults = function() {}; + +function indexFilesLoaded() { + return moduleSearchIndex + && packageSearchIndex + && typeSearchIndex + && memberSearchIndex + && tagSearchIndex; +} +// Copy the contents of the local snippet to the clipboard +function copySnippet(button) { + copyToClipboard(button.nextElementSibling.innerText); + switchCopyLabel(button, button.firstElementChild); +} +function copyToClipboard(content) { + var textarea = document.createElement("textarea"); + textarea.style.height = 0; + document.body.appendChild(textarea); + textarea.value = content; + textarea.select(); + document.execCommand("copy"); + document.body.removeChild(textarea); +} +function switchCopyLabel(button, span) { + var copied = span.getAttribute("data-copied"); + button.classList.add("visible"); + var initialLabel = span.innerHTML; + span.innerHTML = copied; + setTimeout(function() { + button.classList.remove("visible"); + setTimeout(function() { + if (initialLabel !== copied) { + span.innerHTML = initialLabel; + } + }, 100); + }, 1900); +} +function setTopMargin() { + // Dynamically set scroll margin to accomodate for draft header + var headerHeight = Math.ceil(document.querySelector("header").offsetHeight); + document.querySelector(":root") + .style.setProperty("--nav-height", headerHeight + "px"); +} +document.addEventListener("readystatechange", (e) => { + if (document.readyState === "interactive") { + setTopMargin(); + } + if (sessionStorage.getItem("sidebar") === "hidden") { + const sidebar = document.querySelector(".main-grid nav.toc"); + if (sidebar) sidebar.classList.add("hide-sidebar"); + } +}); +document.addEventListener("DOMContentLoaded", function(e) { + setTopMargin(); + // Make sure current element is visible in breadcrumb navigation on small displays + const subnav = document.querySelector("ol.sub-nav-list"); + if (subnav && subnav.lastElementChild) { + subnav.lastElementChild.scrollIntoView({ behavior: "instant", inline: "start", block: "nearest" }); + } + // Clone TOC sidebar to header for mobile navigation + const navbar = document.querySelector("div#navbar-top"); + const sidebar = document.querySelector(".main-grid nav.toc"); + const main = document.querySelector(".main-grid main"); + const mainnav = navbar.querySelector("ul.nav-list"); + const toggleButton = document.querySelector("button#navbar-toggle-button"); + const toc = sidebar ? sidebar.cloneNode(true) : null; + if (toc) { + navbar.appendChild(toc); + } + document.querySelectorAll("input.filter-input").forEach(function(input) { + input.removeAttribute("disabled"); + input.setAttribute("autocapitalize", "off"); + input.value = ""; + input.addEventListener("input", function(e) { + const pattern = input.value ? input.value.trim() + .replace(/[\[\]{}()*+?.\\^$|]/g, '\\$&') + .replace(/\s+/g, ".*") : ""; + input.nextElementSibling.style.display = pattern ? "inline" : "none"; + const filter = new RegExp(pattern, "i"); + input.parentNode.parentNode.querySelectorAll("ol.toc-list li").forEach((li) => { + if (filter.test(li.innerText)) { + li.removeAttribute("style"); + } else { + li.style.display = "none"; + } + }); + if (expanded) { + expand(); + } + }); + }); + document.querySelectorAll("input.reset-filter").forEach((button) => { + button.removeAttribute("disabled"); + button.addEventListener("click", (e) => { + const input = button.previousElementSibling; + input.value = ""; + input.dispatchEvent(new InputEvent("input")); + input.focus(); + if (expanded) { + expand(); + } else { + prevHash = null; + handleScroll(); + } + }) + }); + var expanded = false; + var windowWidth; + function collapse() { + if (expanded) { + mainnav.removeAttribute("style"); + if (toc) { + toc.removeAttribute("style"); + } + toggleButton.classList.remove("expanded") + toggleButton.setAttribute("aria-expanded", "false"); + expanded = false; + } + } + function expand() { + expanded = true; + mainnav.style.display = "block"; + mainnav.style.removeProperty("height"); + var maxHeight = window.innerHeight - subnav.offsetTop + 4; + var expandedHeight = Math.min(maxHeight, mainnav.scrollHeight + 10); + if (toc) { + toc.style.display = "flex"; + expandedHeight = Math.min(maxHeight, + Math.max(expandedHeight, toc.querySelector("div.toc-header").offsetHeight + + toc.querySelector("ol.toc-list").scrollHeight + 10)); + toc.style.height = expandedHeight + "px"; + } + mainnav.style.height = expandedHeight + "px"; + toggleButton.classList.add("expanded"); + toggleButton.setAttribute("aria-expanded", "true"); + windowWidth = window.innerWidth; + } + toggleButton.addEventListener("click", (e) => { + if (expanded) { + collapse(); + } else { + expand(); + } + }); + if (toc) { + toc.querySelectorAll("a").forEach((link) => { + link.addEventListener("click", collapse); + }); + } + document.addEventListener('keydown', (e) => { + if (e.key === "Escape") collapse(); + }); + document.querySelector("main").addEventListener("click", collapse); + const searchInput = document.getElementById("search-input"); + if (searchInput) searchInput.addEventListener("focus", collapse); + document.querySelectorAll("h1, h2, h3, h4, h5, h6") + .forEach((hdr, idx) => { + // Create anchor links for headers with an associated id attribute + var id = hdr.getAttribute("id") || hdr.parentElement.getAttribute("id") + || (hdr.querySelector("a") && hdr.querySelector("a").getAttribute("id")); + if (id) { + var template = document.createElement('template'); + template.innerHTML =" " + linkIcon +""; + hdr.append(...template.content.childNodes); + } + }); + var sections; + var scrollTimeout; + var scrollTimeoutNeeded; + var prevHash; + function initSectionData() { + sections = [{ id: "", top: 0 }].concat(Array.from(main.querySelectorAll("section[id], h2[id], h2 a[id], div[id]")) + .filter((e) => { + return sidebar.querySelector("a[href=\"#" + encodeURI(e.getAttribute("id")) + "\"]") !== null + }).map((e) => { + return { + id: e.getAttribute("id"), + top: e.offsetTop + }; + })); + } + function setScrollTimeout() { + clearTimeout(scrollTimeout); + scrollTimeoutNeeded = false; + scrollTimeout = setTimeout(() => { + scrollTimeout = null; + handleScroll(); + }, 100); + } + function handleScroll() { + if (!sidebar || !sidebar.offsetParent || sidebar.classList.contains("hide-sidebar")) { + return; + } + if (scrollTimeout || scrollTimeoutNeeded) { + setScrollTimeout(); + return; + } + var scrollTop = document.documentElement.scrollTop; + var scrollHeight = document.documentElement.scrollHeight; + var currHash = null; + if (scrollHeight - scrollTop < window.innerHeight + 10) { + // Select last item if at bottom of the page + currHash = "#" + encodeURI(sections.at(-1).id); + } else { + for (var i = 0; i < sections.length; i++) { + var top = sections[i].top; + var bottom = sections[i + 1] ? sections[i + 1].top : scrollHeight; + if (top + ((bottom - top) / 2) > scrollTop || bottom > scrollTop + (window.innerHeight / 3)) { + currHash = "#" + encodeURI(sections[i].id); + break; + } + } + } + if (currHash !== prevHash) { + setSelected(currHash); + } + } + function setSelected(hash) { + var prev = sidebar.querySelector("a.current-selection"); + if (prev) + prev.classList.remove("current-selection"); + prevHash = hash; + if (hash) { + var curr = sidebar.querySelector("ol.toc-list a[href=\"" + hash + "\"]"); + if (curr) { + curr.classList.add("current-selection"); + curr.scrollIntoView({ behavior: "instant", block: "nearest" }); + } + } + } + if (sidebar) { + initSectionData(); + document.querySelectorAll("a[href^='#']").forEach((link) => { + link.addEventListener("click", (e) => { + scrollTimeoutNeeded = true; + setSelected(link.getAttribute("href")); + }) + }); + sidebar.querySelector("button.hide-sidebar").addEventListener("click", () => { + sidebar.classList.add("hide-sidebar"); + sessionStorage.setItem("sidebar", "hidden"); + }); + sidebar.querySelector("button.show-sidebar").addEventListener("click", () => { + sidebar.classList.remove("hide-sidebar"); + sessionStorage.removeItem("sidebar"); + initSectionData(); + handleScroll(); + }); + window.addEventListener("hashchange", (e) => { + scrollTimeoutNeeded = true; + }); + if (document.location.hash) { + scrollTimeoutNeeded = true; + setSelected(document.location.hash); + } else { + handleScroll(); + } + window.addEventListener("scroll", handleScroll); + window.addEventListener("scrollend", () => { + if (scrollTimeout) { + clearTimeout(scrollTimeout); + scrollTimeout = null; + handleScroll(); + } + }) + } + // Resize handler + function handleResize(e) { + if (expanded) { + if (windowWidth !== window.innerWidth) { + collapse(); + } else { + expand(); + } + } + if (sections) { + initSectionData(); + prevHash = null; + handleScroll(); + } + setTopMargin(); + } + window.addEventListener("orientationchange", handleResize); + window.addEventListener("resize", handleResize); +}); diff --git a/docs/javadoc/4.0/script-files/search-page.js b/docs/javadoc/4.0/script-files/search-page.js new file mode 100644 index 00000000..bcbd9b59 --- /dev/null +++ b/docs/javadoc/4.0/script-files/search-page.js @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + */ + +"use strict"; +$(function() { + var copy = $("#page-search-copy"); + var expand = $("#page-search-expand"); + var searchLink = $("span#page-search-link"); + var redirect = $("input#search-redirect"); + function setSearchUrlTemplate() { + var href = document.location.href.split(/[#?]/)[0]; + href += "?q=" + "%s"; + if (redirect.is(":checked")) { + href += "&r=1"; + } + searchLink.html(href); + copy[0].onmouseenter(); + } + function copyLink(e) { + copyToClipboard(this.previousSibling.innerText); + switchCopyLabel(this, this.lastElementChild); + } + copy.click(copyLink); + copy[0].onmouseenter = function() {}; + redirect.click(setSearchUrlTemplate); + setSearchUrlTemplate(); + copy.prop("disabled", false); + redirect.prop("disabled", false); + expand.click(function (e) { + var searchInfo = $("div.page-search-info"); + if(this.parentElement.hasAttribute("open")) { + searchInfo.attr("style", "border-width: 0;"); + } else { + searchInfo.attr("style", "border-width: 1px;").height(searchInfo.prop("scrollHeight")); + } + }); +}); +$(window).on("load", function() { + var input = $("#page-search-input"); + var reset = $("#page-search-reset"); + var notify = $("#page-search-notify"); + var resultSection = $("div#result-section"); + var resultContainer = $("div#result-container"); + var searchTerm = ""; + var activeTab = ""; + var fixedTab = false; + var visibleTabs = []; + var feelingLucky = false; + function renderResults(result) { + if (!result.length) { + notify.html(messages.noResult); + } else if (result.length === 1) { + notify.html(messages.oneResult); + } else { + notify.html(messages.manyResults.replace("{0}", result.length)); + } + resultContainer.empty(); + var r = { + "types": [], + "members": [], + "packages": [], + "modules": [], + "searchTags": [] + }; + for (var i in result) { + var item = result[i]; + var arr = r[item.category]; + arr.push(item); + } + if (!activeTab || r[activeTab].length === 0 || !fixedTab) { + Object.keys(r).reduce(function(prev, curr) { + if (r[curr].length > 0 && r[curr][0].score > prev) { + activeTab = curr; + return r[curr][0].score; + } + return prev; + }, 0); + } + if (feelingLucky && activeTab) { + notify.html(messages.redirecting) + var firstItem = r[activeTab][0]; + window.location = getURL(firstItem.indexItem, firstItem.category); + return; + } + if (result.length > 20) { + if (searchTerm[searchTerm.length - 1] === ".") { + if (activeTab === "types" && r["members"].length > r["types"].length) { + activeTab = "members"; + } else if (activeTab === "packages" && r["types"].length > r["packages"].length) { + activeTab = "types"; + } + } + } + var categoryCount = Object.keys(r).reduce(function(prev, curr) { + return prev + (r[curr].length > 0 ? 1 : 0); + }, 0); + visibleTabs = []; + var tabContainer = $("
    ").appendTo(resultContainer); + for (var key in r) { + var id = "#result-tab-" + key.replace("searchTags", "search_tags"); + if (r[key].length) { + var count = r[key].length >= 1000 ? "999+" : r[key].length; + if (result.length > 20 && categoryCount > 1) { + var button = $("").appendTo(tabContainer); + button.click(key, function(e) { + fixedTab = true; + renderResult(e.data, $(this)); + }); + visibleTabs.push(key); + } else { + $("" + categories[key] + + " (" + count + ")").appendTo(tabContainer); + renderTable(key, r[key]).appendTo(resultContainer); + tabContainer = $("
    ").appendTo(resultContainer); + + } + } + } + if (activeTab && result.length > 20 && categoryCount > 1) { + $("button#result-tab-" + activeTab).addClass("active-table-tab"); + renderTable(activeTab, r[activeTab]).appendTo(resultContainer); + } + resultSection.show(); + function renderResult(category, button) { + activeTab = category; + setSearchUrl(); + resultContainer.find("div.summary-table").remove(); + renderTable(activeTab, r[activeTab]).appendTo(resultContainer); + button.siblings().removeClass("active-table-tab"); + button.addClass("active-table-tab"); + } + } + function selectTab(category) { + $("button#result-tab-" + category).click(); + } + function renderTable(category, items) { + var table = $("
    ") + .addClass(category === "modules" + ? "one-column-search-results" + : "two-column-search-results"); + var col1, col2; + if (category === "modules") { + col1 = "Module"; + } else if (category === "packages") { + col1 = "Module"; + col2 = "Package"; + } else if (category === "types") { + col1 = "Package"; + col2 = "Class" + } else if (category === "members") { + col1 = "Class"; + col2 = "Member"; + } else if (category === "searchTags") { + col1 = "Location"; + col2 = "Name"; + } + $("
    " + col1 + "
    ").appendTo(table); + if (category !== "modules") { + $("
    " + col2 + "
    ").appendTo(table); + } + $.each(items, function(index, item) { + var rowColor = index % 2 ? "odd-row-color" : "even-row-color"; + renderItem(item, table, rowColor); + }); + return table; + } + function renderItem(item, table, rowColor) { + var label = getHighlightedText(item.input, item.boundaries, item.prefix.length, item.input.length); + var link = $("") + .attr("href", getURL(item.indexItem, item.category)) + .attr("tabindex", "0") + .addClass("search-result-link") + .html(label); + var container = getHighlightedText(item.input, item.boundaries, 0, item.prefix.length - 1); + if (item.category === "searchTags") { + container = item.indexItem.h || ""; + } + if (item.category !== "modules") { + $("
    ").html(container).addClass("col-plain").addClass(rowColor).appendTo(table); + } + $("
    ").html(link).addClass("col-last").addClass(rowColor).appendTo(table); + } + var timeout; + function schedulePageSearch() { + if (timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(function () { + doPageSearch() + }, 100); + } + function doPageSearch() { + setSearchUrl(); + var term = searchTerm = input.val().trim(); + if (term === "") { + notify.html(messages.enterTerm); + activeTab = ""; + fixedTab = false; + resultContainer.empty(); + resultSection.hide(); + } else { + notify.html(messages.searching); + doSearch({ term: term, maxResults: 1200 }, renderResults); + } + } + function setSearchUrl() { + var query = input.val().trim(); + var url = document.location.pathname; + if (query) { + url += "?q=" + encodeURI(query); + if (activeTab && fixedTab) { + url += "&c=" + activeTab; + } + } + history.replaceState({query: query}, "", url); + } + input.on("input", function(e) { + feelingLucky = false; + schedulePageSearch(); + }); + $(document).keydown(function(e) { + if ((e.ctrlKey || e.metaKey) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) { + if (activeTab && visibleTabs.length > 1) { + var idx = visibleTabs.indexOf(activeTab); + idx += e.key === "ArrowLeft" ? visibleTabs.length - 1 : 1; + selectTab(visibleTabs[idx % visibleTabs.length]); + return false; + } + } + }); + reset.click(function() { + notify.html(messages.enterTerm); + resultSection.hide(); + activeTab = ""; + fixedTab = false; + resultContainer.empty(); + input.val('').focus(); + setSearchUrl(); + }); + input.prop("disabled", false); + input.attr("autocapitalize", "off"); + reset.prop("disabled", false); + + var urlParams = new URLSearchParams(window.location.search); + if (urlParams.has("q")) { + input.val(urlParams.get("q")) + } + if (urlParams.has("c")) { + activeTab = urlParams.get("c"); + fixedTab = true; + } + if (urlParams.get("r")) { + feelingLucky = true; + } + if (input.val()) { + doPageSearch(); + } else { + notify.html(messages.enterTerm); + } + input.select().focus(); +}); diff --git a/docs/javadoc/4.0/script-files/search.js b/docs/javadoc/4.0/script-files/search.js new file mode 100644 index 00000000..0486cc69 --- /dev/null +++ b/docs/javadoc/4.0/script-files/search.js @@ -0,0 +1,436 @@ +/* + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + */ +"use strict"; +const messages = { + enterTerm: "Enter a search term", + noResult: "No results found", + oneResult: "Found one result", + manyResults: "Found {0} results", + loading: "Loading search index...", + searching: "Searching...", + redirecting: "Redirecting to first result...", +} +const categories = { + modules: "Modules", + packages: "Packages", + types: "Classes and Interfaces", + members: "Members", + searchTags: "Search Tags" +}; +const highlight = "$&"; +const NO_MATCH = {}; +const MAX_RESULTS = 300; +const UNICODE_LETTER = 0; +const UNICODE_DIGIT = 1; +const UNICODE_OTHER = 2; +function checkUnnamed(name, separator) { + return name === "" || !name ? "" : name + separator; +} +function escapeHtml(str) { + return str.replace(//g, ">"); +} +function getHighlightedText(str, boundaries, from, to) { + var start = from; + var text = ""; + for (var i = 0; i < boundaries.length; i += 2) { + var b0 = boundaries[i]; + var b1 = boundaries[i + 1]; + if (b0 >= to || b1 <= from) { + continue; + } + text += escapeHtml(str.slice(start, Math.max(start, b0))); + text += ""; + text += escapeHtml(str.slice(Math.max(start, b0), Math.min(to, b1))); + text += ""; + start = Math.min(to, b1); + } + text += escapeHtml(str.slice(start, to)); + return text; +} +function getURLPrefix(item, category) { + var urlPrefix = ""; + var slash = "/"; + if (category === "modules") { + return item.l + slash; + } else if (category === "packages" && item.m) { + return item.m + slash; + } else if (category === "types" || category === "members") { + if (item.m) { + urlPrefix = item.m + slash; + } else { + $.each(packageSearchIndex, function(index, it) { + if (it.m && item.p === it.l) { + urlPrefix = it.m + slash; + } + }); + } + } + return urlPrefix; +} +function getURL(item, category) { + if (item.url) { + return item.url; + } + var url = getURLPrefix(item, category); + if (category === "modules") { + url += "module-summary.html"; + } else if (category === "packages") { + if (item.u) { + url = item.u; + } else { + url += item.l.replace(/\./g, '/') + "/package-summary.html"; + } + } else if (category === "types") { + if (item.u) { + url = item.u; + } else { + url += checkUnnamed(item.p, "/").replace(/\./g, '/') + item.l + ".html"; + } + } else if (category === "members") { + url += checkUnnamed(item.p, "/").replace(/\./g, '/') + item.c + ".html" + "#"; + if (item.u) { + url += item.u; + } else { + url += item.l; + } + } else if (category === "searchTags") { + url += item.u; + } + item.url = url; + return url; +} +function createMatcher(term, camelCase) { + if (camelCase && !isUpperCase(term)) { + return null; // no need for camel-case matcher for lower case query + } + var pattern = ""; + var upperCase = []; + term.trim().split(/\s+/).forEach(function(w, index, array) { + var tokens = w.split(/(?=[\p{Lu},.()<>?[\/])/u); + for (var i = 0; i < tokens.length; i++) { + var s = tokens[i]; + // ',' and '?' are the only delimiters commonly followed by space in java signatures + pattern += "(" + escapeUnicodeRegex(s).replace(/[,?]/g, "$&\\s*?") + ")"; + upperCase.push(false); + var isWordToken = /[\p{L}\p{Nd}_]$/u.test(s); + if (isWordToken) { + if (i === tokens.length - 1 && index < array.length - 1) { + // space in query string matches all delimiters + pattern += "(.*?)"; + upperCase.push(isUpperCase(s[0])); + } else { + if (!camelCase && isUpperCase(s) && s.length === 1) { + pattern += "()"; + } else { + pattern += "([\\p{L}\\p{Nd}\\p{Sc}<>?[\\]]*?)"; + } + upperCase.push(isUpperCase(s[0])); + } + } else { + pattern += "()"; + upperCase.push(false); + } + } + }); + var re = new RegExp(pattern, "gui"); + re.upperCase = upperCase; + return re; +} +// Unicode regular expressions do not allow certain characters to be escaped +function escapeUnicodeRegex(pattern) { + return pattern.replace(/[\[\]{}()*+?.\\^$|\s]/g, '\\$&'); +} +function findMatch(matcher, input, startOfName, endOfName) { + var from = startOfName; + matcher.lastIndex = from; + var match = matcher.exec(input); + // Expand search area until we get a valid result or reach the beginning of the string + while (!match || match.index + match[0].length < startOfName || endOfName < match.index) { + if (from === 0) { + return NO_MATCH; + } + from = input.lastIndexOf(".", from - 2) + 1; + matcher.lastIndex = from; + match = matcher.exec(input); + } + var boundaries = []; + var matchEnd = match.index + match[0].length; + var score = 5; + var start = match.index; + var prevEnd = -1; + for (var i = 1; i < match.length; i += 2) { + var charType = getCharType(input[start]); + var isMatcherUpper = matcher.upperCase[i]; + // capturing groups come in pairs, match and non-match + boundaries.push(start, start + match[i].length); + // make sure groups are anchored on a left word boundary + var prevChar = input[start - 1] || ""; + var nextChar = input[start + 1] || ""; + if (start !== 0) { + if (charType === UNICODE_DIGIT && getCharType(prevChar) === UNICODE_DIGIT) { + return NO_MATCH; + } else if (charType === UNICODE_LETTER && getCharType(prevChar) === UNICODE_LETTER) { + var isUpper = isUpperCase(input[start]); + if (isUpper && (isLowerCase(prevChar) || isLowerCase(nextChar))) { + score -= 0.1; + } else if (isMatcherUpper && start === prevEnd) { + score -= isUpper ? 0.1 : 1.0; + } else { + return NO_MATCH; + } + } + } + prevEnd = start + match[i].length; + start += match[i].length + match[i + 1].length; + + // lower score for parts of the name that are missing + if (match[i + 1] && prevEnd < endOfName) { + score -= rateNoise(match[i + 1]); + } + } + // lower score if a type name contains unmatched camel-case parts + if (input[matchEnd - 1] !== "." && endOfName > matchEnd) + score -= rateNoise(input.slice(matchEnd, endOfName)); + score -= rateNoise(input.slice(0, Math.max(startOfName, match.index))); + + if (score <= 0) { + return NO_MATCH; + } + return { + input: input, + score: score, + boundaries: boundaries + }; +} +function isLetter(s) { + return /\p{L}/u.test(s); +} +function isUpperCase(s) { + return /\p{Lu}/u.test(s); +} +function isLowerCase(s) { + return /\p{Ll}/u.test(s); +} +function isDigit(s) { + return /\p{Nd}/u.test(s); +} +function getCharType(s) { + if (isLetter(s)) { + return UNICODE_LETTER; + } else if (isDigit(s)) { + return UNICODE_DIGIT; + } else { + return UNICODE_OTHER; + } +} +function rateNoise(str) { + return (str.match(/([.(])/g) || []).length / 5 + + (str.match(/(\p{Lu}+)/gu) || []).length / 10 + + str.length / 20; +} +function doSearch(request, response) { + var term = request.term.trim(); + var maxResults = request.maxResults || MAX_RESULTS; + var matcher = { + plainMatcher: createMatcher(term, false), + camelCaseMatcher: createMatcher(term, true) + } + var indexLoaded = indexFilesLoaded(); + + function getPrefix(item, category) { + switch (category) { + case "packages": + return checkUnnamed(item.m, "/"); + case "types": + return checkUnnamed(item.p, "."); + case "members": + return checkUnnamed(item.p, ".") + item.c + "."; + default: + return ""; + } + } + function useQualifiedName(category) { + switch (category) { + case "packages": + return /[\s/]/.test(term); + case "types": + case "members": + return /[\s.]/.test(term); + default: + return false; + } + } + function searchIndex(indexArray, category) { + var matches = []; + if (!indexArray) { + if (!indexLoaded) { + matches.push({ l: messages.loading, category: category }); + } + return matches; + } + $.each(indexArray, function (i, item) { + var prefix = getPrefix(item, category); + var simpleName = item.l; + var qualifiedName = prefix + simpleName; + var useQualified = useQualifiedName(category); + var input = useQualified ? qualifiedName : simpleName; + var startOfName = useQualified ? prefix.length : 0; + var endOfName = category === "members" && input.indexOf("(", startOfName) > -1 + ? input.indexOf("(", startOfName) : input.length; + var m = findMatch(matcher.plainMatcher, input, startOfName, endOfName); + if (m === NO_MATCH && matcher.camelCaseMatcher) { + m = findMatch(matcher.camelCaseMatcher, input, startOfName, endOfName); + } + if (m !== NO_MATCH) { + m.indexItem = item; + m.prefix = prefix; + m.category = category; + if (!useQualified) { + m.input = qualifiedName; + m.boundaries = m.boundaries.map(function(b) { + return b + prefix.length; + }); + } + matches.push(m); + } + return true; + }); + return matches.sort(function(e1, e2) { + return e2.score - e1.score; + }).slice(0, maxResults); + } + + var result = searchIndex(moduleSearchIndex, "modules") + .concat(searchIndex(packageSearchIndex, "packages")) + .concat(searchIndex(typeSearchIndex, "types")) + .concat(searchIndex(memberSearchIndex, "members")) + .concat(searchIndex(tagSearchIndex, "searchTags")); + + if (!indexLoaded) { + updateSearchResults = function() { + doSearch(request, response); + } + } else { + updateSearchResults = function() {}; + } + response(result); +} +// JQuery search menu implementation +$.widget("custom.catcomplete", $.ui.autocomplete, { + _create: function() { + this._super(); + this.widget().menu("option", "items", "> .result-item"); + // workaround for search result scrolling + this.menu._scrollIntoView = function _scrollIntoView( item ) { + var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; + if ( this._hasScroll() ) { + borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0; + paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0; + offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; + scroll = this.activeMenu.scrollTop(); + elementHeight = this.activeMenu.height() - 26; + itemHeight = item.outerHeight(); + + if ( offset < 0 ) { + this.activeMenu.scrollTop( scroll + offset ); + } else if ( offset + itemHeight > elementHeight ) { + this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); + } + } + }; + }, + _renderMenu: function(ul, items) { + var currentCategory = ""; + var widget = this; + widget.menu.bindings = $(); + $.each(items, function(index, item) { + if (item.category && item.category !== currentCategory) { + ul.append("
  • " + categories[item.category] + "
  • "); + currentCategory = item.category; + } + var li = widget._renderItemData(ul, item); + if (item.category) { + li.attr("aria-label", categories[item.category] + " : " + item.l); + } else { + li.attr("aria-label", item.l); + } + li.attr("class", "result-item"); + }); + ul.append("
    "); + }, + _renderItem: function(ul, item) { + var li = $("
  • ").appendTo(ul); + var div = $("
    ").appendTo(li); + var label = item.l + ? item.l + : getHighlightedText(item.input, item.boundaries, 0, item.input.length); + var idx = item.indexItem; + if (item.category === "searchTags" && idx && idx.h) { + if (idx.d) { + div.html(label + " (" + idx.h + ")
    " + + idx.d + "
    "); + } else { + div.html(label + " (" + idx.h + ")"); + } + } else { + div.html(label); + } + return li; + } +}); +$(function() { + var search = $("#search-input"); + var reset = $("#reset-search"); + search.catcomplete({ + minLength: 1, + delay: 200, + source: function(request, response) { + reset.css("display", "inline"); + if (request.term.trim() === "") { + return this.close(); + } + return doSearch(request, response); + }, + response: function(event, ui) { + if (!ui.content.length) { + ui.content.push({ l: messages.noResult }); + } else { + $("#search-input").empty(); + } + }, + close: function(event, ui) { + reset.css("display", search.val() ? "inline" : "none"); + }, + change: function(event, ui) { + reset.css("display", search.val() ? "inline" : "none"); + }, + autoFocus: true, + focus: function(event, ui) { + return false; + }, + position: { + collision: "flip" + }, + select: function(event, ui) { + if (ui.item.indexItem) { + var url = getURL(ui.item.indexItem, ui.item.category); + window.location.href = pathtoroot + url; + $("#search-input").focus(); + } + } + }); + search.val(''); + search.prop("disabled", false); + search.attr("autocapitalize", "off"); + reset.prop("disabled", false); + reset.click(function() { + search.val('').focus(); + reset.css("display", "none"); + }); + search.focus(); +}); diff --git a/docs/javadoc/4.0/search.html b/docs/javadoc/4.0/search.html new file mode 100644 index 00000000..404f76af --- /dev/null +++ b/docs/javadoc/4.0/search.html @@ -0,0 +1,74 @@ + + + + +Search (Hamcrest 4.0 API) + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Search

    +
    + + +
    +Additional resources +
    +
    +
    +

    The help page provides an introduction to the scope and syntax of JavaDoc search.

    +

    You can use the <ctrl> or <cmd> keys in combination with the left and right arrow keys to switch between result tabs in this page.

    +

    The URL template below may be used to configure this page as a search engine in browsers that support this feature. It has been tested to work in Google Chrome and Mozilla Firefox. Note that other browsers may not support this feature or require a different URL format.

    +link +

    + +

    +
    +

    Loading search index...

    + +
    +
    + + diff --git a/docs/javadoc/4.0/tag-search-index.js b/docs/javadoc/4.0/tag-search-index.js new file mode 100644 index 00000000..6fc375ce --- /dev/null +++ b/docs/javadoc/4.0/tag-search-index.js @@ -0,0 +1 @@ +tagSearchIndex = [{"l":"Example Usage","h":"class org.hamcrest.beans.HasPropertyWithValue","d":"Section","u":"org/hamcrest/beans/HasPropertyWithValue.html#example-usage-heading"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/javadoc/4.0/type-search-index.js b/docs/javadoc/4.0/type-search-index.js new file mode 100644 index 00000000..afbe220f --- /dev/null +++ b/docs/javadoc/4.0/type-search-index.js @@ -0,0 +1 @@ +typeSearchIndex = [{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"org.hamcrest.core","l":"AllOf"},{"p":"org.hamcrest.core","l":"AnyOf"},{"p":"org.hamcrest.collection","l":"ArrayAsIterableMatcher"},{"p":"org.hamcrest.collection","l":"ArrayMatching"},{"p":"org.hamcrest","l":"BaseDescription"},{"p":"org.hamcrest","l":"BaseMatcher"},{"p":"org.hamcrest.number","l":"BigDecimalCloseTo"},{"p":"org.hamcrest.text","l":"CharSequenceLength"},{"p":"org.hamcrest.core","l":"CombinableMatcher.CombinableBothMatcher"},{"p":"org.hamcrest.core","l":"CombinableMatcher.CombinableEitherMatcher"},{"p":"org.hamcrest.core","l":"CombinableMatcher"},{"p":"org.hamcrest.comparator","l":"ComparatorMatcherBuilder"},{"p":"org.hamcrest","l":"Condition"},{"p":"org.hamcrest","l":"CoreMatchers"},{"p":"org.hamcrest","l":"CustomMatcher"},{"p":"org.hamcrest","l":"CustomTypeSafeMatcher"},{"p":"org.hamcrest.core","l":"DescribedAs"},{"p":"org.hamcrest","l":"Description"},{"p":"org.hamcrest","l":"DiagnosingMatcher"},{"p":"org.hamcrest.core","l":"Every"},{"p":"org.hamcrest","l":"FeatureMatcher"},{"p":"org.hamcrest.io","l":"FileMatchers"},{"p":"org.hamcrest.io","l":"FileMatchers.FileStatus"},{"p":"org.hamcrest.object","l":"HasEqualValues"},{"p":"org.hamcrest.collection","l":"HasItemInArray"},{"p":"org.hamcrest.beans","l":"HasProperty"},{"p":"org.hamcrest.beans","l":"HasPropertyWithValue"},{"p":"org.hamcrest.object","l":"HasToString"},{"p":"org.hamcrest.xml","l":"HasXPath"},{"p":"org.hamcrest.core","l":"Is"},{"p":"org.hamcrest.core","l":"IsAnything"},{"p":"org.hamcrest.collection","l":"IsArray"},{"p":"org.hamcrest.collection","l":"IsArrayContainingInAnyOrder"},{"p":"org.hamcrest.collection","l":"IsArrayContainingInOrder"},{"p":"org.hamcrest.collection","l":"IsArrayWithSize"},{"p":"org.hamcrest.text","l":"IsBlankString"},{"p":"org.hamcrest.number","l":"IsCloseTo"},{"p":"org.hamcrest.core","l":"IsCollectionContaining"},{"p":"org.hamcrest.collection","l":"IsCollectionWithSize"},{"p":"org.hamcrest.object","l":"IsCompatibleType"},{"p":"org.hamcrest.collection","l":"IsEmptyCollection"},{"p":"org.hamcrest.collection","l":"IsEmptyIterable"},{"p":"org.hamcrest.text","l":"IsEmptyString"},{"p":"org.hamcrest.core","l":"IsEqual"},{"p":"org.hamcrest.text","l":"IsEqualCompressingWhiteSpace"},{"p":"org.hamcrest.text","l":"IsEqualIgnoringCase"},{"p":"org.hamcrest.object","l":"IsEventFrom"},{"p":"org.hamcrest.collection","l":"IsIn"},{"p":"org.hamcrest.core","l":"IsInstanceOf"},{"p":"org.hamcrest.core","l":"IsIterableContaining"},{"p":"org.hamcrest.collection","l":"IsIterableContainingInAnyOrder"},{"p":"org.hamcrest.collection","l":"IsIterableContainingInOrder"},{"p":"org.hamcrest.collection","l":"IsIterableContainingInRelativeOrder"},{"p":"org.hamcrest.collection","l":"IsIterableContainingParallelRuns"},{"p":"org.hamcrest.collection","l":"IsIterableWithSize"},{"p":"org.hamcrest.collection","l":"IsMapContaining"},{"p":"org.hamcrest.collection","l":"IsMapWithSize"},{"p":"org.hamcrest.number","l":"IsNaN"},{"p":"org.hamcrest.core","l":"IsNot"},{"p":"org.hamcrest.core","l":"IsNull"},{"p":"org.hamcrest.core","l":"IsSame"},{"p":"org.hamcrest.collection","l":"IsUnmodifiable"},{"p":"org.hamcrest","l":"Matcher"},{"p":"org.hamcrest","l":"MatcherAssert"},{"p":"org.hamcrest","l":"Matchers"},{"p":"org.hamcrest.text","l":"MatchesPattern"},{"p":"org.hamcrest","l":"Description.NullDescription"},{"p":"org.hamcrest.optional","l":"OptionalEmpty"},{"p":"org.hamcrest.optional","l":"OptionalWithValue"},{"p":"org.hamcrest.number","l":"OrderingComparison"},{"p":"org.hamcrest.io","l":"PathMatchers"},{"p":"org.hamcrest.beans","l":"PropertyAccessor"},{"p":"org.hamcrest.beans","l":"PropertyAccessor.PropertyReadLens"},{"p":"org.hamcrest.beans","l":"PropertyUtil"},{"p":"org.hamcrest.beans","l":"SamePropertyValuesAs"},{"p":"org.hamcrest","l":"SelfDescribing"},{"p":"org.hamcrest","l":"Condition.Step"},{"p":"org.hamcrest.core","l":"StringContains"},{"p":"org.hamcrest.text","l":"StringContainsInOrder"},{"p":"org.hamcrest","l":"StringDescription"},{"p":"org.hamcrest.core","l":"StringEndsWith"},{"p":"org.hamcrest.core","l":"StringRegularExpression"},{"p":"org.hamcrest.core","l":"StringStartsWith"},{"p":"org.hamcrest.core","l":"SubstringMatcher"},{"p":"org.hamcrest.exception","l":"ThrowsException"},{"p":"org.hamcrest","l":"TypeSafeDiagnosingMatcher"},{"p":"org.hamcrest","l":"TypeSafeMatcher"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/javadoc/index.html b/docs/javadoc/index.html index c12c7ea3..5dc51d8e 100644 --- a/docs/javadoc/index.html +++ b/docs/javadoc/index.html @@ -70,10 +70,11 @@

    Matchers that can be combined to create flexible expressions of intent

    API Reference Documentation (JavaDoc)

    Lastest Version

    Previous Versions

      +
    • JavaHamcrest 3.0
    • JavaHamcrest 2.2
    • JavaHamcrest 2.1
    • JavaHamcrest 1.3
    • diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 40e1c448..598d37c5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format [versions] -junit-jupiter = "5.11.3" +junit-jupiter = "5.13.4" [libraries] junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" } diff --git a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java index 5c7511ce..daa57b9a 100644 --- a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java @@ -1,56 +1,99 @@ package org.hamcrest; +import java.util.function.Function; + import org.hamcrest.internal.ReflectiveTypeFinder; /** - * Supporting class for matching a feature of an object. Implement featureValueOf() - * in a subclass to pull out the feature to be matched against. + * Supporting class for matching a feature of an object. Implement + * featureValueOf() in a subclass to pull out the feature to be + * matched against. * * @param The type of the object to be matched * @param The type of the feature to be matched */ public abstract class FeatureMatcher extends TypeSafeDiagnosingMatcher { - private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("featureValueOf", 1, 0); - private final Matcher subMatcher; - private final String featureDescription; - private final String featureName; - - /** - * Constructor - * @param subMatcher The matcher to apply to the feature - * @param featureDescription Descriptive text to use in describeTo - * @param featureName Identifying text for mismatch message - */ - public FeatureMatcher(Matcher subMatcher, String featureDescription, String featureName) { - super(TYPE_FINDER); - this.subMatcher = subMatcher; - this.featureDescription = featureDescription; - this.featureName = featureName; - } - - /** - * Implement this to extract the interesting feature. - * @param actual the target object - * @return the feature to be matched - */ - protected abstract U featureValueOf(T actual); - - @Override - protected boolean matchesSafely(T actual, Description mismatch) { - final U featureValue = featureValueOf(actual); - if (!subMatcher.matches(featureValue)) { - mismatch.appendText(featureName).appendText(" "); - subMatcher.describeMismatch(featureValue, mismatch); - return false; + private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("featureValueOf", 1, 0); + private final Matcher subMatcher; + private final String featureDescription; + private final String featureName; + + /** + * Constructor + * + * @param subMatcher The matcher to apply to the feature + * @param featureDescription Descriptive text to use in describeTo + * @param featureName Identifying text for mismatch message + */ + public FeatureMatcher(Matcher subMatcher, String featureDescription, String featureName) { + super(TYPE_FINDER); + this.subMatcher = subMatcher; + this.featureDescription = featureDescription; + this.featureName = featureName; } - return true; - } - @Override - public final void describeTo(Description description) { - description.appendText(featureDescription).appendText(" ") - .appendDescriptionOf(subMatcher); - } + /** + * Constructor + * + * @param subMatcher The matcher to apply to the feature + * @param featureDescription Descriptive text to use in describeTo + * @param featureName Identifying text for mismatch message + * @param expectedType expected type of the feature value + */ + private FeatureMatcher(Matcher subMatcher, String featureDescription, String featureName, Class expectedType) { + super(expectedType); + this.subMatcher = subMatcher; + this.featureDescription = featureDescription; + this.featureName = featureName; + } + /** + * Implement this to extract the interesting feature. + * + * @param actual the target object + * @return the feature to be matched + */ + protected abstract U featureValueOf(T actual); + + @Override + protected boolean matchesSafely(T actual, Description mismatch) { + final U featureValue = featureValueOf(actual); + if (!subMatcher.matches(featureValue)) { + mismatch.appendText(featureName).appendText(" "); + subMatcher.describeMismatch(featureValue, mismatch); + return false; + } + return true; + } + + @Override + public final void describeTo(Description description) { + description.appendText(featureDescription).appendText(" ").appendDescriptionOf(subMatcher); + } + + /** + * Create a {@code Matcher} that matches a feature of an object. + * + *

      + * Uses the {@code extractor} function to pull the feature from the object, and + * applies the {@code featureMatcher} to that feature. The result of the + * {@code featureMatcher} call is returned as the result of the created + * {@code Matcher}. + *

      + * + * @param featureMatcher the {@code Matcher} for the expected feature value + * @param extractor {@code Function} to extract the feature from the object + * @param featureDescription descriptive text to use in {@code describeTo} + * @param featureName identifying text for mismatch message + * @param expectedType expected type to match against + * @return a {@code Matcher} that matches against the feature of the object + */ + public static Matcher matcher(final Matcher featureMatcher, final Function extractor, + String featureDescription, String featureName, Class expectedType) { + return new FeatureMatcher(featureMatcher, featureDescription, featureName, expectedType) { + @Override + protected F featureValueOf(T actual) { return extractor.apply(actual); } + }; + } } diff --git a/hamcrest/src/main/java/org/hamcrest/Matchers.java b/hamcrest/src/main/java/org/hamcrest/Matchers.java index 60d8256a..660a1626 100644 --- a/hamcrest/src/main/java/org/hamcrest/Matchers.java +++ b/hamcrest/src/main/java/org/hamcrest/Matchers.java @@ -643,8 +643,8 @@ public static org.hamcrest.Matcher notNullValue() { } /** - * A shortcut to the frequently used not(nullValue(X.class)). Accepts a - * single dummy argument to facilitate type inference.. + * 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: @@ -1602,6 +1602,7 @@ public static org.hamcrest.Matcher in(T[] elements) { * the collection in which matching items must be found * @return The matcher. */ + @Deprecated @SuppressWarnings("deprecation") public static org.hamcrest.Matcher isIn(java.util.Collection collection) { return org.hamcrest.collection.IsIn.isIn(collection); @@ -1620,6 +1621,7 @@ public static org.hamcrest.Matcher isIn(java.util.Collection collectio * the array in which matching items must be found * @return The matcher. */ + @Deprecated @SuppressWarnings("deprecation") public static org.hamcrest.Matcher isIn(T[] elements) { return org.hamcrest.collection.IsIn.isIn(elements); @@ -1638,6 +1640,7 @@ public static org.hamcrest.Matcher isIn(T[] elements) { * the elements amongst which matching items will be found * @return The matcher. */ + @Deprecated @SuppressWarnings("deprecation") @SafeVarargs public static org.hamcrest.Matcher isOneOf(T... elements) { @@ -1809,6 +1812,7 @@ public static Matcher equalToIgnoringCase(java.lang.String exp * the expected value of matched strings * @return The matcher. */ + @Deprecated public static Matcher equalToIgnoringWhiteSpace(java.lang.String expectedString) { return equalToCompressingWhiteSpace(expectedString); } @@ -1864,6 +1868,7 @@ public static Matcher emptyString() { * @deprecated use is(emptyOrNullString()) instead * @return The matcher. */ + @Deprecated @SuppressWarnings("deprecation") public static Matcher isEmptyOrNullString() { return org.hamcrest.text.IsEmptyString.isEmptyOrNullString(); @@ -1877,6 +1882,7 @@ public static Matcher isEmptyOrNullString() { * @deprecated use is(emptyString()) instead * @return The matcher. */ + @Deprecated @SuppressWarnings("deprecation") public static Matcher isEmptyString() { return org.hamcrest.text.IsEmptyString.isEmptyString(); diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java index 4bcf871b..779acfc1 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java @@ -1,5 +1,7 @@ package org.hamcrest; +import java.util.function.Predicate; + import org.hamcrest.internal.ReflectiveTypeFinder; /** @@ -82,4 +84,36 @@ public final void describeMismatch(Object item, Description mismatchDescription) } } + /** + * Creates a {@code TypeSafeDiagnosingMatcher} that matches an item based on a {@code Predicate}. + * + *

      + * If the {@code predicate} returns {@code true}, the {@code Matcher} will match and use the {@code successDescription}. + * If the {@code predicate} returns {@code false}, the {@code Matcher} will not match and use the {@code failureDescription}. + *

      + * + * @param Type of the item to match + * @param predicate {@code Predicate} to test the item. Should return {@code true} if the item matches, {@code false} otherwise. + * @param successDescription Description to use when the {@code predicate} matches + * @param failureDescription Description to use when the {@code predicate} does not match + * @param expectedType Expected type of the item to match + * @return Matcher that matches the item based on the {@code predicate} + */ + public static Matcher matcher(Predicate predicate, final String successDescription, final String failureDescription, Class expectedType) { + return new TypeSafeDiagnosingMatcher(expectedType) { + public boolean matchesSafely(T actual, Description mismatchDescription) { + final boolean result = predicate.test(actual); + if (!result) { + mismatchDescription.appendText(String.format("'%s' %s", actual, failureDescription)); + } + return result; + } + + public void describeTo(Description description) { + description.appendText(successDescription); + } + }; + } + + } diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java index 8494c9a3..59f351b1 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java @@ -30,8 +30,8 @@ public HasProperty(String propertyName) { @Override public boolean matchesSafely(T obj) { try { - return PropertyUtil.getPropertyDescriptor(propertyName, obj) != null || - PropertyUtil.getMethodDescriptor(propertyName, obj) != null; + PropertyAccessor accessor = new PropertyAccessor(obj); + return accessor.fieldNames().contains(propertyName); } catch (IllegalArgumentException e) { return false; } diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java index f45c1264..c65f460f 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java @@ -4,10 +4,8 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.beans.PropertyAccessor.PropertyReadLens; -import java.beans.FeatureDescriptor; -import java.beans.MethodDescriptor; -import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; @@ -16,7 +14,7 @@ import static org.hamcrest.Condition.matched; import static org.hamcrest.Condition.notMatched; -import static org.hamcrest.beans.PropertyUtil.NO_ARGUMENTS; +import static org.hamcrest.beans.PropertyAccessor.NO_ARGUMENTS; /** *

      A matcher that checks if an object has a JavaBean property with the @@ -71,7 +69,7 @@ */ public class HasPropertyWithValue extends TypeSafeDiagnosingMatcher { - private static final Condition.Step WITH_READ_METHOD = withReadMethod(); + private static final Condition.Step WITH_READ_METHOD = withReadMethod(); private final String propertyName; private final Matcher valueMatcher; private final String messageFormat; @@ -113,17 +111,14 @@ public void describeTo(Description description) { .appendDescriptionOf(valueMatcher).appendText(")"); } - private Condition propertyOn(T bean, Description mismatch) { - FeatureDescriptor property = PropertyUtil.getPropertyDescriptor(propertyName, bean); - if (property == null) { - property = PropertyUtil.getMethodDescriptor(propertyName, bean); - } - if (property == null) { + private Condition propertyOn(T bean, Description mismatch) { + PropertyAccessor accessor = new PropertyAccessor(bean); + if (!accessor.fieldNames().contains(propertyName)) { mismatch.appendText("No property \"" + propertyName + "\""); return notMatched(); } - return matched(property, mismatch); + return matched(accessor.readLensFor(propertyName), mismatch); } private Condition.Step withPropertyValue(final T bean) { @@ -149,13 +144,11 @@ private static Matcher nastyGenericsWorkaround(Matcher valueMatcher) return (Matcher) valueMatcher; } - private static Condition.Step withReadMethod() { - return (property, mismatch) -> { - final Method readMethod = property instanceof PropertyDescriptor ? - ((PropertyDescriptor) property).getReadMethod() : - (((MethodDescriptor) property).getMethod()); + private static Condition.Step withReadMethod() { + return (readLens, mismatch) -> { + final Method readMethod = readLens.getReadMethod(); if (null == readMethod || readMethod.getReturnType() == void.class) { - mismatch.appendText("property \"" + property.getName() + "\" is not readable"); + mismatch.appendText("property \"" + readLens.getName() + "\" is not readable"); return notMatched(); } return matched(readMethod, mismatch); diff --git a/hamcrest/src/main/java/org/hamcrest/beans/PropertyAccessor.java b/hamcrest/src/main/java/org/hamcrest/beans/PropertyAccessor.java new file mode 100644 index 00000000..4dd414cd --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/beans/PropertyAccessor.java @@ -0,0 +1,219 @@ +package org.hamcrest.beans; + +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.MethodDescriptor; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.*; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +/** + * Utility class to help with finding properties in an object. + *

      + * The properties can be either properties as described by the + * JavaBean specification and APIs, or it will fall back to finding + * fields with corresponding methods, enabling the property matchers + * to work with newer classes like Records. + *

      + * See https://docs.oracle.com/javase/8/docs/technotes/guides/beans/index.html for + * more information on JavaBeans. + */ +public class PropertyAccessor { + private final Object beanLikeObject; + private final SortedMap readLenses; + + /** + * Constructor. + * @param beanLikeObject the object to search for properties. + */ + public PropertyAccessor(Object beanLikeObject) { + this.beanLikeObject = beanLikeObject; + this.readLenses = new TreeMap<>(makeLensesFor(beanLikeObject)); + } + + private Map makeLensesFor(Object bean) { + PropertyDescriptor[] properties = propertyDescriptorsFor(bean, Object.class); + if (properties != null && properties.length > 0) { + return makePropertyLensesFrom(properties); + } + + return makeFieldMethodLensesFor(bean); + } + + private Map makePropertyLensesFrom(PropertyDescriptor[] descriptors) { + return Arrays.stream(descriptors) + .map(pd -> new PropertyReadLens(pd.getDisplayName(), pd.getReadMethod())) + .collect(Collectors.toMap(PropertyReadLens::getName, Function.identity())); + } + + private Map makeFieldMethodLensesFor(Object bean) { + try { + Set fieldNames = getFieldNames(bean); + MethodDescriptor[] methodDescriptors = Introspector.getBeanInfo(bean.getClass(), null).getMethodDescriptors(); + return Arrays.stream(methodDescriptors) + .filter(IsPropertyAccessor.forOneOf(fieldNames)) + .map(md -> new PropertyReadLens(md.getDisplayName(), md.getMethod())) + .collect(Collectors.toMap(PropertyReadLens::getName, Function.identity())); + } + catch (IntrospectionException e) { + throw new IllegalArgumentException("Could not get method descriptors for " + bean.getClass(), e); + } + } + + /** + * The names of properties that were found in the object. + * @return a set of field names + */ + public Set fieldNames() { + return readLenses.keySet(); + } + + /** + * The collection of lenses for all the properties that were found in the + * object. + * @return the collection of lenses + */ + public Collection readLenses() { + return readLenses.values(); + } + + /** + * The read lens for the specified property. + * @param propertyName the property to find the lens for. + * @return the read lens for the property + */ + public PropertyReadLens readLensFor(String propertyName) { + return readLenses.get(propertyName); + } + + /** + * The value of the specified property. + * @param propertyName the name of the property + * @return the value of the given property name. + */ + public Object fieldValue(String propertyName) { + PropertyReadLens lens = readLenses.get(propertyName); + if (lens == null) { + String message = String.format("Unknown property '%s' for bean '%s'", propertyName, beanLikeObject); + throw new IllegalArgumentException(message); + } + return lens.getValue(); + } + + /** + * Returns the field names of the given object. + * It can be the names of the record components of Java Records, for example. + * + * @param fromObj the object to check + * @return The field names + * @throws IllegalArgumentException if there's a security issue reading the fields + */ + private static Set getFieldNames(Object fromObj) throws IllegalArgumentException { + try { + return Arrays.stream(fromObj.getClass().getDeclaredFields()) + .map(Field::getName) + .collect(Collectors.toSet()); + } catch (SecurityException e) { + throw new IllegalArgumentException("Could not get record component names for " + fromObj.getClass(), e); + } + } + + + /** + * Predicate that checks if a given {@link MethodDescriptor} corresponds to a field. + *

      + * This predicate assumes a method is a field access if the method name exactly + * matches the field name, takes no parameters and returns a non-void type. + */ + private static class IsPropertyAccessor implements Predicate { + private final Set propertyNames; + + private IsPropertyAccessor(Set propertyNames) { + this.propertyNames = propertyNames; + } + + public static IsPropertyAccessor forOneOf(Set propertyNames) { + return new IsPropertyAccessor(propertyNames); + } + + @Override + public boolean test(MethodDescriptor md) { + return propertyNames.contains(md.getDisplayName()) && + md.getMethod().getReturnType() != void.class && + md.getMethod().getParameterCount() == 0; + } + } + + /** + * Encapsulates a property in the parent object. + */ + public class PropertyReadLens { + private final String name; + private final Method readMethod; + + /** + * Constructor. + * @param name the name of the property + * @param readMethod the method that can be used to get the value of the property + */ + public PropertyReadLens(String name, Method readMethod) { + this.name = name; + this.readMethod = readMethod; + } + + /** + * The name of the property + * @return the name of the property. + */ + public String getName() { + return name; + } + + /** + * The read method for the property. + * @return the read method for the property. + */ + public Method getReadMethod() { + return readMethod; + } + + /** + * The value of the property. + * @return the value of the property. + */ + public Object getValue() { + Object bean = PropertyAccessor.this.beanLikeObject; + try { + return readMethod.invoke(bean, NO_ARGUMENTS); + } catch (Exception e) { + throw new IllegalArgumentException("Could not invoke " + readMethod + " on " + bean, e); + } + } + } + + /** + * Returns all the property descriptors for the class associated with the given object + * + * @param fromObj Use the class of this object + * @param stopClass Don't include any properties from this ancestor class upwards. + * @return Property descriptors + * @throws IllegalArgumentException if there's a introspection failure + */ + public static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj, Class stopClass) throws IllegalArgumentException { + try { + return Introspector.getBeanInfo(fromObj.getClass(), stopClass).getPropertyDescriptors(); + } catch (IntrospectionException e) { + throw new IllegalArgumentException("Could not get property descriptors for " + fromObj.getClass(), e); + } + } + + /** + * Empty object array, used for documenting that we are deliberately passing no arguments to a method. + */ + public static final Object[] NO_ARGUMENTS = new Object[0]; + +} diff --git a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java index 40d5a37d..002fbc3c 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java @@ -2,12 +2,7 @@ import java.beans.IntrospectionException; import java.beans.Introspector; -import java.beans.MethodDescriptor; import java.beans.PropertyDescriptor; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; /** * Utility class with static methods for accessing properties on JavaBean objects. @@ -16,9 +11,10 @@ * * @author Iain McGinniss * @author Steve Freeman - * @author Uno Kim * @since 1.1.0 + * @deprecated Replaced by {@link PropertyAccessor} */ +@Deprecated public class PropertyUtil { private PropertyUtil() { @@ -33,7 +29,7 @@ private PropertyUtil() { * @param fromObj * the object to check. * @return the descriptor of the property, or null if the property does not exist. - * @throws IllegalArgumentException if there's an introspection failure + * @throws IllegalArgumentException if there's a introspection failure */ public static PropertyDescriptor getPropertyDescriptor(String propertyName, Object fromObj) throws IllegalArgumentException { for (PropertyDescriptor property : propertyDescriptorsFor(fromObj, null)) { @@ -51,7 +47,7 @@ public static PropertyDescriptor getPropertyDescriptor(String propertyName, Obje * @param fromObj Use the class of this object * @param stopClass Don't include any properties from this ancestor class upwards. * @return Property descriptors - * @throws IllegalArgumentException if there's an introspection failure + * @throws IllegalArgumentException if there's a introspection failure */ public static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj, Class stopClass) throws IllegalArgumentException { try { @@ -61,73 +57,6 @@ public static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj, Class< } } - /** - * Returns the description of the read accessor method with the provided - * name on the provided object's interface. - * This is what you need when you try to find a property from a target object - * when it doesn't follow standard JavaBean specification, a Java Record for example. - * - * @param propertyName the object property name. - * @param fromObj the object to check. - * @return the descriptor of the method, or null if the method does not exist. - * @throws IllegalArgumentException if there's an introspection failure - * @see Java Records - * - */ - public static MethodDescriptor getMethodDescriptor(String propertyName, Object fromObj) throws IllegalArgumentException { - for (MethodDescriptor method : recordReadAccessorMethodDescriptorsFor(fromObj, null)) { - if (method.getName().equals(propertyName)) { - return method; - } - } - - return null; - } - - /** - * Returns read accessor method descriptors for the class associated with the given object. - * This is useful when you find getter methods for the fields from the object - * when it doesn't follow standard JavaBean specification, a Java Record for example. - * Be careful as this doesn't return standard JavaBean getter methods, like a method starting with {@code get-}. - * - * @param fromObj Use the class of this object - * @param stopClass Don't include any properties from this ancestor class upwards. - * @return Method descriptors for read accessor methods - * @throws IllegalArgumentException if there's an introspection failure - */ - public static MethodDescriptor[] recordReadAccessorMethodDescriptorsFor(Object fromObj, Class stopClass) throws IllegalArgumentException { - try { - Set recordComponentNames = getFieldNames(fromObj); - MethodDescriptor[] methodDescriptors = Introspector.getBeanInfo(fromObj.getClass(), stopClass).getMethodDescriptors(); - - return Arrays.stream(methodDescriptors) - .filter(x -> recordComponentNames.contains(x.getDisplayName())) - .filter(x -> x.getMethod().getReturnType() != void.class) - .filter(x -> x.getMethod().getParameterCount() == 0) - .toArray(MethodDescriptor[]::new); - } catch (IntrospectionException e) { - throw new IllegalArgumentException("Could not get method descriptors for " + fromObj.getClass(), e); - } - } - - /** - * Returns the field names of the given object. - * It can be the names of the record components of Java Records, for example. - * - * @param fromObj the object to check - * @return The field names - * @throws IllegalArgumentException if there's a security issue reading the fields - */ - public static Set getFieldNames(Object fromObj) throws IllegalArgumentException { - try { - return Arrays.stream(fromObj.getClass().getDeclaredFields()) - .map(Field::getName) - .collect(Collectors.toSet()); - } catch (SecurityException e) { - throw new IllegalArgumentException("Could not get record component names for " + fromObj.getClass(), e); - } - } - /** * Empty object array, used for documenting that we are deliberately passing no arguments to a method. */ diff --git a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java index fbb0175f..58425eee 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java @@ -3,17 +3,13 @@ import org.hamcrest.Description; import org.hamcrest.DiagnosingMatcher; import org.hamcrest.Matcher; +import org.hamcrest.beans.PropertyAccessor.PropertyReadLens; import java.beans.FeatureDescriptor; -import java.beans.MethodDescriptor; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; import java.util.*; +import java.util.stream.Collectors; 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.beans.PropertyUtil.recordReadAccessorMethodDescriptorsFor; import static org.hamcrest.core.IsEqual.equalTo; /** @@ -36,15 +32,11 @@ public class SamePropertyValuesAs extends DiagnosingMatcher { */ @SuppressWarnings("WeakerAccess") public SamePropertyValuesAs(T expectedBean, List ignoredProperties) { - FeatureDescriptor[] descriptors = propertyDescriptorsFor(expectedBean, Object.class); - if (descriptors == null || descriptors.length == 0) { - descriptors = recordReadAccessorMethodDescriptorsFor(expectedBean, Object.class); - } - + PropertyAccessor accessor = new PropertyAccessor(expectedBean); this.expectedBean = expectedBean; this.ignoredFields = ignoredProperties; - this.propertyNames = propertyNamesFrom(descriptors, ignoredProperties); - this.propertyMatchers = propertyMatchersFor(expectedBean, descriptors, ignoredProperties); + this.propertyNames = propertyNamesFrom(accessor, ignoredProperties); + this.propertyMatchers = propertyMatchersFor(expectedBean, accessor, ignoredProperties); } @Override @@ -75,8 +67,9 @@ private boolean isCompatibleType(Object actual, Description mismatchDescription) } private boolean hasNoExtraProperties(Object actual, Description mismatchDescription) { - Set actualPropertyNames = propertyNamesFrom(propertyDescriptorsFor(actual, Object.class), ignoredFields); - actualPropertyNames.removeAll(propertyNames); + PropertyAccessor accessor = new PropertyAccessor(actual); + Set actualPropertyNames = propertyNamesFrom(accessor, ignoredFields); + propertyNames.forEach(actualPropertyNames::remove); if (!actualPropertyNames.isEmpty()) { mismatchDescription.appendText("has extra properties called " + actualPropertyNames); return false; @@ -94,24 +87,17 @@ private boolean hasMatchingValues(Object actual, Description mismatchDescription return true; } - private static List propertyMatchersFor(T bean, FeatureDescriptor[] descriptors, List ignoredFields) { - List result = new ArrayList<>(descriptors.length); - for (FeatureDescriptor descriptor : descriptors) { - if (isNotIgnored(ignoredFields, descriptor)) { - result.add(new PropertyMatcher(descriptor, bean)); - } - } - return result; + private static List propertyMatchersFor(T bean, PropertyAccessor accessor, List ignoredFields) { + return accessor.readLenses().stream() + .filter(lens -> !ignoredFields.contains(lens.getName())) + .map(lens -> new PropertyMatcher(lens, bean)) + .collect(Collectors.toList()); } - private static Set propertyNamesFrom(FeatureDescriptor[] descriptors, List ignoredFields) { - HashSet result = new HashSet<>(); - for (FeatureDescriptor descriptor : descriptors) { - if (isNotIgnored(ignoredFields, descriptor)) { - result.add(descriptor.getDisplayName()); - } - } - return result; + private static Set propertyNamesFrom(PropertyAccessor accessor, List ignoredFields) { + Set fieldNames = new HashSet<>(accessor.fieldNames()); + ignoredFields.forEach(fieldNames::remove); + return fieldNames; } private static boolean isNotIgnored(List ignoredFields, FeatureDescriptor propertyDescriptor) { @@ -120,23 +106,20 @@ private static boolean isNotIgnored(List ignoredFields, FeatureDescripto @SuppressWarnings("WeakerAccess") private static class PropertyMatcher extends DiagnosingMatcher { - private final Method readMethod; + private final PropertyReadLens expectedReadLens; private final Matcher matcher; - private final String propertyName; - - public PropertyMatcher(FeatureDescriptor descriptor, Object expectedObject) { - this.propertyName = descriptor.getDisplayName(); - this.readMethod = descriptor instanceof PropertyDescriptor ? - ((PropertyDescriptor) descriptor).getReadMethod() : - ((MethodDescriptor) descriptor).getMethod(); - this.matcher = equalTo(readProperty(readMethod, expectedObject)); + + public PropertyMatcher(PropertyReadLens expectedReadLens, Object expectedObject) { + this.expectedReadLens = expectedReadLens; + this.matcher = equalTo(expectedReadLens.getValue()); } @Override public boolean matches(Object actual, Description mismatch) { - final Object actualValue = readProperty(readMethod, actual); + PropertyAccessor actualAccessor = new PropertyAccessor(actual); + Object actualValue = actualAccessor.fieldValue(expectedReadLens.getName()); if (!matcher.matches(actualValue)) { - mismatch.appendText(propertyName + " "); + mismatch.appendText(expectedReadLens.getName()+ " "); matcher.describeMismatch(actualValue, mismatch); return false; } @@ -145,15 +128,7 @@ public boolean matches(Object actual, Description mismatch) { @Override public void describeTo(Description description) { - description.appendText(propertyName + ": ").appendDescriptionOf(matcher); - } - } - - private static Object readProperty(Method method, Object target) { - try { - return method.invoke(target, NO_ARGUMENTS); - } catch (Exception e) { - throw new IllegalArgumentException("Could not invoke " + method + " on " + target, e); + description.appendText(expectedReadLens.getName() + ": ").appendDescriptionOf(matcher); } } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index 82b4b59c..930cced0 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -67,6 +67,7 @@ public void describeTo(Description description) { * a list of matchers, each of which must be satisfied by an entry in an examined array * @return The matcher. */ + @Deprecated public static Matcher arrayContainingInAnyOrder(Matcher... itemMatchers) { return arrayContainingInAnyOrder((Collection) Arrays.asList(itemMatchers)); } @@ -91,6 +92,7 @@ public static Matcher arrayContainingInAnyOrder(Matcher... i * a list of matchers, each of which must be satisfied by an item provided by an examined array * @return The matcher. */ + @Deprecated public static Matcher arrayContainingInAnyOrder(Collection> itemMatchers) { return new IsArrayContainingInAnyOrder<>(itemMatchers); } @@ -115,6 +117,7 @@ public static Matcher arrayContainingInAnyOrder(Collection Matcher arrayContainingInAnyOrder(E... items) { List> matchers = new ArrayList<>(); for (E item : items) { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index 3c748cfb..16a29bd5 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -16,6 +16,7 @@ * * @deprecated As of release 2.1, replaced by {@link ArrayMatching}. */ +@Deprecated public class IsArrayContainingInOrder extends TypeSafeMatcher { private final Collection> matchers; @@ -61,6 +62,7 @@ public void describeTo(Description description) { * the items that must equal the items within an examined array * @return The matcher. */ + @Deprecated public static Matcher arrayContaining(E... items) { List> matchers = new ArrayList<>(); for (E item : items) { @@ -84,6 +86,7 @@ public static Matcher arrayContaining(E... items) { * the matchers that must be satisfied by the items in the examined array * @return The matcher. */ + @Deprecated public static Matcher arrayContaining(Matcher... itemMatchers) { return arrayContaining((List) asList(itemMatchers)); } @@ -103,6 +106,7 @@ public static Matcher arrayContaining(Matcher... itemMatcher * a list of matchers, each of which must be satisfied by the corresponding item in an examined array * @return The matcher. */ + @Deprecated public static Matcher arrayContaining(List> itemMatchers) { return new IsArrayContainingInOrder<>(itemMatchers); } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index ad1b951d..317ff8e2 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -3,11 +3,9 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.comparator.ComparatorMatcherBuilder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; +import java.util.*; import static org.hamcrest.core.IsEqual.equalTo; @@ -151,6 +149,42 @@ public static Matcher> containsInAnyOrder(T... items) 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 logically equal according to + * the comparator 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("first", "second"), containsInAnyOrder(new StringLengthComparator(), "abcde", "ZYXWVU"))
      + * + * @param + * the matcher type. + * @param comparator + * the comparator to use to compare items to the items provided. + * @param items + * the items that must equal (according to the provided comparator) the items provided by + * an examined {@link Iterable} in any order + * @return The matcher. + */ + @SafeVarargs + public static Matcher> containsInAnyOrder(Comparator comparator, T... items) { + List> matchers = new ArrayList<>(); + for (T item : items) { + matchers.add(ComparatorMatcherBuilder.comparedBy(comparator).comparesEqualTo(item)); + } + + return containsInAnyOrder(matchers); + } + /** *

      * Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java index 5d39f752..fb3cc39f 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.List; +import org.hamcrest.collection.IsIterableContainingParallelRuns.MatchParallelRuns; import static java.util.Arrays.asList; import static org.hamcrest.core.IsEqual.equalTo; @@ -29,54 +30,16 @@ public IsIterableContainingInRelativeOrder(List> matchers) { @Override protected boolean matchesSafely(Iterable iterable, Description mismatchDescription) { - MatchSeriesInRelativeOrder matchSeriesInRelativeOrder = new MatchSeriesInRelativeOrder<>(matchers, mismatchDescription); - matchSeriesInRelativeOrder.processItems(iterable); - return matchSeriesInRelativeOrder.isFinished(); + final MatchParallelRuns matchParallelRuns = + new MatchParallelRuns<>(1, matchers, mismatchDescription); + matchParallelRuns.processItems(iterable); + return matchParallelRuns.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 diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingParallelRuns.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingParallelRuns.java new file mode 100644 index 00000000..f0785b1a --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingParallelRuns.java @@ -0,0 +1,155 @@ +package org.hamcrest.collection; + +import static java.util.Arrays.asList; +import static org.hamcrest.core.IsEqual.equalTo; + +import java.util.ArrayList; +import java.util.List; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +/** + * A matcher like that can check an iterable for parallel runs of a list of matchers. It is similar + * to {@link org.hamcrest.collection.IsIterableContainingInRelativeOrder}, in fact behaving exactly + * the same when {@code numRuns = 1}. + * + * @param Type of items to match. + * @see #containsParallelRunsOf(int, List) + */ +public class IsIterableContainingParallelRuns extends TypeSafeDiagnosingMatcher> { + + private final int numRuns; + private final List> matchers; + + /** + * Construct a new matcher that will check for parallel runs. + * + * @see IsIterableContainingParallelRuns + * @see #containsParallelRunsOf(int, List) + */ + public IsIterableContainingParallelRuns( + final int numRuns, final List> matchers + ) { + if (numRuns <= 0) { + throw new IllegalArgumentException("The number of parallel runs must be strictly positive"); + } + this.numRuns = numRuns; + this.matchers = matchers; + } + + @Override + protected boolean matchesSafely( + final Iterable iterable, final Description mismatchDescription + ) { + final MatchParallelRuns matchParallelRuns = + new MatchParallelRuns<>(numRuns, matchers, mismatchDescription); + matchParallelRuns.processItems(iterable); + return matchParallelRuns.isFinished(); + } + + @Override + public void describeTo(Description description) { + description.appendText("iterable containing "); + if (numRuns > 1) { + description.appendValue(numRuns).appendText(" parallel runs of "); + } + description.appendList("[", ", ", "]", matchers) + .appendText(" in relative order"); + } + + static class MatchParallelRuns { + private final int numRuns; + private final List> matchers; + private final Description mismatchDescription; + private final List nextMatchIndexes; + private final List lastMatchedItems; + + public MatchParallelRuns( + final int numRuns, + final List> matchers, + final Description mismatchDescription + ) { + this.numRuns = numRuns; + if (matchers.isEmpty()) { + throw new IllegalArgumentException("Should specify at least one expected element"); + } else { + this.matchers = matchers; + } + this.mismatchDescription = mismatchDescription; + this.nextMatchIndexes = new ArrayList<>(numRuns); + this.lastMatchedItems = new ArrayList<>(numRuns); + for (int i = 0; i < numRuns; ++i) { + this.nextMatchIndexes.add(0); + this.lastMatchedItems.add(null); + } + } + + public void processItems(Iterable iterable) { + for (final F item : iterable) { + for (int i = 0; i < numRuns; ++i) { + final int nextMatchIndex = nextMatchIndexes.get(i); + if (nextMatchIndex < matchers.size() && matchers.get(nextMatchIndex).matches(item)) { + lastMatchedItems.set(i, item); + nextMatchIndexes.set(i, nextMatchIndex + 1); + break; + } + } + } + } + + public boolean isFinished() { + boolean isFinished = true; + for (int i = 0; i < numRuns; ++i) { + final int nextMatchIndex = nextMatchIndexes.get(i); + if (nextMatchIndex < matchers.size()) { + if (!isFinished) { + mismatchDescription.appendText("; and "); + } + isFinished = false; + mismatchDescription.appendDescriptionOf(matchers.get(nextMatchIndex)) + .appendText(" was not found"); + if (lastMatchedItems.get(i) != null) { + mismatchDescription.appendText(" after ").appendValue(lastMatchedItems.get(i)); + } + if (numRuns > 1) { + mismatchDescription.appendText(" in run ").appendValue(i + 1); + } + } + } + return isFinished; + } + } + + /** + * Creates a matcher for {@link Iterable Iterables} 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, with {@code numRuns} + * occurrences of the specified series of items being matched (possibly interspersed). + */ + @SafeVarargs + public static Matcher> containsParallelRunsOf( + final int numRuns, final E... items + ) { + final List> matchers = new ArrayList<>(items.length); + for (final Object item : items) { + matchers.add(equalTo(item)); + } + + return containsParallelRunsOf(numRuns, matchers); + } + + @SafeVarargs + public static Matcher> containsParallelRunsOf( + final int numRuns, final Matcher... matchers + ) { + return containsParallelRunsOf(numRuns, List.>of(matchers)); + } + + public static Matcher> containsParallelRunsOf( + final int numRuns, final List> matchers + ) { + return new IsIterableContainingParallelRuns<>(numRuns, matchers); + } + +} diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsUnmodifiable.java b/hamcrest/src/main/java/org/hamcrest/collection/IsUnmodifiable.java new file mode 100644 index 00000000..4bd6e5c9 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsUnmodifiable.java @@ -0,0 +1,531 @@ +package org.hamcrest.collection; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; +import java.util.*; + +/** + * This class contains static factory methods for creating Matchers that test if a collection is unmodifiable. + * + *

      + * The main matcher is {@link #isUnmodifiableCollection()} which tries to determine if a collection is unmodifiable. + * Other matchers are provided to test specific cases, such as {@link #isUnmodifiableJdkCollection()}, + * {@link #isModifiableJdkCollection()} and {@link #isUnmodifiableCustomCollection()}. + *

      + * + */ +public class IsUnmodifiable { + + // Prevent instantiation + private IsUnmodifiable() { + } + + /** + * Creates matcher that matches when collection is unmodifiable. + * + * It looks for any of the known modifiable or unmodifiable JDK collections, if not found it tries to instantiate + * the collection and call all modification methods to see if any of them succeed. This instantiation can fail if + * the collection does not have a constructor that can be called with default values. + * + * @param the type of elements in the collection + * @return The matcher + */ + public static Matcher> isUnmodifiableCollection() { + return new IsUnmodifiableCollectionMatcher<>(); + } + + /** + * Creates a matcher that matches when the collection is one of the known unmodifiable JDK collections. + * + * @param the type of elements in the collection + * @return The matcher + */ + public static Matcher> isUnmodifiableJdkCollection() { + return new IsUnmodifiableJdkCollectionMatcher<>(); + } + + /** + * Creates a matcher that matches when the collection is one of the known modifiable JDK collections. + * + * @param the type of elements in the collection + * @return The matcher + */ + public static Matcher> isModifiableJdkCollection() { + return new IsModifiableJdkCollectionMatcher<>(); + } + + /** + * Creates a matcher that matches when the collection is unmodifiable by calling all modification methods to see if + * any of them succeed. This instantiation can fail if the collection does not have a constructor that can be called + * with default values. + * + * @param the type of elements in the collection + * @return The matcher + */ + public static Matcher> isUnmodifiableCustomCollection() { + return new IsUnmodifiableCustomCollectionMatcher<>(); + } + + private static class IsUnmodifiableCollectionMatcher extends TypeSafeDiagnosingMatcher> { + private final Matcher> isUnmodifiableJdkCollection; + private final Matcher> isModifiableJdkCollection; + private final Matcher> isUnmodifiableCustomCollection; + + private IsUnmodifiableCollectionMatcher() { + this(IsUnmodifiable.isUnmodifiableJdkCollection(), IsUnmodifiable.isModifiableJdkCollection(), IsUnmodifiable.isUnmodifiableCustomCollection()); + } + + private IsUnmodifiableCollectionMatcher(Matcher> isUnmodifiableJdkCollection, + Matcher> isModifiableJdkCollection, + Matcher> isUnmodifiableCustomCollection) { + this.isUnmodifiableJdkCollection = isUnmodifiableJdkCollection; + this.isModifiableJdkCollection = isModifiableJdkCollection; + this.isUnmodifiableCustomCollection = isUnmodifiableCustomCollection; + } + + @Override + public void describeTo(Description description) { + description.appendText("unmodifiable collection"); + } + + @Override + protected boolean matchesSafely(Collection collection, Description mismatchDescription) { + if (isUnmodifiableJdkCollection.matches(collection)) { + return true; // It's a known unmodifiable collection, so shortcut the remaining tests + } + if (isModifiableJdkCollection.matches(collection)) { + // If it's a known modifiable collection, then fail + mismatchDescription.appendText(collection.getClass().getName() + " is a known modifiable JDK collection"); + return false; + } + if (!isUnmodifiableCustomCollection.matches(collection)) { + // If we are able to modify the collection, then fail + isUnmodifiableCustomCollection.describeMismatch(collection, mismatchDescription); + return false; + } + return true; + } + } + + private static class IsUnmodifiableJdkCollectionMatcher extends TypeSafeDiagnosingMatcher> { + private static final Set KNOWN_UNMODIFIABLE_COLLECTIONS = + Set.of("java.util.ImmutableCollections", + "java.util.Collections$Unmodifiable", + "java.util.Collections$Empty" + ); + + @Override + public void describeTo(Description description) { + description.appendText("unmodifiable JDK collection"); + } + + @Override + protected boolean matchesSafely(Collection collection, Description mismatchDescription) { + @SuppressWarnings("rawtypes") + final Class collectionClass = collection.getClass(); + String collectionClassName = collectionClass.getName(); + for (String knownUnmodifiableCollection : KNOWN_UNMODIFIABLE_COLLECTIONS) { + if (collectionClassName.startsWith(knownUnmodifiableCollection)) { + return true; + } + } + mismatchDescription.appendText(collectionClassName + " is not a known unmodifiable JDK collection"); + return false; + } + } + + private static class IsModifiableJdkCollectionMatcher extends TypeSafeDiagnosingMatcher> { + private static final Set KNOWN_MODIFIABLE_COLLECTIONS = + Set.of("java.util.Arrays$ArrayList", + "java.util.ArrayList", + "java.util.LinkedList", + "java.util.HashSet", + "java.util.LinkedHashSet", + "java.util.TreeSet", + "java.util.PriorityQueue", + "java.util.ArrayDeque" + ); + @Override + public void describeTo(Description description) { + description.appendText("modifiable JDK collection"); + } + + @Override + protected boolean matchesSafely(Collection collection, Description mismatchDescription) { + @SuppressWarnings("rawtypes") + final Class collectionClass = collection.getClass(); + String collectionClassName = collectionClass.getName(); + for (String knownModifiableCollection : KNOWN_MODIFIABLE_COLLECTIONS) { + if (collectionClassName.startsWith(knownModifiableCollection)) { + return true; + } + } + mismatchDescription.appendText(collectionClassName + " is not a known modifiable JDK collection"); + return false; + } + } + + /** + * Exercises a collection, tests all methods to see if they are modifiable. + */ + private interface MethodChecker { + /** + * Tries to modify a collection by calling all the methods. + * + * @return true if collection is unable to be modified. + */ + boolean checkMethods(); + } + + + /** + * + */ + private static class CollectionMethodChecker implements MethodChecker { + protected static final Object TEST_OBJECT = new Object(); + protected static final Set TEST_COLLECTION = Collections.singleton(TEST_OBJECT); + + protected final Collection item; + protected final Description mismatchDescription; + + public CollectionMethodChecker(Collection item, Description mismatchDescription) { + this.item = item; + this.mismatchDescription = mismatchDescription; + } + + @Override + public boolean checkMethods() { + if (checkMethod_add(item, TEST_OBJECT, mismatchDescription)) return false; + if (checkMethod_add_all(item, TEST_COLLECTION, mismatchDescription)) return false; + if (checkMethod_remove(item, TEST_OBJECT, mismatchDescription)) return false; + if (checkMethod_remove_all(item, TEST_COLLECTION, mismatchDescription)) return false; + if (checkMethod_retail_all(item, TEST_COLLECTION, mismatchDescription)) return false; + if (checkMethod_clear(item, mismatchDescription)) return false; + if (checkMethod_iterator(item, mismatchDescription)) return false; + + return true; + } + + private boolean checkMethod_add(Collection item, Object testObject, Description mismatchDescription) { + try { + item.add(testObject); + mismatchDescription.appendText("was able to add a value into the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_add_all(Collection item, Set singletonList, Description mismatchDescription) { + try { + item.addAll(singletonList); + mismatchDescription.appendText("was able to perform addAll on the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_iterator(Collection item, Description mismatchDescription) { + try { + item.iterator().remove(); + mismatchDescription.appendText("was able to remove an element from the iterator"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_clear(Collection item, Description mismatchDescription) { + try { + item.clear(); + mismatchDescription.appendText("was able to clear the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_retail_all(Collection item, Set singletonList, Description mismatchDescription) { + try { + item.retainAll(singletonList); + mismatchDescription.appendText("was able to call retainAll on the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_remove_all(Collection item, Set singletonList, Description mismatchDescription) { + try { + item.removeAll(singletonList); + mismatchDescription.appendText("was able to call removeAll on the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_remove(Collection item, Object testObject, Description mismatchDescription) { + try { + item.remove(testObject); + mismatchDescription.appendText("was able to call remove a value from the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + } + + private static class ListMethodChecker extends CollectionMethodChecker { + protected final List list; + + public ListMethodChecker(Collection item, Description mismatchDescription) { + super(item, mismatchDescription); + if (item instanceof List originalList) { + this.list = originalList; + } else { + throw new IllegalArgumentException("collection provided is not a list."); + } + } + + @Override + public boolean checkMethods() { + // This is an operation on the original collection, but it is safe, since it sets the same element + if (checkMethod_set(list, mismatchDescription)) return false; + + if (checkMethod_listIterator_remove(list, mismatchDescription)) return false; + if (checkMethod_listIterator_set(list, TEST_OBJECT, mismatchDescription)) return false; + if (checkMethod_listIterator_add(list, TEST_OBJECT, mismatchDescription)) return false; + if (checkMethod_listIterator_index(list, mismatchDescription)) return false; + if (checkMethod_add_index(list, TEST_OBJECT, mismatchDescription)) return false; + if (checkMethod_add_all_index(list, TEST_COLLECTION, mismatchDescription)) return false; + if (checkMethod_remove_index(list, mismatchDescription)) return false; + + return super.checkMethods(); + } + + private boolean checkMethod_remove_index(List item, Description mismatchDescription) { + try { + item.remove(0); + mismatchDescription.appendText("was able to call remove by index from the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_add_all_index(List item, Set singletonList, Description mismatchDescription) { + try { + item.addAll(0, singletonList); + mismatchDescription.appendText("was able to perform addAll by index on the collection"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_add_index(List item, Object testObject, Description mismatchDescription) { + try { + item.add(0, testObject); + mismatchDescription.appendText("was able to add a value into the list by index"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_listIterator_remove(List item, Description mismatchDescription) { + try { + item.listIterator().remove(); + mismatchDescription.appendText("was able to remove an element from the list iterator"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_listIterator_set(List item, Object testObject, Description mismatchDescription) { + try { + ListIterator iterator = item.listIterator(); + iterator.next(); + iterator.set(testObject); + mismatchDescription.appendText("was able to set element on the list iterator"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_listIterator_add(List item, Object testObject, Description mismatchDescription) { + try { + ListIterator iterator = item.listIterator(); + iterator.next(); + iterator.add(testObject); + mismatchDescription.appendText("was able to add element on the list iterator"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_listIterator_index(List item, Description mismatchDescription) { + try { + Iterator iterator = item.listIterator(0); + iterator.remove(); + mismatchDescription.appendText("was able to remove an element from the list iterator with index"); + return true; + } catch (Exception ignore) { + } + return false; + } + + private boolean checkMethod_set(List list, Description mismatchDescription) { + if (list.size() > 0) { + try { + list.set(0, list.get(0)); + mismatchDescription.appendText("was able to set an element of the collection"); + return true; + } catch (Exception ignore) { + } + } + return false; + } + } + + private static class IsUnmodifiableCustomCollectionMatcher extends TypeSafeDiagnosingMatcher> { + @SuppressWarnings("rawtypes") + private static final Map, Object> DEFAULT_COLLECTIONS = new HashMap<>(); + static { + final List list = Arrays.asList("a", "b", "c"); + DEFAULT_COLLECTIONS.put(Collection.class, list); + DEFAULT_COLLECTIONS.put(List.class, list); + DEFAULT_COLLECTIONS.put(Set.class, new HashSet<>(list)); + } + + + @Override + protected boolean matchesSafely(final Collection collection, final Description mismatchDescription) { + @SuppressWarnings("rawtypes") + final Class collectionClass = collection.getClass(); + final Collection item = getInstanceOfType(collectionClass, collection); + if (item == null) { + throw failedToInstantiateItem(collectionClass, null); + } + + MethodChecker methodChecker = item instanceof List ? new ListMethodChecker(item, mismatchDescription) : new CollectionMethodChecker(item, mismatchDescription); + + return methodChecker.checkMethods(); + } + + + + @SuppressWarnings("unchecked") + private T getInstanceOfType(final Class clazz, @SuppressWarnings("rawtypes") Collection collection) { + if (clazz.isArray()) { + return (T) Array.newInstance(clazz, 0); + } + + if (clazz.isPrimitive()) { + if (Byte.TYPE.isAssignableFrom(clazz)) { + return (T) Byte.valueOf((byte) 1); + } + if (Short.TYPE.isAssignableFrom(clazz)) { + return (T) Short.valueOf((short) 1); + } + if (Integer.TYPE.isAssignableFrom(clazz)) { + return (T) Integer.valueOf(1); + } + if (Long.TYPE.isAssignableFrom(clazz)) { + return (T) Long.valueOf(1L); + } + if (Float.TYPE.isAssignableFrom(clazz)) { + return (T) Float.valueOf(1L); + } + if (Double.TYPE.isAssignableFrom(clazz)) { + return (T) Double.valueOf(1L); + } + if (Boolean.TYPE.isAssignableFrom(clazz)) { + return (T) Boolean.valueOf(true); + } + if (Character.TYPE.isAssignableFrom(clazz)) { + return (T) Character.valueOf(' '); + } + } + + if (clazz.isInterface()) { + Object defaultCollection = DEFAULT_COLLECTIONS.get(clazz); + if (defaultCollection != null) { + return (T) defaultCollection; + } + return null; + } + + // For the most part of implementations there probably won't be any default constructor + final Constructor[] declaredConstructors = clazz.getDeclaredConstructors(); + + Constructor constructorForCollection = findConstructorForCollection(declaredConstructors); + + Exception lastException = null; + if (constructorForCollection != null) { + try { + return (T) constructorForCollection.newInstance(collection); + } catch (Exception e) { + lastException = e; + } + } + + // First take constructor with fewer number of arguments + Arrays.sort(declaredConstructors, new Comparator>() { + @Override + public int compare(Constructor o1, Constructor o2) { + return Integer.compare(o2.getParameterTypes().length, o1.getParameterTypes().length); + } + }); + + for (Constructor declaredConstructor : declaredConstructors) { + try { + declaredConstructor.setAccessible(true); + } catch (Exception ignore) { + // Since Java 17 it is impossible to make jdk* classes accessible without manipulation with modules: + // module java.base does not "opens java.util" to unnamed module + } + final int parametersNumber = declaredConstructor.getParameterTypes().length; + + Object[] arguments = new Object[parametersNumber]; + for (int argumentIndex = 0; argumentIndex < arguments.length; argumentIndex++) { + arguments[argumentIndex] = getInstanceOfType(declaredConstructor.getParameterTypes()[argumentIndex], collection); + } + try { + return (T) declaredConstructor.newInstance(arguments); + } catch (Exception e) { + lastException = e; + } + + } + throw failedToInstantiateItem(clazz, lastException); + } + + private Constructor findConstructorForCollection(Constructor[] declaredConstructors) { + for (Constructor constructor : declaredConstructors) { + if (constructor.getParameterTypes().length == 1 && constructor.getParameterTypes()[0].isAssignableFrom(Collection.class)) { + return constructor; + } + } + return null; + } + + private IllegalStateException failedToInstantiateItem(Class clazz, Exception e) { + return new IllegalStateException("Failed to create an instance of <" + clazz + "> class.", e); + } + + @Override + public void describeTo(Description description) { + description.appendText("unmodifiable collection"); + } + } +} diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java index 112bb02d..3a4e4bfb 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java @@ -51,6 +51,7 @@ public void describeTo(Description description) { * the matcher to apply to items provided by the examined {@link Iterable} * @return The matcher. */ + @Deprecated public static Matcher> hasItem(Matcher itemMatcher) { return IsIterableContaining.hasItem(itemMatcher); } @@ -70,6 +71,7 @@ public static Matcher> hasItem(Matcher item * the item to compare against the items provided by the examined {@link Iterable} * @return The matcher. */ + @Deprecated public static Matcher> hasItem(T item) { // Doesn't forward to hasItem() method so compiler can sort out generics. return IsIterableContaining.hasItem(item); @@ -90,6 +92,7 @@ public static Matcher> hasItem(T item) { * the matchers to apply to items provided by the examined {@link Iterable} * @return The matcher. */ + @Deprecated @SafeVarargs public static Matcher> hasItems(Matcher... itemMatchers) { return IsIterableContaining.hasItems(itemMatchers); @@ -110,6 +113,7 @@ public static Matcher> hasItems(Matcher... * the items to compare against the items provided by the examined {@link Iterable} * @return The matcher. */ + @Deprecated @SafeVarargs public static Matcher> hasItems(T... items) { return IsIterableContaining.hasItems(items); diff --git a/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java b/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java index cd4d354a..4ea43e02 100644 --- a/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java +++ b/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; import static org.hamcrest.core.IsEqual.equalTo; @@ -180,4 +181,45 @@ public void describeTo(Description description) { }; } + /** + * Matcher for matching file content with given file + * @param expected The file has expected content + * @return A FeatureMatcher that takes the content of a file as feature + */ + public static Matcher matchesContentOf(File expected) { + String expectedContent = ""; + try { + expectedContent = new String(Files.readAllBytes(expected.toPath())); + } catch (IOException e) { + e.printStackTrace(); + } + return new FeatureMatcher(equalTo(expectedContent), "A file with content", "content") { + @Override protected String featureValueOf(File actual) { + try { + return new String(Files.readAllBytes(actual.toPath())); + } catch (IOException e) { + e.printStackTrace(); + return "Exception: " + e.getMessage(); + } + } + }; + } + + /** + * Matcher for matching file content with given String Matcher + * @param expected The expected content Matcher + * @return A FeatureMatcher that takes the content of a file as feature + */ + public static Matcher aFileWithContent(Matcher expected) { + return new FeatureMatcher(expected, "A file with content", "content") { + @Override protected String featureValueOf(File actual) { + try { + return new String(Files.readAllBytes(actual.toPath())); + } catch (IOException e) { + e.printStackTrace(); + return "Exception: " + e.getMessage(); + } + } + }; + } } diff --git a/hamcrest/src/main/java/org/hamcrest/io/PathMatchers.java b/hamcrest/src/main/java/org/hamcrest/io/PathMatchers.java new file mode 100644 index 00000000..16944c76 --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/io/PathMatchers.java @@ -0,0 +1,303 @@ +package org.hamcrest.io; + +import org.hamcrest.FeatureMatcher; +import org.hamcrest.Matcher; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.FileSystem; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import static org.hamcrest.TypeSafeDiagnosingMatcher.matcher; +import static org.hamcrest.core.IsEqual.equalTo; + +/** + * Matchers for properties of files. + */ +public final class PathMatchers { + + private PathMatchers() { + } + + /** + * A matcher that checks if a directory exists. + * @return the file matcher + */ + public static Matcher anExistingDirectory() { + return matcher(Files::isDirectory, "an existing directory", "is not a directory", Path.class); + } + + /** + * A matcher that checks if a file or directory exists. + * @return the file matcher + */ + public static Matcher anExistingFileOrDirectory() { + return matcher(Files::exists, "an existing file or directory", "does not exist", Path.class); + } + + /** + * A matcher that checks if a file exists. + * @return the file matcher + */ + public static Matcher anExistingFile() { + return matcher(Files::isRegularFile, "an existing file", "is not a file", Path.class); + } + + /** + * A matcher that checks if a file or directory is readable. + * @return the file matcher + */ + public static Matcher isReadable() { + return matcher(Files::isReadable, "a readable file or directory", "cannot be read", Path.class); + } + + /** + * A matcher that checks if a file/directory is writable. + * @return the file matcher + */ + public static Matcher isWritable() { + return matcher(Files::isWritable, "a writable file or directory", "cannot be written to", Path.class); + } + + /** + * A matcher that checks if a file/directory is executable. + * @return the file matcher + */ + public static Matcher isExecutable() { + return matcher(Files::isExecutable, "an executable file or directory", "is not executable", Path.class); + } + + /** + * A matcher that checks if a file/directory is the same file. + * @return the file matcher + */ + public static Matcher isSameFile(Path target) { + return matcher(toUncheckedEx(p->Files.isSameFile(target, p)), "the same file or directory", "is not the same file or directory", Path.class); + } + + /** + * A matcher that checks if a file/directory is a symbolic link. + * @return the file matcher + */ + public static Matcher isSymbolicLink() { + return matcher(Files::isSymbolicLink, "a file or directory is a symbolic link", "is not a symbolic link", Path.class); + } + + /** + * A matcher that checks if a file/directory is hidden. + * @return the file matcher + */ + public static Matcher isHidden() { + return matcher(toUncheckedEx(p->PathMatchers.isHidden(p)), "a hidden file or directory", "is not hidden", Path.class); + } + + /** + * A matcher that checks if a file has a specific size. + * @param size the expected size + * @return the file matcher + */ + public static Matcher hasSizeEqualTo(long size) { + return hasSize(equalTo(size)); + } + + /** + * A matcher that checks if a file size matches an expected size. + * @param expected matcher for the expected size + * @return the file matcher + */ + public static Matcher hasSize(final Matcher expected) { + return FeatureMatcher.matcher(expected, p -> toUncheckedEx(() -> Files.size(p)), "A file with size", "size", Path.class); +// return new FeatureMatcher(expected, "A file with size", "size") { +// @Override protected Long featureValueOf(Path actual) { return toUncheckedEx(()->Files.size(actual)); } +// }; + } + + /** + * A matcher that checks if a file name matches an expected name. + * @param expected the expected name + * @return the file matcher + */ + public static Matcher hasFileName(final Matcher expected) { + return new FeatureMatcher(expected, "A file with name", "name") { + @Override protected Path featureValueOf(Path actual) { return actual.getFileName(); } + }; + } + + /** + * A matcher that checks if a file name matches an expected String. + * @param expected the expected name + * @return the file matcher + */ + public static Matcher hasFileNameString(final Matcher expected) { + return new FeatureMatcher(expected, "A file with name", "name") { + @Override protected String featureValueOf(Path actual) { return actual.getFileName().toString(); } + }; + } + + /** + * A matcher that checks if a file real path matches an expected path. + * @param expected the expected path + * @return the file matcher + */ + public static Matcher hasRealPath(final Matcher expected) { + return new FeatureMatcher(expected, "A file with real path", "path") { + @Override protected Path featureValueOf(Path actual) { return toUncheckedEx(()->actual.toRealPath()); } + }; + } + + /** + * A matcher that checks if a file real path matches an expected String. + * @param expected the expected path + * @return the file matcher + */ + public static Matcher hasRealPathString(final Matcher expected) { + return new FeatureMatcher(expected, "A file with real path", "path") { + @Override protected String featureValueOf(Path actual) { return toUncheckedEx(()->actual.toRealPath().toString()); } + }; + } + + /** + * A matcher that checks if a file canonical path matches an expected path. + * + * @deprecated Use {@link #hasRealPath(Matcher)} instead. Provided for backward compatibility with FileMatchers. + * + * @param expected the expected path + * @return the file matcher + */ + @Deprecated + public static Matcher hasCanonicalPathString(final Matcher expected) { + return hasRealPathString(expected); // + } + + /** + * A matcher that checks if a file absolute path matches an expected path. + * + * @param expected the expected path + * @return the file matcher + */ + public static Matcher hasAbsolutePath(final Matcher expected) { + return new FeatureMatcher(expected, "A file with absolute path", "path") { + @Override protected Path featureValueOf(Path actual) { return actual.toAbsolutePath(); } + }; + } + + /** + * A matcher that checks if a file absolute path matches an expected String. + * + * @param expected the expected path String + * @return the file matcher + */ + public static Matcher hasAbsolutePathString(final Matcher expected) { + return new FeatureMatcher(expected, "A file with absolute path", "path") { + @Override protected String featureValueOf(Path actual) { return actual.toAbsolutePath().toString(); } + }; + } + + /** + * A matcher that checks if a file's FileSystem matches an expected FileSystem. + * + * @param expected + * @return + */ + public static Matcher hasFileSystem(final Matcher expected) { + return new FeatureMatcher(expected, "A file with file system", "file system") { + @Override protected java.nio.file.FileSystem featureValueOf(Path actual) { return actual.getFileSystem(); } + }; + } + + /** + * Matcher for matching file content with given file path. + * + *

      + * Note: line endings in the file are preserved in their platform dependent form, + * so both files must contain the same line endings to match. + *

      + * + * @param expected The file with the expected content + * @return A FeatureMatcher that takes the content of a file path as feature + */ + public static Matcher matchesContentOf(Path expected) { + String expectedContent = toUncheckedEx(()->Files.readString(expected)); + return new FeatureMatcher(equalTo(expectedContent), "A file with content", "content") { + @Override protected String featureValueOf(Path actual) { return toUncheckedEx(()->Files.readString(actual));} + }; + } + + /** + * Matcher for matching file content with given String Matcher. + * + *

      + * Note: line endings in the file are converted to '\n' to avoid platform dependent test results + *

      + * + * @param expected The expected content Matcher + * @return A FeatureMatcher that takes the content of a file as feature + */ + public static Matcher hasContent(Matcher expected) { + return new FeatureMatcher(expected, "A file with content", "content") { + @Override protected String featureValueOf(Path actual) { + // use collector to avoid platform dependent line endings + return toUncheckedEx(()->Files.lines(actual).collect(Collectors.joining("\n"))); + } + }; + } + + // Possible additions: + // - hasParent(Matcher) + // - hasRoot(Matcher) + // - hasAttributes(Matcher>...) + // - hasLastModifiedTime(Matcher) + // - hasOwner(Matcher) + // - hasPosixPermissions(Matcher>) + + // - hasCreationTime(Matcher) + // - hasGroup(Matcher) + // - hasFileKey(Matcher) + // - hasFileAttribute(String, Matcher) + // - hasProvider(Matcher) + + // - containsStrings(String...) + + // Workaround for JDK 8 not supporting Files.isHidden(Path) for directories + // (JDK-8215467). Fixed in Java 13. + private static boolean isHidden(Path path) throws IOException { + if (path.getFileSystem().provider().getClass().getName().contains("WindowsFileSystemProvider")) { + // WindowsFileSystemProvider does not support isHidden(Path) for directories + return Files.readAttributes(path, "dos:hidden", java.nio.file.LinkOption.NOFOLLOW_LINKS).get("hidden") + .equals(Boolean.TRUE); + } else { + return Files.isHidden(path); + } + } + + @FunctionalInterface + private interface Predicate_WithExceptions { + boolean test(T t) throws E; + } + + private static Predicate toUncheckedEx(Predicate_WithExceptions predicate) { + return value -> { + try { + return predicate.test(value); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }; + } + + @FunctionalInterface + private interface Supplier_WithExceptions { + T get() throws E; + } + + private static T toUncheckedEx(Supplier_WithExceptions supplier) { + try { + return supplier.get(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } +} diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java index 4a4c4c67..c72ff9b3 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java @@ -65,6 +65,7 @@ public String stripSpaces(String toBeStripped) { * the expected value of matched strings * @return The matcher. */ + @Deprecated public static Matcher equalToIgnoringWhiteSpace(String expectedString) { return new IsEqualCompressingWhiteSpace(expectedString); } diff --git a/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java index 82e89aa2..e65ee02e 100644 --- a/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java @@ -9,6 +9,8 @@ public final class FeatureMatcherTest { private final FeatureMatcher resultMatcher = resultMatcher(); + private final Matcher resultMatcherStaticCtr = + FeatureMatcher.matcher(new Match("bar"), t->t.getResult(), "Thingy with result", "result", Thingy.class); @Test public void matchesPartOfAnObject() { @@ -16,16 +18,32 @@ public final class FeatureMatcherTest { assertDescription("Thingy with result \"bar\"", resultMatcher); } + @Test public void + matchesPartOfAnObject_staticConstructor() { + assertMatches("feature", resultMatcherStaticCtr, new Thingy("bar")); + assertDescription("Thingy with result \"bar\"", resultMatcherStaticCtr); + } + @Test public void mismatchesPartOfAnObject() { assertMismatchDescription("result mismatch-description", resultMatcher, new Thingy("foo")); } + @Test public void + mismatchesPartOfAnObject_staticConstructor() { + assertMismatchDescription("result mismatch-description", resultMatcherStaticCtr, new Thingy("foo")); + } + @Test public void doesNotThrowNullPointerException() { assertMismatchDescription("was null", resultMatcher, null); } + @Test public void + doesNotThrowNullPointerException_staticConstructor() { + assertMismatchDescription("was null", resultMatcherStaticCtr, null); + } + @Test public void doesNotThrowClassCastException() { resultMatcher.matches(new ShouldNotMatch()); @@ -34,6 +52,14 @@ public final class FeatureMatcherTest { assertEquals("was ShouldNotMatch ", mismatchDescription.toString()); } + @Test public void + doesNotThrowClassCastException_staticConstructor() { + resultMatcherStaticCtr.matches(new ShouldNotMatch()); + StringDescription mismatchDescription = new StringDescription(); + resultMatcherStaticCtr.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) { diff --git a/hamcrest/src/test/java/org/hamcrest/TypeSafeDiagnosingMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/TypeSafeDiagnosingMatcherTest.java index 61062074..bc8d4b25 100644 --- a/hamcrest/src/test/java/org/hamcrest/TypeSafeDiagnosingMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/TypeSafeDiagnosingMatcherTest.java @@ -17,6 +17,15 @@ public class TypeSafeDiagnosingMatcherTest { assertMismatchDescription("mismatching", STRING_MATCHER, "other"); } + @Test public void + describesMismatches_staticConstructor() { + Matcher stringMatcher = + TypeSafeDiagnosingMatcher.matcher(item->false,"matches","mismatching",String.class); + 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() { @@ -32,13 +41,30 @@ protected boolean matchesSafely(NotBuiltIn item, Description mismatchDescription assertDoesNotMatch("other not built in", (Matcher)matcher, new OtherNotBuiltIn()); } + @Test public void + detects_non_builtin_types_static_constructor() { + final Matcher matcher = + TypeSafeDiagnosingMatcher.matcher(item->true,"a builtin","a not builtin",NotBuiltIn.class); + + 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 + filters_type_for_subclassed_matcher_when_expected_type_passed_in_staticConstructor() { + final Matcher matcher = SubMatcher.matcher(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() { @@ -59,15 +85,28 @@ protected boolean matchesSafely(String item, Description mismatchDescription) { 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 SubMatcher() { + } + + 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"); + } + + static Matcher matcher(T expectedObject) { + return new SubMatcher(expectedObject) {}; + } } public static class NotBuiltIn { diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java index a7dcc00d..ca538cde 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java @@ -1,6 +1,8 @@ package org.hamcrest.beans; -import org.hamcrest.*; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.StringDescription; import org.hamcrest.core.IsEqual; import org.hamcrest.test.AbstractMatcherTest; import org.junit.jupiter.api.Test; @@ -11,12 +13,12 @@ import java.util.Objects; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.test.MatcherAssertions.*; 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; +import static org.hamcrest.test.MatcherAssertions.*; import static org.junit.jupiter.api.Assertions.assertEquals; /** @@ -75,9 +77,9 @@ public void testMatchesRecordLikeBeanWithoutInfoWithMatchedNamedBooleanProperty( @Test public void testMatchesBeanWithInfoWithMatchedNamedProperty() { - assertMatches("with bean info", hasProperty("property", equalTo("with info")), beanWithInfo); + assertMatches(hasProperty("property", equalTo("with info")), beanWithInfo); assertMismatchDescription("property 'property' was \"with info\"", - hasProperty("property", equalTo("without info")), beanWithInfo); + hasProperty("property", equalTo("different")), beanWithInfo); } @Test @@ -253,7 +255,10 @@ public static class BeanWithInfo { public String property() { return propertyValue; } } - public static class BeanWithInfoBeanInfo extends SimpleBeanInfo { // TODO: No usage. Can be removed. + /** + * Used by bean introspector + */ + public static class BeanWithInfoBeanInfo extends SimpleBeanInfo { @Override public PropertyDescriptor[] getPropertyDescriptors() { try { diff --git a/hamcrest/src/test/java/org/hamcrest/beans/PropertyUtilTest.java b/hamcrest/src/test/java/org/hamcrest/beans/PropertyAccessorTest.java similarity index 59% rename from hamcrest/src/test/java/org/hamcrest/beans/PropertyUtilTest.java rename to hamcrest/src/test/java/org/hamcrest/beans/PropertyAccessorTest.java index bc9ba6a0..cfed2185 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/PropertyUtilTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/PropertyAccessorTest.java @@ -2,71 +2,54 @@ import org.junit.jupiter.api.Test; -import java.beans.MethodDescriptor; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; -import java.util.stream.Collectors; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.hasItem; -class PropertyUtilTest { +class PropertyAccessorTest { @Test - void testReturnsTheNamesOfAllFieldsFromTargetClass() { + void testAccessesAllFieldsFromBean() { SamePropertyValuesAsTest.ExampleBean input = new SamePropertyValuesAsTest.ExampleBean("test", 1, null); + PropertyAccessor accessor = new PropertyAccessor(input); - Set output = PropertyUtil.getFieldNames(input); + Set fields = accessor.fieldNames(); - assertThat(output, hasSize(3)); - assertThat(output, hasItems("stringProperty", "intProperty", "valueProperty")); - assertThat(output, not(hasItem("nonexistentField"))); - } - - @Test - void testReturnsTheNamesOfAllFieldsFromTargetRecord() { - RecordLikeClass.SmallClass smallClass1 = new RecordLikeClass.SmallClass(); - RecordLikeClass.SmallClass smallClass2 = new RecordLikeClass.SmallClass("small", 3, BigDecimal.ONE, LocalDateTime.of(2024, 1, 2, 3, 4, 5)); - RecordLikeClass input = new RecordLikeClass("uno", 22, true, new Long[] {1L, 2L, 3L}, new ArrayList<>(Arrays.asList(smallClass1, smallClass2))); - - Set output = PropertyUtil.getFieldNames(input); - - assertThat(output, hasSize(5)); - assertThat(output, hasItems("numberArray", "test", "smallClasses", "name", "age")); - assertThat(output, not(hasItem("notAGetter1"))); - assertThat(output, not(hasItem("notAGetter2"))); - assertThat(output, not(hasItem("getAge"))); - assertThat(output, not(hasItem("field1"))); - assertThat(output, not(hasItem("nonexistentField"))); - } - - @Test - void testReturnsArrayOfMethodDescriptorFromTargetClass() { - SamePropertyValuesAsTest.ExampleBean input = new SamePropertyValuesAsTest.ExampleBean("test", 1, null); + assertThat(fields, hasSize(3)); + assertThat(fields, hasItems("stringProperty", "intProperty", "valueProperty")); + assertThat(fields, not(hasItem("nonexistentField"))); - MethodDescriptor[] output = PropertyUtil.recordReadAccessorMethodDescriptorsFor(input, Object.class); - - assertThat(output, arrayWithSize(0)); + assertThat(accessor.fieldValue("stringProperty"), equalTo("test")); + assertThat(accessor.fieldValue("intProperty"), equalTo(1)); + assertThat(accessor.fieldValue("valueProperty"), equalTo(null)); } @Test - void testReturnsArrayOfMethodDescriptorFromTargetRecord() { + void testReturnsTheNamesOfAllFieldsFromRecordLikeObject() { RecordLikeClass.SmallClass smallClass1 = new RecordLikeClass.SmallClass(); RecordLikeClass.SmallClass smallClass2 = new RecordLikeClass.SmallClass("small", 3, BigDecimal.ONE, LocalDateTime.of(2024, 1, 2, 3, 4, 5)); - RecordLikeClass input = new RecordLikeClass("uno", 22, true, new Long[] {1L, 2L, 3L}, new ArrayList<>(Arrays.asList(smallClass1, smallClass2))); + RecordLikeClass input = new RecordLikeClass("uno", 22, true, new Long[] {1L, 2L, 3L}, Arrays.asList(smallClass1, smallClass2)); + PropertyAccessor accessor = new PropertyAccessor(input); - MethodDescriptor[] output = PropertyUtil.recordReadAccessorMethodDescriptorsFor(input, Object.class); + Set fields = accessor.fieldNames(); - assertThat(output, arrayWithSize(5)); - assertThat(Arrays.stream(output).map(MethodDescriptor::getDisplayName).collect(Collectors.toList()), - hasItems("numberArray", "test", "smallClasses", "name", "age")); - } + assertThat(fields, hasSize(5)); + assertThat(fields, hasItems("numberArray", "test", "smallClasses", "name", "age")); + assertThat(fields, not(hasItem("notAGetter1"))); + assertThat(fields, not(hasItem("notAGetter2"))); + assertThat(fields, not(hasItem("field1"))); + assertThat(fields, not(hasItem("nonexistentField"))); + assertThat(accessor.fieldValue("name"), equalTo("uno")); + } /** * A Java Record-like class to test the functionality of - * {@link PropertyUtil} with Java Records in JDK 8 environment. + * {@link PropertyAccessor} with Java Records in JDK 8 environment. * * @see https://docs.oracle.com/en/java/javase/17/language/records.html */ @@ -76,9 +59,9 @@ static final class RecordLikeClass { private final int age; private final boolean test; private final Long[] numberArray; - private final List smallClasses; + private final List smallClasses; - public RecordLikeClass(String name, int age, boolean test, Long[] numberArray, List smallClasses) { + public RecordLikeClass(String name, int age, boolean test, Long[] numberArray, List smallClasses) { this.name = name; this.age = age; this.test = test; @@ -90,13 +73,12 @@ public RecordLikeClass(String name, int age, boolean test, Long[] numberArray, L public int age() { return age; } public boolean test() { return test; } public Long[] numberArray() { return numberArray; } - public List smallClasses() { return smallClasses; } + public List smallClasses() { return smallClasses; } public void notAGetter1() {} public String notAGetter2() { return "I'm nothing"; } public String name(String fake1, String fake2) { return name; } public void name(String fake1) {} - public int getAge() { return 0; } @Override public boolean equals(Object o) { @@ -147,4 +129,4 @@ public String toString() { } } -} +} \ No newline at end of file diff --git a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java index bd5f1796..7df26392 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java @@ -107,14 +107,14 @@ public void testDescribesItself() { "same property values as ExampleBean [intProperty: <1>, stringProperty: \"same\", valueProperty: ]", samePropertyValuesAs(expectedBean)); assertDescription( - "same property values as ExampleRecord [valueProperty: , stringProperty: \"same\", intProperty: <1>]", + "same property values as ExampleRecord [intProperty: <1>, stringProperty: \"same\", valueProperty: ]", samePropertyValuesAs(expectedRecord)); assertDescription( "same property values as ExampleBean [intProperty: <1>, stringProperty: \"same\", valueProperty: ] ignoring [\"ignored1\", \"ignored2\"]", samePropertyValuesAs(expectedBean, "ignored1", "ignored2")); assertDescription( - "same property values as ExampleRecord [valueProperty: , stringProperty: \"same\", intProperty: <1>] ignoring [\"ignored1\", \"ignored2\"]", + "same property values as ExampleRecord [intProperty: <1>, stringProperty: \"same\", valueProperty: ] ignoring [\"ignored1\", \"ignored2\"]", samePropertyValuesAs(expectedRecord, "ignored1", "ignored2")); } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java index 057b3b4d..4a2f3133 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java @@ -6,12 +6,16 @@ import org.junit.jupiter.api.Test; import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; import static java.util.Arrays.asList; import static org.hamcrest.test.MatcherAssertions.*; import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; import static org.hamcrest.collection.IsIterableContainingInOrderTest.make; import static org.hamcrest.collection.IsIterableContainingInOrderTest.value; +import static org.hamcrest.collection.IsIterableContainingInAnyOrderTest.Item.item; public class IsIterableContainingInAnyOrderTest extends AbstractMatcherTest { @@ -62,4 +66,98 @@ public void testHasAReadableDescription() { assertDescription("iterable with items [<1>, <2>] in any order", containsInAnyOrder(1, 2)); } + private static final ItemValueComparator comparator = new ItemValueComparator(); + + private static class ItemValueComparator implements Comparator { + @Override + public int compare(Item o1, Item o2) { + return Integer.compare(o1.value, o2.value); + } + + @Override + public String toString() { + return ItemValueComparator.class.getSimpleName(); + } + } + + public static class Item { + private final String key; + private final int value; + + private Item(String key, int value) { + this.key = key; + this.value = value; + } + + public static Item item(String key, int value) { + return new Item(key, value); + } + + public int getValue() { + return value; + } + + @Override + public String toString() { + return key + ":" + value; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Item item = (Item) o; + return Objects.equals(key, item.key); + } + + @Override + public int hashCode() { + return Objects.hash(key); + } + } + + public void testMatchesSingleItemIterableWithComparator() { + assertMatches("single item", containsInAnyOrder(comparator, item("key", 1)), Collections.singletonList(item("foo", 1))); + } + + public void testDoesNotMatchEmptyWithComparator() { + List actual = Collections.emptyList(); + Matcher> expected = containsInAnyOrder(comparator, item("key", 5), item("key", 10)); + assertMismatchDescription("no item matches: a value equal to when compared by , a value equal to when compared by in []", expected, actual); + } + + public void testMatchesIterableOutOfOrderWithComparator() { + List actual = asList(item("foo", 2), item("bar", 1)); + Matcher> expected = containsInAnyOrder(comparator, item("key", 1), item("key", 2)); + assertMatches("Out of order", expected, actual); + } + + public void testMatchesIterableInOrderWithComparator() { + List actual = asList(item("foo", 1), item("bar", 2)); + Matcher> expected = containsInAnyOrder(comparator, item("key", 1), item("key", 2)); + assertMatches("In order", expected, actual); + } + + public void testDoesNotMatchIfOneOfMultipleElementsMismatchesWithComparator() { + List actual = asList(item("foo", 1), item("bar", 2), item("baz", 4)); + Matcher> expected = containsInAnyOrder(comparator, item("key", 1), item("key", 2), item("key", 3)); + assertMismatchDescription("not matched: ", expected, actual); + } + + public void testDoesNotMatchIfThereAreMoreElementsThanMatchersWithComparator() { + List actual = asList(item("foo", 1), item("bar", 2), item("baz", 3)); + final Matcher> expected = containsInAnyOrder(comparator, item("key", 1), item("key", 3)); + assertMismatchDescription("not matched: ", expected, actual); + } + + public void testDoesNotMatchIfThereAreMoreMatchersThanElementsWithComparator() { + List actual = asList(item("foo", 1), item("bar", 2)); + Matcher> expected = containsInAnyOrder(comparator, item("key", 1), item("key", 2), item("key", 3)); + assertMismatchDescription("no item matches: a value equal to when compared by in [, ]", expected, actual); + } + + public void testHasAReadableDescriptionWithComparator() { + assertDescription("iterable with items [a value equal to when compared by , a value equal to when compared by ] in any order", + containsInAnyOrder(comparator, item("foo", 1), item("bar", 2))); + } } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingParallelRunsTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingParallelRunsTest.java new file mode 100644 index 00000000..3cb7882b --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingParallelRunsTest.java @@ -0,0 +1,170 @@ +package org.hamcrest.collection; + +import static java.util.Arrays.asList; +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; +import static org.hamcrest.collection.IsIterableContainingParallelRuns.containsParallelRunsOf; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.test.MatcherAssertions.*; + +import java.util.List; +import org.hamcrest.test.AbstractMatcherTest; +import org.hamcrest.FeatureMatcher; +import org.hamcrest.Matcher; + +public class IsIterableContainingParallelRunsTest extends AbstractMatcherTest { + + @Override + protected Matcher createMatcher() { + return containsParallelRunsOf(1, 1, 2); + } + + // + // ---- SINGLE RUN TESTS ---- (same tests cases as IsIterableContainingInRelativeOrderTest) ---- + // + + public void testMatchingSingleItemIterable() { + assertMatches("Single item iterable", + containsParallelRunsOf(1, 1), singletonList(1)); + } + + public void testMatchingMultipleItemIterable() { + assertMatches("Multiple item iterable", + containsParallelRunsOf(1, 1, 2, 3), asList(1, 2, 3)); + } + + public void testMatchesWithMoreElementsThanExpectedAtBeginning() { + assertMatches("More elements at beginning", + containsParallelRunsOf(1, 2, 3, 4), asList(1, 2, 3, 4)); + } + + public void testMatchesWithMoreElementsThanExpectedAtEnd() { + assertMatches("More elements at end", + containsParallelRunsOf(1, 1, 2, 3), asList(1, 2, 3, 4)); + } + + public void testMatchesWithMoreElementsThanExpectedInBetween() { + assertMatches("More elements in between", + containsParallelRunsOf(1, 1, 3), asList(1, 2, 3)); + } + + public void testMatchesSubSection() { + assertMatches("Sub section of iterable", + containsParallelRunsOf(1, 2, 3), asList(1, 2, 3, 4)); + } + + public void testMatchesWithSingleGapAndNotFirstOrLast() { + assertMatches("Sub section with single gaps without a first or last match", + containsParallelRunsOf(1, 2, 4), asList(1, 2, 3, 4, 5)); + } + + public void testMatchingSubSectionWithManyGaps() { + assertMatches("Sub section with many gaps iterable", + containsParallelRunsOf(1, 2, 4, 6), asList(1, 2, 3, 4, 5, 6, 7)); + } + + public void testDoesNotMatchWithFewerElementsThanExpected() { + List valueList = asList(make(1), make(2)); + assertMismatchDescription("value with <3> was not found after ", + containsParallelRunsOf(1, value(1), value(2), value(3)), valueList); + } + + public void testDoesNotMatchIfSingleItemNotFound() { + assertMismatchDescription("value with <4> was not found", + containsParallelRunsOf(1, value(4)), singletonList(make(3))); + } + + public void testDoesNotMatchIfOneOfMultipleItemsNotFound() { + assertMismatchDescription("value with <3> was not found after ", + containsParallelRunsOf(1, value(1), value(2), value(3)), + asList(make(1), make(2), make(4))); + } + + public void testDoesNotMatchEmptyIterable() { + assertMismatchDescription("value with <4> was not found", + containsParallelRunsOf(1, value(4)), emptyList()); + } + + public void testHasAReadableDescription() { + assertDescription( + "iterable containing [<1>, <2>] in relative order", + containsParallelRunsOf(1, 1, 2)); + } + + // + // ---- MULTIPLE PARALLEL RUN TESTS ------------------------------------------------------------ + // + + public void testMultiMatchesWithoutUnexpectedElements() { + assertMatches("Multiple runs without unexpected elements", + containsParallelRunsOf(2, 1, 2, 3), asList(1, 1, 2, 3, 2, 3)); + } + + public void testMultiMatchesWithRepeatedElements() { + assertMatches("Multiple runs with repeated elements", + containsParallelRunsOf(2, 1, 2, 1), asList(1, 2, 1, 1, 2, 1)); + } + + public void testMultiMatchesWithGaps() { + assertMatches("Multiple runs with gaps", + containsParallelRunsOf(4, 1), asList(2, 1, 2, 1, 1, 2, 1, 2)); + } + + public void testMultiDoesNotMatchIfSingleItemNotFound() { + assertMismatchDescription("value with <2> was not found after in run <2>", + containsParallelRunsOf(2, value(1), value(2)), + asList(make(1), make(2), make(1))); + } + + public void testMultiDoesNotMatchIfSingleItemNotFoundAtStart() { + assertMismatchDescription("value with <1> was not found in run <2>", + containsParallelRunsOf(2, value(1), value(2)), + asList(make(1), make(2))); + } + + public void testMultiDoesNotMatchAndReportsAllMismatchedRuns() { + assertMismatchDescription("<3> was not found after <2> in run <1>; and " + + "<2> was not found after <1> in run <2>; and " + + "<1> was not found in run <3>", + containsParallelRunsOf(3, 1, 2, 3), + asList(1, 1, 2)); + } + + public void testMultiDoesNotMatchEmptyIterable() { + assertMismatchDescription("value with <4> was not found in run <1>; and " + + "value with <4> was not found in run <2>", + containsParallelRunsOf(2, value(4)), emptyList()); + } + + public void testMultiHasAReadableDescription() { + assertDescription( + "iterable containing <2> parallel runs of [<1>, <2>] in relative order", + containsParallelRunsOf(2, 1, 2)); + assertDescription( + "iterable containing <901> parallel runs of [<1>, <2>] in relative order", + containsParallelRunsOf(901, 1, 2)); + } + + // ---- TEST UTILITIES ------------------------------------------------------------------------- + + 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/src/test/java/org/hamcrest/collection/IsUnmodifiableTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsUnmodifiableTest.java new file mode 100644 index 00000000..a7a0db60 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsUnmodifiableTest.java @@ -0,0 +1,383 @@ +package org.hamcrest.collection; + +import static org.hamcrest.test.MatcherAssertions.*; + +import static org.hamcrest.collection.IsUnmodifiable.*; + +import org.hamcrest.test.AbstractMatcherTest; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.FieldSource; +import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; + +import java.util.*; +import java.util.stream.Stream; + + +public class IsUnmodifiableTest extends AbstractMatcherTest { + + private static final String SET_INT_INDEX_E_ELEMENT = "set(int index, E element)"; + private static final String ADD_E_E = "add(E e)"; + private static final String ADD_INT_INDEX_E_ELEMENT = "add(int index, E element)"; + private static final String REMOVE_INT_INDEX = "remove(int index)"; + private static final String REMOVE_OBJECT_O = "remove(Object o)"; + private static final String ADD_ALL_COLLECTION_EXTENDS_E_C = "addAll(Collection c)"; + private static final String ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C = "addAll(int index, Collection c)"; + private static final String REMOVE_ALL_COLLECTION_C = "removeAll(Collection c)"; + private static final String RETAIN_ALL_COLLECTION_C = "retainAll(Collection c)"; + private static final String CLEAR = "clear()"; + private record ModificationErrorCondition(String errorMsg, Set unsupportedMethods) {}; + + @SuppressWarnings("unused") + private static final List ERROR_CONDITIONS = List.of( + new ModificationErrorCondition("was able to add element on the list iterator", Set.of(SET_INT_INDEX_E_ELEMENT)), + new ModificationErrorCondition("was able to perform addAll by index on the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT)), + new ModificationErrorCondition("was able to call remove by index from the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C)), + new ModificationErrorCondition("was able to add a value into the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C, REMOVE_INT_INDEX)), + new ModificationErrorCondition("was able to perform addAll on the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C, REMOVE_INT_INDEX, ADD_E_E)), + new ModificationErrorCondition("was able to call remove a value from the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C, REMOVE_INT_INDEX, ADD_E_E, ADD_ALL_COLLECTION_EXTENDS_E_C)), + new ModificationErrorCondition("was able to call removeAll on the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C, REMOVE_INT_INDEX, ADD_E_E, ADD_ALL_COLLECTION_EXTENDS_E_C, REMOVE_OBJECT_O)), + new ModificationErrorCondition("was able to call retainAll on the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C, REMOVE_INT_INDEX, ADD_E_E, ADD_ALL_COLLECTION_EXTENDS_E_C, REMOVE_OBJECT_O, REMOVE_ALL_COLLECTION_C)), + new ModificationErrorCondition("was able to clear the collection", Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C, REMOVE_INT_INDEX, ADD_E_E, ADD_ALL_COLLECTION_EXTENDS_E_C, REMOVE_OBJECT_O, REMOVE_ALL_COLLECTION_C, RETAIN_ALL_COLLECTION_C)), + new ModificationErrorCondition(null, Set.of(SET_INT_INDEX_E_ELEMENT, ADD_INT_INDEX_E_ELEMENT, ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C, REMOVE_INT_INDEX, ADD_E_E, ADD_ALL_COLLECTION_EXTENDS_E_C, REMOVE_OBJECT_O, REMOVE_ALL_COLLECTION_C, RETAIN_ALL_COLLECTION_C, CLEAR)) + ); + + // TODO: Should I include Map.of().values()? + @SuppressWarnings("unused") + private static final List JDK_KNOWN_UNMODIFIABLE_COLLECTIONS = Stream.>of( + // List of collections that we know are unmodifiable + Set.of(), List.of(), + Collections.emptyList(), Collections.emptySet(), Collections.emptySortedSet(), + Collections.unmodifiableCollection(new ArrayList<>()), Collections.unmodifiableList(new ArrayList<>()), Collections.unmodifiableSet(new HashSet<>()) + ) + .map(c->Arguments.of(c, c.getClass().getName())) + .toList(); + @SuppressWarnings("unused") + private static final List JDK_KNOWN_MODIFIABLE_COLLECTIONS = Stream.>of( + // List of collections that we know are modifiable + new ArrayList(), new LinkedList(), new HashSet(), new LinkedHashSet(), new TreeSet(), new PriorityQueue(), new ArrayDeque(), + Arrays.asList(1, 2, 3) + ) + .map(c->Arguments.of(c, c.getClass().getName())) + .toList(); + + // isUnmodifiable() tests + + @Override + protected Matcher createMatcher() { + return isUnmodifiableCollection(); + } + + @DisplayName("IsUnmodifiableCollection() matches known unmodifiable JDK collections") + @ParameterizedTest(name = "{1}") + @FieldSource("JDK_KNOWN_UNMODIFIABLE_COLLECTIONS") + public void testIsUnmodifiableMatchesKnownJdkUnmodifiableCollections(Collection collection, String className) { + assertMatches("truly unmodifiable JDK Collection (" + className + ")", isUnmodifiableCollection(), collection); + } + + @DisplayName("IsUnmodifiableCollection() mismatches known modifiable JDK collections") + @ParameterizedTest(name = "{1}") + @FieldSource("JDK_KNOWN_MODIFIABLE_COLLECTIONS") + public void testIsUnmodifiableMismatchesKnownJdkModifiableCollections(Collection collection, String className) { + assertMismatchDescription(className + " is a known modifiable JDK collection", isUnmodifiableCollection(), collection); + } + + @DisplayName("IsUnmodifiableCollection() matches unmodifiable custom collection") + @Test + public void testIsUnmodifiableMatchesUnmodifiableCustomList() { + assertMatches("truly unmodifiable list", isUnmodifiableCollection(), new CustomUnmodifiableList<>(Arrays.asList(1, 2, 3))); + } + + @DisplayName("IsUnmodifiableCollection() mismatches modifiable custom collection") + @ParameterizedTest + @FieldSource("ERROR_CONDITIONS") + public void testIsUnmodifiableMismatchesModifiableCustomList(ModificationErrorCondition errorCondition) { + CustomModifiableList arrayListWrapper = new CustomModifiableList<>(List.of(1, 2, 3), errorCondition.unsupportedMethods); + if (errorCondition.errorMsg != null) { + assertMismatchDescription( + errorCondition.errorMsg, + isUnmodifiableCollection(), + arrayListWrapper + ); + } else { + assertMatches("truly unmodifiable collection", isUnmodifiableCollection(), arrayListWrapper); + } + } + + // isUnmodifiableJdkCollection() tests + + @DisplayName("IsUnmodifiableJdkCollection() matches known unmodifiable JDK collections") + @ParameterizedTest(name = "{1}") + @FieldSource("JDK_KNOWN_UNMODIFIABLE_COLLECTIONS") + public void testIsUnmodifiableJdkCollectionMatchesKnownJdkUnmodifiableCollections(Collection collection, String className) { + assertMatches("truly unmodifiable JDK Collection (" + className + ")", isUnmodifiableJdkCollection(), collection); + } + + @DisplayName("IsUnmodifiableJdkCollection() mismatches known modifiable JDK collections") + @ParameterizedTest(name = "{1}") + @FieldSource("JDK_KNOWN_MODIFIABLE_COLLECTIONS") + public void testIsUnmodifiableJdkCollectionMismatchesKnownJdkModifiableCollections(Collection collection, String className) { + assertMismatchDescription(className + " is not a known unmodifiable JDK collection", isUnmodifiableJdkCollection(), collection); + } + + @DisplayName("IsUnmodifiableJdkCollection() mismatches unmodifiable custom collection") + @Test + public void testIsUnmodifiableJdkCollectionMismatchesUnmodifiableCustomList() { + CustomUnmodifiableList testList = new CustomUnmodifiableList<>(Arrays.asList(1, 2, 3)); + assertMismatchDescription(CustomUnmodifiableList.class.getName() + " is not a known unmodifiable JDK collection", isUnmodifiableJdkCollection(), testList); + } + + // isModifiableJdkCollection() tests + + @DisplayName("IsModifiableJdkCollection() mismatches known unmodifiable JDK collections") + @ParameterizedTest(name = "{1}") + @FieldSource("JDK_KNOWN_UNMODIFIABLE_COLLECTIONS") + public void testIsModifiableJdkCollectionMatchesKnownJdkUnmodifiableCollections(Collection collection, String className) { + assertMismatchDescription(className + " is not a known modifiable JDK collection", isModifiableJdkCollection(), collection); + } + + @DisplayName("IsModifiableJdkCollection() matches known modifiable JDK collections") + @ParameterizedTest(name = "{1}") + @FieldSource("JDK_KNOWN_MODIFIABLE_COLLECTIONS") + public void testIsModifiableJdkCollectionMatchesKnownJdkModifiableCollections(Collection collection, String className) { + assertMatches("truly unmodifiable JDK Collection (" + className + ")", isModifiableJdkCollection(), collection); + } + + @DisplayName("IsModifiableJdkCollection() mismatches modifiable custom collection") + @Test + public void testIsModifiableJdkCollectionMismatchesModifiableCustomList() { + CustomModifiableList testList = new CustomModifiableList<>(Arrays.asList(1, 2, 3), Set.of()); + assertMismatchDescription(CustomModifiableList.class.getName() + " is not a known modifiable JDK collection", isModifiableJdkCollection(), testList); + } + + // isUnmodifiableCustomCollection() tests + @DisplayName("IsUnmodifiableCustomCollection() matches unmodifiable custom collection") + @Test + public void testisUnmodifiableCustomCollectionMatchesUnmodifiableCustomList() { + assertMatches("truly unmodifiable list", isUnmodifiableCustomCollection(), new CustomUnmodifiableList<>(Arrays.asList(1, 2, 3))); + } + + @DisplayName("IsUnmodifiableCustomCollection() mismatches modifiable custom collection") + @ParameterizedTest + @FieldSource("ERROR_CONDITIONS") + public void testIsUnmodifiableCustomCollectionMismatchesModifiableCustomList(ModificationErrorCondition errorCondition) { + CustomModifiableList arrayListWrapper = new CustomModifiableList<>(List.of(1, 2, 3), errorCondition.unsupportedMethods); + if (errorCondition.errorMsg != null) { + assertMismatchDescription( + errorCondition.errorMsg, + isUnmodifiableCustomCollection(), + arrayListWrapper + ); + } else { + assertMatches("truly unmodifiable collection", isUnmodifiableCustomCollection(), arrayListWrapper); + } + } + + @SuppressWarnings("serial") + static class CustomModifiableList extends ArrayList { + private final Set unsupportedMethods; + + @SuppressWarnings("unused") // Used by reflection + public CustomModifiableList(Collection c) { + super(c); + if (c instanceof CustomModifiableList) { + this.unsupportedMethods = new HashSet<>(((CustomModifiableList) c).unsupportedMethods); + } else { + throw new IllegalStateException(); + } + } + + public CustomModifiableList(List list, Set unsupportedMethods) { + super(list); + this.unsupportedMethods = unsupportedMethods; + } + + @Override + public E set(int index, E element) { + if (unsupportedMethods.contains(SET_INT_INDEX_E_ELEMENT)) throw new UnsupportedOperationException(); + return super.set(index, element); + } + + @Override + public boolean add(E e) { + if (unsupportedMethods.contains(ADD_E_E)) throw new UnsupportedOperationException(); + return super.add(e); + } + + @Override + public void add(int index, E element) { + if (unsupportedMethods.contains(ADD_INT_INDEX_E_ELEMENT)) throw new UnsupportedOperationException(); + super.add(index, element); + } + + @Override + public E remove(int index) { + if (unsupportedMethods.contains(REMOVE_INT_INDEX)) throw new UnsupportedOperationException(); + return super.remove(index); + } + + @Override + public boolean remove(Object o) { + if (unsupportedMethods.contains(REMOVE_OBJECT_O)) throw new UnsupportedOperationException(); + return super.remove(o); + } + + @Override + public void clear() { + if (unsupportedMethods.contains(CLEAR)) throw new UnsupportedOperationException(); + super.clear(); + } + + @Override + public boolean addAll(Collection c) { + if (unsupportedMethods.contains(ADD_ALL_COLLECTION_EXTENDS_E_C)) throw new UnsupportedOperationException(); + return super.addAll(c); + } + + @Override + public boolean addAll(int index, Collection c) { + if (unsupportedMethods.contains(ADD_ALL_INT_INDEX_COLLECTION_EXTENDS_E_C)) + throw new UnsupportedOperationException(); + return super.addAll(index, c); + } + + @Override + public boolean removeAll(Collection c) { + if (unsupportedMethods.contains(REMOVE_ALL_COLLECTION_C)) throw new UnsupportedOperationException(); + return super.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + if (unsupportedMethods.contains(RETAIN_ALL_COLLECTION_C)) throw new UnsupportedOperationException(); + return super.retainAll(c); + } + } + + private static class CustomUnmodifiableList implements List { + + private List list; + + public CustomUnmodifiableList(List list) { + this.list = Collections.unmodifiableList(list); + } + + @Override + public int size() { + return list.size(); + } + + @Override + public boolean isEmpty() { + return list.isEmpty(); + } + + @Override + public boolean contains(Object o) { + return list.contains(o); + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public Object[] toArray() { + return list.toArray(); + } + + @Override + public T[] toArray(T[] a) { + return list.toArray(a); + } + + @Override + public boolean add(E e) { + return list.add(e); + } + + @Override + public boolean remove(Object o) { + return list.remove(o); + } + + @Override + public boolean containsAll(Collection c) { + return list.containsAll(c); + } + + @Override + public boolean addAll(Collection c) { + return list.addAll(c); + } + + @Override + public boolean addAll(int index, Collection c) { + return list.addAll(index, c); + } + + @Override + public boolean removeAll(Collection c) { + return list.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return list.retainAll(c); + } + + @Override + public void clear() { + list.clear(); + } + + @Override + public E get(int index) { + return list.get(index); + } + + @Override + public E set(int index, E element) { + return list.set(index, element); + } + + @Override + public void add(int index, E element) { + list.add(index, element); + } + + @Override + public E remove(int index) { + return list.remove(index); + } + + @Override + public int indexOf(Object o) { + return list.indexOf(o); + } + + @Override + public int lastIndexOf(Object o) { + return list.lastIndexOf(o); + } + + @Override + public ListIterator listIterator() { + return list.listIterator(); + } + + @Override + public ListIterator listIterator(int index) { + return list.listIterator(index); + } + + @Override + public List subList(int fromIndex, int toIndex) { + return list.subList(fromIndex, toIndex); + } + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java index 013eafba..3b0d05ad 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java @@ -60,4 +60,8 @@ public final class AnyOfTest { assertThat("the text!", new AnyOf<>(startsWith("the"), endsWith("."))); } + @Test public void hasAReadableMismatchDescription() { + assertMismatchDescription("was \"foo\"", + anyOf(equalTo("good"), equalTo("bad"), equalTo("ugly")), "foo"); + } } diff --git a/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java b/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java index 0bdd71fb..8086feff 100644 --- a/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java +++ b/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java @@ -2,12 +2,13 @@ import org.hamcrest.test.AbstractMatcherTest; import org.hamcrest.Matcher; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; +import org.junit.jupiter.api.io.TempDir; import java.io.File; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; import static org.hamcrest.test.MatcherAssertions.*; import static org.hamcrest.core.IsEqual.equalTo; @@ -16,14 +17,20 @@ @SuppressWarnings("ResultOfMethodCallIgnored") public class FileMatchersTest extends AbstractMatcherTest { + @TempDir Path tempDir; private File directory; private File file; + private File anotherFile; @BeforeEach protected void setUp() throws IOException { - directory = Files.createTempDirectory("myDir").toFile(); + directory = Files.createDirectory(tempDir.resolve("myDir")).toFile(); file = new File(directory, "myFile"); file.createNewFile(); + + anotherFile = new File(directory, "myAnotherFile"); + + Files.writeString(anotherFile.toPath(), "world"); } @Test @@ -95,9 +102,30 @@ public void testAFileWithAbsolutePath() { assertDoesNotMatch("doesn't match incorrect absolute path", FileMatchers.aFileWithAbsolutePath(equalTo("foo")), file); } + @Test + public void testFileContentMatcher() { + assertMatches("matches file content with a file", FileMatchers.matchesContentOf(file), file); + assertDoesNotMatch("content of two files with different content won't match", FileMatchers.matchesContentOf(anotherFile), file); + } + + @Test + public void testFileContentMatcherDescription() { + assertMismatchDescription("content was \"\"", FileMatchers.matchesContentOf(anotherFile), file); + } + + @Test + public void testAFileWithContent() { + assertMatches("matches file content", FileMatchers.aFileWithContent(equalTo("")), file); + assertDoesNotMatch("doesn't match incorrect content", FileMatchers.aFileWithContent(equalTo("world")), file); + } + + @Test + public void testAFileWithContentDescription() { + assertMismatchDescription("content was \"\"", FileMatchers.aFileWithContent(equalTo("world")), file); + } + @Override protected Matcher createMatcher() { return FileMatchers.aFileWithSize(1L); } - } diff --git a/hamcrest/src/test/java/org/hamcrest/io/PathMatchersTest.java b/hamcrest/src/test/java/org/hamcrest/io/PathMatchersTest.java new file mode 100644 index 00000000..ab194377 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/io/PathMatchersTest.java @@ -0,0 +1,226 @@ +package org.hamcrest.io; + +import org.hamcrest.test.AbstractMatcherTest; +import org.hamcrest.Matcher; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; +import org.junit.jupiter.api.io.TempDir; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import static org.hamcrest.test.MatcherAssertions.*; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@SuppressWarnings("ResultOfMethodCallIgnored") +public class PathMatchersTest extends AbstractMatcherTest { + + @TempDir Path tempDir; + private Path directory; + private Path file; + private Path anotherFile; + private Path symbolicLink; + + @BeforeEach + protected void setUp() throws IOException { + directory = Files.createDirectory(tempDir.resolve("myDir")); + file = directory.resolve("myFile"); + anotherFile = directory.resolve("myAnotherFile"); + Files.createFile(file); + Files.writeString(anotherFile, "world"); + Files.createFile(directory.resolve("mydirFile")); // Makes sure myDir is not empty. + if (!OS.WINDOWS.isCurrentOs()) { // Can't do symbolic links on Windows unless admin privileges are available. + symbolicLink = tempDir.resolve("mySymbolicLink"); + Files.createSymbolicLink(symbolicLink, file); + } + } + + @Test + public void testAnExistingDirectory() { + assertMatches("matches existing directory", PathMatchers.anExistingDirectory(), directory); + assertDoesNotMatch("doesn't match existing file", PathMatchers.anExistingDirectory(), file); + assertMismatchDescription("'foo' is not a directory", PathMatchers.anExistingDirectory(), Paths.get("foo")); + } + + @Test + public void testAnExistingFileOrDirectory() { + assertMatches("matches existing file", PathMatchers.anExistingFileOrDirectory(), file); + assertMatches("matches existing directory", PathMatchers.anExistingFileOrDirectory(), directory); + assertMismatchDescription("'foo' does not exist", PathMatchers.anExistingFileOrDirectory(), Paths.get("foo")); + } + + @Test + public void testAnExistingFile() { + assertMatches("matches existing file", PathMatchers.anExistingFile(), file); + assertDoesNotMatch("doesn't match existing directory", PathMatchers.anExistingFile(), directory); + assertMismatchDescription("'foo' is not a file", PathMatchers.anExistingFile(), Paths.get("foo")); + } + + @Test + public void testIsReadable() { // Not all OSes will allow setting readability so have to be forgiving here. + file.toFile().setReadable(true); + assertMatches("matches readable file", PathMatchers.isReadable(), file); + + if (file.toFile().setReadable(false)) { + assertDoesNotMatch("doesn't match unreadable file", PathMatchers.isReadable(), file); + } + } + + @Test + public void testIsWritable() { + assertMatches("matches writable file", PathMatchers.isWritable(), file); + + assertTrue(file.toFile().setWritable(false), "set writable off " + file); + assertDoesNotMatch("doesn't match unwritable file", PathMatchers.isWritable(), file); + + assertMatches("matches writable directory", PathMatchers.isWritable(), directory); + + // Directories cannot be set to read-only on Windows. + if (!OS.WINDOWS.isCurrentOs()) { + assertTrue(directory.toFile().setWritable(false), "set writable off " + file); + assertDoesNotMatch("doesn't match unwritable file", PathMatchers.isWritable(), directory); + } + } + + @Test + public void testIsHidden() throws Exception { + Path hiddenFile = tempDir.resolve(Paths.get(".hidden_file")); + Path hiddenDir = tempDir.resolve(Paths.get(".hidden_dir")); + Files.createFile(hiddenFile); + Files.createDirectory(hiddenDir); + + // Set the hidden attribute for the file and directory on Windows. + if (OS.WINDOWS.isCurrentOs()) { + Files.setAttribute(hiddenFile, "dos:hidden", true); + Files.setAttribute(hiddenDir, "dos:hidden", true); + } + + assertMatches("matches hidden file", PathMatchers.isHidden(), tempDir.resolve(hiddenFile)); + assertMatches("matches hidden directory", PathMatchers.isHidden(), hiddenDir); + + assertDoesNotMatch("doesn't match unhidden (i.e. visible) file", PathMatchers.isHidden(), file); + assertDoesNotMatch("doesn't match unhidden (i.e. visible) directory", PathMatchers.isHidden(), directory); + } + + @Test + public void testIsSameFile() { + // TODO: Needs work + assertMatches("matches same file", PathMatchers.isSameFile(file.toAbsolutePath()), file); + assertDoesNotMatch("doesn't match different file", PathMatchers.isSameFile(file), directory); + assertMismatchDescription("'" + directory.toString() + "' is not the same file or directory", + PathMatchers.isSameFile(file), directory); + if (!OS.WINDOWS.isCurrentOs()) { // Windows does not support symbolic links without administrator privileges. + assertMatches("matches same file through symbolic link", PathMatchers.isSameFile(file), symbolicLink); + assertDoesNotMatch("doesn't match different file through symbolic link", PathMatchers.isSameFile(directory), symbolicLink); + } + } + + @DisabledOnOs(OS.WINDOWS) // Windows does not support creating symbolic links without administrator + // privileges. + @Test + public void testisSymbolicLink() { + assertMatches("matches synbolic link", PathMatchers.isSymbolicLink(), symbolicLink); + assertDoesNotMatch("doesn't match a file", PathMatchers.isSymbolicLink(), file); + assertMismatchDescription("'foo' is not a symbolic link", PathMatchers.isSymbolicLink(), Paths.get("foo")); + } + + @Test + public void testHasSizeEqualToLong() { + assertMatches("matches file size", PathMatchers.hasSizeEqualTo(0L), file); + assertDoesNotMatch("doesn't match incorrect file size", PathMatchers.hasSizeEqualTo(34L), file); + + assertMatches("matches file size", PathMatchers.hasSizeEqualTo(OS.WINDOWS.isCurrentOs() ? 0L : 4096L), directory); + assertDoesNotMatch("doesn't match incorrect file size", PathMatchers.hasSizeEqualTo(34L), directory); + } + + @Test + public void testHasSizeMatcherOfLong() { + assertMatches("matches file size", PathMatchers.hasSize(equalTo(0L)), file); + assertDoesNotMatch("doesn't match incorrect file size", PathMatchers.hasSize(equalTo(23L)), file); + } + + @Test + public void testHasFileName_Path() { + assertMatches("matches file name", PathMatchers.hasFileName(equalTo(file.getFileName())), file); + assertDoesNotMatch("doesn't match incorrect file name", PathMatchers.hasFileName(equalTo(Paths.get("foo"))), file); + } + + @Test + public void testHasFileNameString_String() { + assertMatches("matches file name", PathMatchers.hasFileNameString(equalTo(file.getFileName().toString())), file); + assertDoesNotMatch("doesn't match incorrect file name", PathMatchers.hasFileNameString(equalTo("foo")), file); + } + + @Test + public void testHasRealPath() throws Exception { + assertMatches("matches file canonical path", PathMatchers.hasRealPath(equalTo(file.toRealPath())), file); + assertDoesNotMatch("doesn't match incorrect canonical path", PathMatchers.hasRealPath(equalTo(Paths.get("foo"))), file); + } + + @Test + public void testHasRealPathString() throws Exception { + assertMatches("matches file canonical path", PathMatchers.hasRealPathString(equalTo(file.toRealPath().toString())), file); + assertDoesNotMatch("doesn't match incorrect canonical path", PathMatchers.hasRealPathString(equalTo("foo")), file); + } + + @Test + public void testHasCanonicalPathString() throws Exception { + assertMatches("matches file canonical path", PathMatchers.hasCanonicalPathString(equalTo(file.toRealPath().toString())), + file); + assertDoesNotMatch("doesn't match incorrect canonical path", PathMatchers.hasCanonicalPathString(equalTo("foo")), file); + } + + @Test + public void testHasAbsolutePath() { + assertMatches("matches file absolute path", PathMatchers.hasAbsolutePath(equalTo(file.toAbsolutePath())), file); + assertDoesNotMatch("doesn't match incorrect absolute path", PathMatchers.hasAbsolutePath(equalTo(Paths.get("foo"))), + file); + } + + @Test + public void testHasAbsolutePathString() { + assertMatches("matches file absolute path", PathMatchers.hasAbsolutePathString(equalTo(file.toAbsolutePath().toString())), + file); + assertDoesNotMatch("doesn't match incorrect absolute path", PathMatchers.hasAbsolutePathString(equalTo("foo")), file); + } + + @Test + public void testHasFileSystem() { + assertMatches("matches file system", PathMatchers.hasFileSystem(equalTo(file.getFileSystem())), file); + // TODO: Maybe use JimFS to create a different FileSystem for this test? +// assertDoesNotMatch("doesn't match incorrect file system",PathMatchers.hasFileSystem(equalTo(Paths.get("foo").getFileSystem())), file); + } + + @Test + public void testFileContentMatcher() { + assertMatches("matches file content with a file", PathMatchers.matchesContentOf(file), file); + assertDoesNotMatch("content of two files with different content won't match", PathMatchers.matchesContentOf(anotherFile), file); + } + + @Test + public void testFileContentMatcherDescription() { + assertMismatchDescription("content was \"\"", PathMatchers.matchesContentOf(anotherFile), file); + } + + @Test + public void testAFileWithContent() { + assertMatches("matches file content", PathMatchers.hasContent(equalTo("")), file); + assertDoesNotMatch("doesn't match incorrect content", PathMatchers.hasContent(equalTo("world")), file); + } + + @Test + public void testAFileWithContentDescription() { + assertMismatchDescription("content was \"\"", PathMatchers.hasContent(equalTo("world")), file); + } + + @Override + protected Matcher createMatcher() { + return PathMatchers.hasSizeEqualTo(1L); +// return PathMatchers.isSymbolicLink(); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/optional/OptionalMatchersTest.java b/hamcrest/src/test/java/org/hamcrest/optional/OptionalMatchersTest.java index 3af6309c..deeb045d 100644 --- a/hamcrest/src/test/java/org/hamcrest/optional/OptionalMatchersTest.java +++ b/hamcrest/src/test/java/org/hamcrest/optional/OptionalMatchersTest.java @@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test; public class OptionalMatchersTest { + private static final String LS = System.lineSeparator(); @Test public void checkEmptyOptional() { @@ -26,8 +27,8 @@ public void checkEmptyOptionalFailure() { AssertionError failure = assertThrows(AssertionError.class, () -> { assertThat(Optional.of(1), emptyOptional()); }); - assertEquals("\n" + - "Expected: empty\n" + + assertEquals(LS + + "Expected: empty" + LS + " but: is Optional[1]", failure.getMessage()); } @@ -36,8 +37,8 @@ public void checkEmptyOptionalIsFailure() { AssertionError failure = assertThrows(AssertionError.class, () -> { assertThat(Optional.of(1), is(emptyOptional())); }); - assertEquals("\n" + - "Expected: is empty\n" + + assertEquals(LS + + "Expected: is empty" + LS + " but: is Optional[1]", failure.getMessage()); } @@ -46,8 +47,8 @@ public void checkEmptyOptionalIsNotFailure() { AssertionError failure = assertThrows(AssertionError.class, () -> { assertThat(Optional.empty(), is(not(emptyOptional()))); }); - assertEquals("\n" + - "Expected: is not empty\n" + + assertEquals(LS + + "Expected: is not empty" + LS + " but: was ", failure.getMessage()); } @@ -76,8 +77,8 @@ public void checkWithValueFailure() { AssertionError failure = assertThrows(AssertionError.class, () -> { assertThat(Optional.empty(), is(optionalWithValue())); }); - assertEquals("\n" + - "Expected: is present and matches any\n" + + assertEquals(LS + + "Expected: is present and matches any" + LS + " but: is Optional.empty", failure.getMessage()); } @@ -86,8 +87,8 @@ public void checkWithMatchingValueFailure() { AssertionError failure = assertThrows(AssertionError.class, () -> { assertThat(Optional.empty(), is(optionalWithValue(equalTo(1)))); }); - assertEquals("\n" + - "Expected: is present and matches <1>\n" + + assertEquals(LS + + "Expected: is present and matches <1>" + LS + " but: is Optional.empty", failure.getMessage()); } @@ -96,8 +97,8 @@ public void checkWithLiteralValueFailure() { AssertionError failure = assertThrows(AssertionError.class, () -> { assertThat(Optional.of("text"), is(optionalWithValue("Hello, world"))); }); - assertEquals("\n" + - "Expected: is present and matches \"Hello, world\"\n" + + assertEquals(LS + + "Expected: is present and matches \"Hello, world\"" + LS + " but: is Optional[text]", failure.getMessage()); } } diff --git a/settings.gradle b/settings.gradle index d4b00979..ee6d4aae 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ plugins { // Apply the foojay-resolver plugin to allow automatic download of JDKs - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' } include 'hamcrest',