diff --git a/.classpath b/.classpath
deleted file mode 100644
index fc81595d..00000000
--- a/.classpath
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
+
+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.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
+
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+
+
+
+
+This help file applies to API documentation generated using the standard doclet.
+
+
+A
+
+
+
+
+
+
+
+
+
+
+
+BaseClass for all Matcher implementations.
+
+
+
+
+
+
+
+
+A Condition implements part of a multi-step match. We sometimes need to write matchers
+ that have a sequence of steps, where each step depends on the result of the previous
+ step and we can stop processing as soon as a step fails. These classes provide
+ infrastructure for writing such a sequence.
+
+ Based on https://github.com/npryce/maybe-java
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ If the specified operand is The created matcher provides a special behaviour when examining
+ 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
+
+ The created matcher assumes no relationship between specified type and the examined object.
+
+
+
+
+
+
+
+
+
+
+
+
+Utility class for writing one off matchers.
+ For example:
+
+ This class is designed for scenarios where an anonymous inner class
+ matcher makes sense. It should not be used by API designers implementing
+ matchers.
+
+
+
+
+
+Utility class for writing one off matchers.
+ For example:
+
+
+
+
+
+
+
+
+
+
+
+
+A description of a Matcher. A Matcher will describe itself to a description
+ which can later be used for reporting.
+
+
+
+
+
+
+
+
+
+
+
+TODO(ngd): Document.
+
+
+
+
+
+
+
+Marks a Hamcrest static factory method so tools recognise them.
+ A factory method is an equivalent to a named constructor.
+
+
+
+
+
+
+
+
+Supporting class for matching a feature of an object. Implement
+
+
+
+
+
+
+
+
+Integration method for use with Java's
+
+
+
+A matcher over acceptable values.
+ A matcher is able to describe itself to give feedback when it fails.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ If the specified operand is The created matcher provides a special behaviour when examining
+ 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
+
+ The created matcher assumes no relationship between specified type and the examined object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ For example:
+
+
+ For example:
+
+
+ For example:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/docs/css/hamcrest.css b/docs/css/hamcrest.css
new file mode 100644
index 00000000..c456ed90
--- /dev/null
+++ b/docs/css/hamcrest.css
@@ -0,0 +1,44 @@
+@import url(https://fonts.googleapis.com/css?family=Cabin+Sketch);
+@import url(https://fonts.googleapis.com/css?family=Alegreya);
+body {
+ font-family: "Alegreya";
+ margin: 40px auto;
+ width: 700px;
+}
+.content {
+ position: relative;
+}
+footer {
+ padding: 2em 0 1em 0;
+ font-size: 12px;
+}
+h1 {
+ font-size: 80px;
+ margin-top: .3em;
+ margin-bottom: 0;
+}
+h1 + h2 {
+ margin-top: 0;
+}
+h2 {
+ font-weight: 400;
+ font-size: 20px;
+}
+h1, h2 {
+ font-family: "Cabin Sketch";
+ text-rendering: optimizeLegibility;
+}
+.content > p {
+ line-height: 1.5em;
+ text-rendering: optimizeLegibility;
+}
+.logo {
+ height: 60px;
+ padding-left: 0px;
+ padding-right: 40px;
+}
+pre.highlight {
+ border: 1px solid #ccc;
+ background-color: #eee;
+ padding: 0.5em;
+}
\ No newline at end of file
diff --git a/docs/css/pygments-default.css b/docs/css/pygments-default.css
new file mode 100644
index 00000000..8070f2fb
--- /dev/null
+++ b/docs/css/pygments-default.css
@@ -0,0 +1,61 @@
+.highlight .hll { background-color: #ffffcc }
+.highlight .c { color: #408080; font-style: italic } /* Comment */
+.highlight .err { border: 1px solid #FF0000 } /* Error */
+.highlight .k { color: #008000; font-weight: bold } /* Keyword */
+.highlight .o { color: #666666 } /* Operator */
+.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
+.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #A00000 } /* Generic.Deleted */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #FF0000 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #808080 } /* Generic.Output */
+.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #0040D0 } /* Generic.Traceback */
+.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #008000 } /* Keyword.Pseudo */
+.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #B00040 } /* Keyword.Type */
+.highlight .m { color: #666666 } /* Literal.Number */
+.highlight .s { color: #BA2121 } /* Literal.String */
+.highlight .na { color: #7D9029 } /* Name.Attribute */
+.highlight .nb { color: #008000 } /* Name.Builtin */
+.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
+.highlight .no { color: #880000 } /* Name.Constant */
+.highlight .nd { color: #AA22FF } /* Name.Decorator */
+.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #0000FF } /* Name.Function */
+.highlight .nl { color: #A0A000 } /* Name.Label */
+.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #19177C } /* Name.Variable */
+.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mf { color: #666666 } /* Literal.Number.Float */
+.highlight .mh { color: #666666 } /* Literal.Number.Hex */
+.highlight .mi { color: #666666 } /* Literal.Number.Integer */
+.highlight .mo { color: #666666 } /* Literal.Number.Oct */
+.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
+.highlight .sc { color: #BA2121 } /* Literal.String.Char */
+.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
+.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
+.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.highlight .sx { color: #008000 } /* Literal.String.Other */
+.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
+.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
+.highlight .ss { color: #19177C } /* Literal.String.Symbol */
+.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #19177C } /* Name.Variable.Class */
+.highlight .vg { color: #19177C } /* Name.Variable.Global */
+.highlight .vi { color: #19177C } /* Name.Variable.Instance */
+.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
diff --git a/docs/distributables.md b/docs/distributables.md
new file mode 100644
index 00000000..dde75ac7
--- /dev/null
+++ b/docs/distributables.md
@@ -0,0 +1,151 @@
+---
+title: Hamcrest Distributables
+layout: default
+---
+[Java Hamcrest Home](index)
+
+# Hamcrest Distributables
+{:.no_toc}
+
+## Introduction
+{:.no_toc}
+
+This document describes the current and previous versions of the various Hamcrest
+distributables, and the functionality contained in each of them.
+
+The latest version of Hamcrest consists of a single jar file which contains base
+classes and a library of useful matcher implementations. This is different from
+older versions.
+
+Older versions of Hamcrest consisted of a number of different jars matching the
+different needs of applications. The change in the jar packaging requires care
+when upgrading.
+
+## Table of Contents
+{:.no_toc}
+
+* TOC
+{:toc}
+
+## The Hamcrest Jar
+
+All the base classes and standard matcher implementations are contained in a
+single jar file called `hamcrest-2.1.jar`.
+
+### Using Hamcrest in a Gradle Project
+
+Add `"org.hamcrest:hamcrest:2.1"` to the dependencies section of your
+`build.gradle`, for example:
+
+```gradle
+apply plugin: 'java'
+
+dependencies {
+ testImplementation 'org.hamcrest:hamcrest:2.1'
+}
+```
+
+Note: older versions of Gradle use the `testCompile` configuration
+instead of the `testImplementation` configuration.
+
+### Using Hamcrest in a Maven Project
+
+Add the following to the `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+Constant Field Values
+
+Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+
diff --git a/docs/javadoc/1.3/deprecated-list.html b/docs/javadoc/1.3/deprecated-list.html
new file mode 100644
index 00000000..260fc82d
--- /dev/null
+++ b/docs/javadoc/1.3/deprecated-list.html
@@ -0,0 +1,191 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+Deprecated API
+
+Contents
+
+
+
+
+
+
+
+
+Deprecated Methods
+
+
+org.hamcrest.Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
+ to make
+
+org.hamcrest.BaseMatcher._dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
+
+
+org.hamcrest.Matchers.containsInAnyOrder(Matcher super E>)
+
+
+ use contains(Matcher super E> itemMatcher) instead
+
+org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher super E>)
+
+
+ use contains(Matcher super E> itemMatcher) instead
+
+org.hamcrest.Matchers.is(Class
+
+ use isA(Class
+
+org.hamcrest.CoreMatchers.is(Class
+
+ use isA(Class
+
+org.hamcrest.core.Is.is(Class
+
+ use isA(Class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+
diff --git a/docs/javadoc/1.3/help-doc.html b/docs/javadoc/1.3/help-doc.html
new file mode 100644
index 00000000..e7f01c0f
--- /dev/null
+++ b/docs/javadoc/1.3/help-doc.html
@@ -0,0 +1,223 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+How This API Document Is Organized
+
+Overview
+
+
+
+
+Package
+
+
+
+
+
+
+Class/Interface
+
+
+
+
+
+
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Annotation Type
+
+
+
+
+
+
+
+Enum
+
+
+
+
+
+
+Use
+
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+
+Tree (Class Hierarchy)
+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with
+java.lang.Object. The interfaces do not inherit from java.lang.Object.
+
+
+Deprecated API
+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+
+Index
+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+
+Prev/Next
+These links take you to the next or previous class, interface, package, or related page.
+Frames/No Frames
+These links show and hide the HTML frames. All pages are available with or without frames.
+
+Serialized Form
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+
+Constant Field Values
+The Constant Field Values page lists the static final fields and their values.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+
diff --git a/docs/javadoc/1.3/index-all.html b/docs/javadoc/1.3/index-all.html
new file mode 100644
index 00000000..40ed7de9
--- /dev/null
+++ b/docs/javadoc/1.3/index-all.html
@@ -0,0 +1,2032 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+A B C D E F G H I J L M N O P R S T _
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+A
+
+
+Matcher to act as an
+ EasyMock IArgumentMatcher and
+ report it to EasyMock so it can be kept track of.
+Matcher to act as an
+ jMock Constraint.
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+String.
+String.
+String.
+SelfDescribing value to this description.
+SelfDescribing objects
+ to the description.
+length of the array
+ satisfies the specified matcher.
+length of the array
+ equals the specified size.
+length of the array
+ satisfies the specified matcher.
+length of the array
+ equals the specified size.
+StringDescription.toString(SelfDescribing).
+
+
+B
+
+
+Description that is stored as a string.
+
+C
+
+
+Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error.
+BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error.
+BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error.
+Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error.
+Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object.
+Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object.
+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.
+Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.
+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.
+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.
+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.
+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.
+Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+String contains the specified
+ String anywhere.
+String contains the specified
+ String anywhere.
+String contains the specified
+ String anywhere.
+
+
+D
+
+
+
+
+E
+
+
+Matcher
+ to act as an EasyMock IArgumentMatcher.Collections matching examined collections whose isEmpty
+ method returns true.
+Collections matching examined collections whose isEmpty
+ method returns true.
+length of the array
+ is zero.
+length of the array
+ is zero.
+Collections matching examined collections whose isEmpty
+ method returns true.
+Collections matching examined collections whose isEmpty
+ method returns true.
+Iterables matching examined iterables that yield no items.
+Iterables matching examined iterables that yield no items.
+Iterables matching examined iterables that yield no items.
+Iterables matching examined iterables that yield no items.
+String ends with the specified
+ String.
+String ends with the specified
+ String.
+String ends with the specified
+ String.
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.
+String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored.
+String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored.
+EventObject that matches any object
+ derived from eventClass announced by source.
+EventObject that matches any EventObject
+ announced by source.
+EventObject that matches any object
+ derived from eventClass announced by source.
+EventObject that matches any EventObject
+ announced by source.
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.
+
+
+F
+
+
+
+
+G
+
+
+Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object.
+Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object.
+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.
+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
+
+
+Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher.
+Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value.
+Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value.
+Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher.
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.
+elementMatcher.
+hasItemInArray(equalTo(x)).
+hasItemInArray(equalTo(x)).
+elementMatcher.
+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.
+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.
+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.
+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.
+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.
+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.
+Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+Collections that matches when the size() method returns
+ a value that satisfies the specified matcher.
+Collections that matches when the size() method returns
+ a value equal to the specified size.
+Collections that matches when the size() method returns
+ a value that satisfies the specified matcher.
+Collections that matches when the size() method returns
+ a value equal to the specified size.
+toString method
+ returns a value that satisfies the specified matcher.
+toString method
+ returns a value equalTo the specified string.
+toString method
+ returns a value that satisfies the specified matcher.
+toString method
+ returns a value equalTo the specified string.
+Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content.
+Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content.
+Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher.
+Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher.
+Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher.
+Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher.
+Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content.
+Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content.
+
+
+I
+
+
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+is(equalTo(x)).
+is(equalTo(x)).
+is(equalTo(x)).
+is(instanceOf(SomeClass.class)).
+is(instanceOf(SomeClass.class)).
+is(instanceOf(SomeClass.class)).
+true.String that matches when the examined string is null, or
+ has zero length.
+String that matches when the examined string is null, or
+ has zero length.
+String that matches when the examined string has zero length.
+String that matches when the examined string has zero length.
+Object.equals(java.lang.Object) invokedMethod?Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher.
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument.
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher.
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument.
+
+
+J
+
+
+assert keyword.Matcher
+ to act as an jMock1 Constraint.
+
+L
+
+
+Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object.
+Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object.
+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.
+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
+
+
+
+
+N
+
+
+not(equalTo(x)).
+not(equalTo(x)).
+not(equalTo(x)).
+not(nullValue()).
+not(nullValue(X.class)).
+not(nullValue()).
+not(nullValue(X.class)).
+not(nullValue()).
+not(nullValue(X.class)).
+null.
+null.
+null.
+null.
+null.
+null.
+
+
+O
+
+
+
+
+P
+
+
+
+
+R
+
+
+
+
+S
+
+
+String starts with the specified
+ String.
+String starts with the specified
+ String.
+String starts with the specified
+ String.
+String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance.
+String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance.
+Description that is stored as a string.
+
+T
+
+
+SelfDescribing object as a String.
+Class that matches when the specified baseType is
+ assignable from the examined class.
+Class that matches when the specified baseType is
+ assignable from the examined class.
+matchesSafely
+ is not the class that binds <T> to a type.
+matchesSafely
+ is not the class that binds <T> to a type.
+matchesSafely
+ is not the class that binds <T> to a type.
+matchesSafely
+ is not the class that binds <T> to a type.
+
+
+_
+
+
+
+A B C D E F G H I J L M N O P R S T _
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV
+ NEXT
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+
diff --git a/docs/javadoc/1.3/index.html b/docs/javadoc/1.3/index.html
new file mode 100644
index 00000000..ff0017d9
--- /dev/null
+++ b/docs/javadoc/1.3/index.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class BaseDescription
+java.lang.Object
+
+
org.hamcrest.BaseDescription
+
+
+
+
+
+
+
+
+
+public abstract class BaseDescription
Description that is stored as a string.
+
+
+
+
+
+
+
+
+Nested Class Summary
+
+
+
+
+
+
+
+
+Nested classes/interfaces inherited from interface org.hamcrest.Description
+
+
+
+Description.NullDescription
+
+
+
+
+
+Field Summary
+
+
+
+
+
+
+
+
+Fields inherited from interface org.hamcrest.Description
+
+
+
+NONE
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+BaseDescription()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+protected abstract void
+append(char c)
+
+
+ Append the char c to the description.
+
+
+
+protected void
+append(java.lang.String str)
+
+
+ Append the String str to the description.
+
+
+
+ Description
+appendDescriptionOf(SelfDescribing value)
+
+
+ Appends the description of a SelfDescribing value to this description.
+
+
+
+ Description
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
+
+ Appends a list of SelfDescribing objects
+ to the description.
+
+
+
+ Description
+appendText(java.lang.String text)
+
+
+ Appends some plain text to the description.
+
+
+
+ Description
+appendValue(java.lang.Object value)
+
+
+ Appends an arbitary value to the description.
+
+
+
+
+
+
+
+
+
+
+<T> Description
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
+
+ Appends a list of values to the description.
+
+
+
+
+
+
+
+
+
+
+<T> Description
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
+
+ Appends a list of values to the description.
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+BaseDescription
+
+public BaseDescription()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+appendText
+
+public Description appendText(java.lang.String text)
+
+
+Description
+
+appendText in interface Description
+
+
+
+
+appendDescriptionOf
+
+public Description appendDescriptionOf(SelfDescribing value)
+
+
+DescriptionSelfDescribing value to this description.
+
+
+appendDescriptionOf in interface Description
+
+
+
+
+appendValue
+
+public Description appendValue(java.lang.Object value)
+
+
+Description
+
+appendValue in interface Description
+
+
+
+
+appendValueList
+
+public <T> Description appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
+
+Description
+
+appendValueList in interface Description
+
+
+
+
+appendValueList
+
+public <T> Description appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
+
+Description
+
+appendValueList in interface Description
+
+
+
+
+appendList
+
+public Description appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
+
+DescriptionSelfDescribing objects
+ to the description.
+
+
+appendList in interface Description
+
+
+
+
+append
+
+protected void append(java.lang.String str)
+
+
+append(char).
+ Override in subclasses to provide an efficient implementation.
+
+
+
+
+
+
+
+append
+
+protected abstract void append(char c)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/BaseMatcher.html b/docs/javadoc/1.3/org/hamcrest/BaseMatcher.html
new file mode 100644
index 00000000..95500177
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/BaseMatcher.html
@@ -0,0 +1,346 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class BaseMatcher<T>
+java.lang.Object
+
+
org.hamcrest.BaseMatcher<T>
+
+
+
+
+
+
+
+
+
+public abstract class BaseMatcher<T>
+
+Matcher
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+BaseMatcher()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+ void
+_dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
+ Deprecated.
+
+
+
+ void
+describeMismatch(java.lang.Object item,
+ Description description)
+
+
+ Generate a description of why the matcher has not accepted the item.
+
+
+
+ java.lang.String
+toString()
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+
+Methods inherited from interface org.hamcrest.Matcher
+
+
+
+matches
+
+
+
+
+Methods inherited from interface org.hamcrest.SelfDescribing
+
+
+
+describeTo
+
+
+
+
+
+Constructor Detail
+
+BaseMatcher
+
+public BaseMatcher()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+_dont_implement_Matcher___instead_extend_BaseMatcher_
+
+@Deprecated
+public final void _dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
+Matcher
+
+_dont_implement_Matcher___instead_extend_BaseMatcher_ in interface Matcher<T>
+
+
+describeMismatch
+
+public void describeMismatch(java.lang.Object item,
+ Description description)
+
+
+Matchermatches(item) is false, but
+ will not check this.
+
+
+describeMismatch in interface Matcher<T>
+
+item - The item that the Matcher has rejected.description - The description to be built or appended to.
+
+
+toString
+
+public java.lang.String toString()
+
+
+
+
+
+toString in class java.lang.Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/Condition.Step.html b/docs/javadoc/1.3/org/hamcrest/Condition.Step.html
new file mode 100644
index 00000000..c02ac9f5
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/Condition.Step.html
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+
+Interface Condition.Step<I,O>
+
+
+
+
+public static interface Condition.Step<I,O>
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+ Condition<O>
+apply(I value,
+ Description mismatch)
+
+
+
+
+
+
+
+
+Method Detail
+
+apply
+
+Condition<O> apply(I value,
+ Description mismatch)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/Condition.html b/docs/javadoc/1.3/org/hamcrest/Condition.html
new file mode 100644
index 00000000..768c4174
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/Condition.html
@@ -0,0 +1,412 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class Condition<T>
+java.lang.Object
+
+
org.hamcrest.Condition<T>
+
+
+
+
+
+public abstract class Condition<T>
+
+
+
+
+
+
+
+
+
+
+
+Nested Class Summary
+
+
+
+
+static interface
+Condition.Step<I,O>
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+
+
+
+static org.hamcrest.Condition.NotMatched<java.lang.Object>
+NOT_MATCHED
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+abstract
+
+
+
+
+
+
+<U> Condition<U>
+and(Condition.Step<? super T,U> mapping)
+
+
+
+
+
+
+static
+
+
+
+
+
+
+<T> Condition<T>
+matched(T theValue,
+ Description mismatch)
+
+
+
+
+
+
+ boolean
+matching(Matcher<T> match)
+
+
+
+
+
+
+abstract boolean
+matching(Matcher<T> match,
+ java.lang.String message)
+
+
+
+
+
+
+static
+
+
+
+
+
+
+<T> Condition<T>
+notMatched()
+
+
+
+
+
+
+
+
+
+
+
+
+
+<U> Condition<U>
+then(Condition.Step<? super T,U> mapping)
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Field Detail
+
+NOT_MATCHED
+
+public static final org.hamcrest.Condition.NotMatched<java.lang.Object> NOT_MATCHED
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+matching
+
+public abstract boolean matching(Matcher<T> match,
+ java.lang.String message)
+
+
+
+
+
+
+
+and
+
+public abstract <U> Condition<U> and(Condition.Step<? super T,U> mapping)
+
+
+
+
+
+
+
+matching
+
+public final boolean matching(Matcher<T> match)
+
+
+
+
+
+
+
+then
+
+public final <U> Condition<U> then(Condition.Step<? super T,U> mapping)
+
+
+
+
+
+
+
+notMatched
+
+public static <T> Condition<T> notMatched()
+
+
+
+
+
+
+
+matched
+
+public static <T> Condition<T> matched(T theValue,
+ Description mismatch)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/CoreMatchers.html b/docs/javadoc/1.3/org/hamcrest/CoreMatchers.html
new file mode 100644
index 00000000..88aa9166
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/CoreMatchers.html
@@ -0,0 +1,1629 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class CoreMatchers
+java.lang.Object
+
+
org.hamcrest.CoreMatchers
+
+
+
+
+
+public class CoreMatchers
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+CoreMatchers()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T>... matchers)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+any(java.lang.Class<T> type)
+
+
+ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<? super T>... matchers)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static Matcher<java.lang.Object>
+anything()
+
+
+ Creates a matcher that always matches, regardless of the examined object.
+
+
+
+static Matcher<java.lang.Object>
+anything(java.lang.String description)
+
+
+ Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified String.
+
+
+
+static
+
+
+
+
+
+
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+both(Matcher<? super LHS> matcher)
+
+
+ Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
+
+static Matcher<java.lang.String>
+containsString(java.lang.String substring)
+
+
+ Creates a matcher that matches if the examined String contains the specified
+ String anywhere.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
+
+ Wraps an existing matcher, overriding its description with that specified.
+
+
+
+static
+
+
+
+
+
+
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+either(Matcher<? super LHS> matcher)
+
+
+ Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
+
+static Matcher<java.lang.String>
+endsWith(java.lang.String suffix)
+
+
+ Creates a matcher that matches if the examined String ends with the specified
+ String.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+equalTo(T operand)
+
+
+ Creates a matcher that matches when the examined object is logically equal to the specified
+ operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.
+
+
+
+static
+
+
+
+
+
+
+<U> Matcher<java.lang.Iterable<U>>
+everyItem(Matcher<U> itemMatcher)
+
+
+ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<? super T>>
+hasItem(Matcher<? super T> itemMatcher)
+
+
+ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<? super T>>
+hasItem(T item)
+
+
+ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<T>>
+hasItems(Matcher<? super T>... itemMatchers)
+
+
+ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<T>>
+hasItems(T... items)
+
+
+ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+instanceOf(java.lang.Class<?> type)
+
+
+ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+is(java.lang.Class<T> type)
+
+
+ Deprecated. use isA(Class
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+is(Matcher<T> matcher)
+
+
+ Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+is(T value)
+
+
+ A shortcut to the frequently used is(equalTo(x)).
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+isA(java.lang.Class<T> type)
+
+
+ A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+not(Matcher<T> matcher)
+
+
+ Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+not(T value)
+
+
+ A shortcut to the frequently used not(equalTo(x)).
+
+
+
+static Matcher<java.lang.Object>
+notNullValue()
+
+
+ A shortcut to the frequently used not(nullValue()).
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+notNullValue(java.lang.Class<T> type)
+
+
+ A shortcut to the frequently used not(nullValue(X.class)).
+
+
+
+static Matcher<java.lang.Object>
+nullValue()
+
+
+ Creates a matcher that matches if examined object is null.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+nullValue(java.lang.Class<T> type)
+
+
+ Creates a matcher that matches if examined object is null.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+sameInstance(T target)
+
+
+ Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+
+
+
+static Matcher<java.lang.String>
+startsWith(java.lang.String prefix)
+
+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+theInstance(T target)
+
+
+ Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+CoreMatchers
+
+public CoreMatchers()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+allOf
+
+public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+both
+
+public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
+
+
+assertThat("fab", both(containsString("a")).and(containsString("b")))
+
+
+
+
+
+either
+
+public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
+
+
+assertThat("fan", either(containsString("a")).and(containsString("b")))
+
+
+
+
+
+describedAs
+
+public static <T> Matcher<T> describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
+
+describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
+
+
+description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised description
+
+
+everyItem
+
+public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)
+
+
+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")))
+
+
+itemMatcher - the matcher to apply to every item provided by the examined Iterable
+
+
+is
+
+public static <T> Matcher<T> is(T value)
+
+
+is(equalTo(x)).
+
+ For example:
+ assertThat(cheese, is(smelly))
+ instead of:
+ assertThat(cheese, is(equalTo(smelly)))
+
+
+
+
+
+is
+
+public static <T> Matcher<T> is(Matcher<T> matcher)
+
+
+assertThat(cheese, is(equalTo(smelly)))
+ instead of:
+ assertThat(cheese, equalTo(smelly))
+
+
+
+
+
+is
+
+public static <T> Matcher<T> is(java.lang.Class<T> type)
+
+
+is(instanceOf(SomeClass.class)).
+
+ For example:
+ assertThat(cheese, is(Cheddar.class))
+ instead of:
+ assertThat(cheese, is(instanceOf(Cheddar.class)))
+
+
+
+
+
+isA
+
+public static <T> Matcher<T> isA(java.lang.Class<T> type)
+
+
+is(instanceOf(SomeClass.class)).
+
+ For example:
+ assertThat(cheese, isA(Cheddar.class))
+ instead of:
+ assertThat(cheese, is(instanceOf(Cheddar.class)))
+
+
+
+
+
+anything
+
+public static Matcher<java.lang.Object> anything()
+
+
+
+
+
+
+
+anything
+
+public static Matcher<java.lang.Object> anything(java.lang.String description)
+
+
+String.
+
+
+description - a meaningful String used when describing itself
+
+
+hasItem
+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
+
+
+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"))
+
+
+item - the item to compare against the items provided by the examined Iterable
+
+
+hasItem
+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
+
+
+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")))
+
+
+itemMatcher - the matcher to apply to items provided by the examined Iterable
+
+
+hasItems
+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
+
+
+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"))
+
+
+items - the items to compare against the items provided by the examined Iterable
+
+
+hasItems
+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
+
+
+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")))
+
+
+itemMatchers - the matchers to apply to items provided by the examined Iterable
+
+
+equalTo
+
+public static <T> Matcher<T> equalTo(T operand)
+
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.
+
+ 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.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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+
+
+
+
+
+
+any
+
+public static <T> Matcher<T> any(java.lang.Class<T> type)
+
+
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+ with(any(Thing.class))assertThat(new Canoe(), instanceOf(Canoe.class));
+
+
+
+
+
+instanceOf
+
+public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
+
+
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+ assertThat(new Canoe(), instanceOf(Paddlable.class));
+
+
+
+
+
+not
+
+public static <T> Matcher<T> not(Matcher<T> matcher)
+
+
+assertThat(cheese, is(not(equalTo(smelly))))
+
+
+matcher - the matcher whose sense should be inverted
+
+
+not
+
+public static <T> Matcher<T> not(T value)
+
+
+not(equalTo(x)).
+
+ For example:
+ assertThat(cheese, is(not(smelly)))
+ instead of:
+ assertThat(cheese, is(not(equalTo(smelly))))
+
+
+value - the value that any examined object should not equal
+
+
+nullValue
+
+public static Matcher<java.lang.Object> nullValue()
+
+
+null.
+
+ For example:
+ assertThat(cheese, is(nullValue())
+
+
+
+
+
+nullValue
+
+public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
+
+
+null. Accepts a
+ single dummy argument to facilitate type inference.
+
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
+
+
+type - dummy parameter used to infer the generic type of the returned matcher
+
+
+notNullValue
+
+public static Matcher<java.lang.Object> notNullValue()
+
+
+not(nullValue()).
+
+ For example:
+ assertThat(cheese, is(notNullValue()))
+ instead of:
+ assertThat(cheese, is(not(nullValue())))
+
+
+
+
+
+notNullValue
+
+public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
+
+
+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 - dummy parameter used to infer the generic type of the returned matcher
+
+
+sameInstance
+
+public static <T> Matcher<T> sameInstance(T target)
+
+
+
+
+target - the target instance against which others should be assessed
+
+
+theInstance
+
+public static <T> Matcher<T> theInstance(T target)
+
+
+
+
+target - the target instance against which others should be assessed
+
+
+containsString
+
+public static Matcher<java.lang.String> containsString(java.lang.String substring)
+
+
+String contains the specified
+ String anywhere.
+
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))
+
+
+substring - the substring that the returned matcher will expect to find within any examined string
+
+
+startsWith
+
+public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
+
+
+String starts with the specified
+ String.
+
+ For example:
+ assertThat("myStringOfNote", startsWith("my"))
+
+
+prefix - the substring that the returned matcher will expect at the start of any examined string
+
+
+endsWith
+
+public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
+
+
+
+String ends with the specified
+ String.
+
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))
+
+
+suffix - the substring that the returned matcher will expect at the end of any examined string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/CustomMatcher.html b/docs/javadoc/1.3/org/hamcrest/CustomMatcher.html
new file mode 100644
index 00000000..8ddd0c68
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/CustomMatcher.html
@@ -0,0 +1,302 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class CustomMatcher<T>
+java.lang.Object
+
+
org.hamcrest.BaseMatcher<T>
+
org.hamcrest.CustomMatcher<T>
+
+
+T - The type of object being matched.
+
+
+
+
+
+
+public abstract class CustomMatcher<T>
+ Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
+ public boolean matches(Object object) {
+ return ((object instanceof String) && !((String) object).isEmpty();
+ }
+ };
+
+
+
+for a type safe variant of this class that you probably
+ want to use.
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+CustomMatcher(java.lang.String description)
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+ void
+describeTo(Description description)
+
+
+ Generates a description of the object.
+
+
+
+
+Methods inherited from class org.hamcrest.BaseMatcher
+
+
+
+_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+
+Methods inherited from interface org.hamcrest.Matcher
+
+
+
+matches
+
+
+
+
+
+Constructor Detail
+
+CustomMatcher
+
+public CustomMatcher(java.lang.String description)
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+describeTo
+
+public final void describeTo(Description description)
+
+
+
+SelfDescribing
+
+description - The description to be built or appended to.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/CustomTypeSafeMatcher.html b/docs/javadoc/1.3/org/hamcrest/CustomTypeSafeMatcher.html
new file mode 100644
index 00000000..d9d00a48
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/CustomTypeSafeMatcher.html
@@ -0,0 +1,305 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class CustomTypeSafeMatcher<T>
+java.lang.Object
+
+
org.hamcrest.BaseMatcher<T>
+
org.hamcrest.TypeSafeMatcher<T>
+
org.hamcrest.CustomTypeSafeMatcher<T>
+
+
+T - The type of object being matched
+
+
+
+
+
+
+public abstract class CustomTypeSafeMatcher<T>
+ Matcher<String> aNonEmptyString = new CustomTypeSafeMatcher<String>("a non empty string") {
+ public boolean matchesSafely(String string) {
+ return !string.isEmpty();
+ }
+ public void describeMismatchSafely(String string, Description mismatchDescription) {
+ mismatchDescription.appendText("was empty");
+ }
+ };
+
+ This is a variant of CustomMatcher that first type checks
+ the argument being matched. By the time TypeSafeMatcher.matchesSafely(T) is
+ is called the argument is guaranteed to be non-null and of the correct
+ type.
+
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+CustomTypeSafeMatcher(java.lang.String description)
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+ void
+describeTo(Description description)
+
+
+ Generates a description of the object.
+
+
+
+
+Methods inherited from class org.hamcrest.TypeSafeMatcher
+
+
+
+describeMismatch, describeMismatchSafely, matches, matchesSafely
+
+
+
+
+Methods inherited from class org.hamcrest.BaseMatcher
+
+
+
+_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+CustomTypeSafeMatcher
+
+public CustomTypeSafeMatcher(java.lang.String description)
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+describeTo
+
+public final void describeTo(Description description)
+
+
+
+SelfDescribing
+
+description - The description to be built or appended to.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/Description.NullDescription.html b/docs/javadoc/1.3/org/hamcrest/Description.NullDescription.html
new file mode 100644
index 00000000..d9e46f4b
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/Description.NullDescription.html
@@ -0,0 +1,482 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class Description.NullDescription
+java.lang.Object
+
+
org.hamcrest.Description.NullDescription
+
+
+
+
+
+
+
+
+
+public static final class Description.NullDescription
+
+
+
+
+
+
+
+Nested Class Summary
+
+
+
+
+
+
+
+
+Nested classes/interfaces inherited from interface org.hamcrest.Description
+
+
+
+Description.NullDescription
+
+
+
+
+
+Field Summary
+
+
+
+
+
+
+
+
+Fields inherited from interface org.hamcrest.Description
+
+
+
+NONE
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+Description.NullDescription()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+ Description
+appendDescriptionOf(SelfDescribing value)
+
+
+ Appends the description of a SelfDescribing value to this description.
+
+
+
+ Description
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
+
+ Appends a list of SelfDescribing objects
+ to the description.
+
+
+
+ Description
+appendText(java.lang.String text)
+
+
+ Appends some plain text to the description.
+
+
+
+ Description
+appendValue(java.lang.Object value)
+
+
+ Appends an arbitary value to the description.
+
+
+
+
+
+
+
+
+
+
+<T> Description
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
+
+ Appends a list of values to the description.
+
+
+
+
+
+
+
+
+
+
+<T> Description
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
+
+ Appends a list of values to the description.
+
+
+
+ java.lang.String
+toString()
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+Description.NullDescription
+
+public Description.NullDescription()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+appendDescriptionOf
+
+public Description appendDescriptionOf(SelfDescribing value)
+
+
+DescriptionSelfDescribing value to this description.
+
+
+appendDescriptionOf in interface Description
+
+
+
+
+appendList
+
+public Description appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
+
+DescriptionSelfDescribing objects
+ to the description.
+
+
+appendList in interface Description
+
+
+
+
+appendText
+
+public Description appendText(java.lang.String text)
+
+
+Description
+
+appendText in interface Description
+
+
+
+
+appendValue
+
+public Description appendValue(java.lang.Object value)
+
+
+Description
+
+appendValue in interface Description
+
+
+
+
+appendValueList
+
+public <T> Description appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
+
+Description
+
+appendValueList in interface Description
+
+
+
+
+appendValueList
+
+public <T> Description appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
+
+Description
+
+appendValueList in interface Description
+
+
+
+
+toString
+
+public java.lang.String toString()
+
+
+
+
+
+toString in class java.lang.Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/Description.html b/docs/javadoc/1.3/org/hamcrest/Description.html
new file mode 100644
index 00000000..a261a899
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/Description.html
@@ -0,0 +1,412 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Interface Description
+
+
+
+
+
+
+public interface Description
+
+SelfDescribing.describeTo(Description)
+
+
+
+
+
+
+
+
+
+Nested Class Summary
+
+
+
+
+static class
+Description.NullDescription
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+
+
+
+static Description
+NONE
+
+
+ A description that consumes input but does nothing.
+
+
+
+
+
+Method Summary
+
+
+
+
+ Description
+appendDescriptionOf(SelfDescribing value)
+
+
+ Appends the description of a SelfDescribing value to this description.
+
+
+
+ Description
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
+
+ Appends a list of SelfDescribing objects
+ to the description.
+
+
+
+ Description
+appendText(java.lang.String text)
+
+
+ Appends some plain text to the description.
+
+
+
+ Description
+appendValue(java.lang.Object value)
+
+
+ Appends an arbitary value to the description.
+
+
+
+
+
+
+
+
+
+
+<T> Description
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
+
+ Appends a list of values to the description.
+
+
+
+
+
+
+
+
+
+
+<T> Description
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
+
+ Appends a list of values to the description.
+
+
+
+
+
+Field Detail
+
+NONE
+
+static final Description NONE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+appendText
+
+Description appendText(java.lang.String text)
+
+
+
+
+
+
+
+appendDescriptionOf
+
+Description appendDescriptionOf(SelfDescribing value)
+
+
+SelfDescribing value to this description.
+
+
+
+
+
+appendValue
+
+Description appendValue(java.lang.Object value)
+
+
+
+
+
+
+
+appendValueList
+
+<T> Description appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
+
+
+
+
+
+
+appendValueList
+
+<T> Description appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
+
+
+
+
+
+
+appendList
+
+Description appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
+
+
+SelfDescribing objects
+ to the description.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/DiagnosingMatcher.html b/docs/javadoc/1.3/org/hamcrest/DiagnosingMatcher.html
new file mode 100644
index 00000000..a3e89ebe
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/DiagnosingMatcher.html
@@ -0,0 +1,344 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class DiagnosingMatcher<T>
+java.lang.Object
+
+
org.hamcrest.BaseMatcher<T>
+
org.hamcrest.DiagnosingMatcher<T>
+
+
+T -
+
+
+
+
+
+
+
+
+public abstract class DiagnosingMatcher<T>
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+DiagnosingMatcher()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+ void
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
+
+ Generate a description of why the matcher has not accepted the item.
+
+
+
+ boolean
+matches(java.lang.Object item)
+
+
+ Evaluates the matcher for argument item.
+
+
+
+protected abstract boolean
+matches(java.lang.Object item,
+ Description mismatchDescription)
+
+
+
+
+
+
+
+Methods inherited from class org.hamcrest.BaseMatcher
+
+
+
+_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+
+Methods inherited from interface org.hamcrest.SelfDescribing
+
+
+
+describeTo
+
+
+
+
+
+Constructor Detail
+
+DiagnosingMatcher
+
+public DiagnosingMatcher()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+matches
+
+public final boolean matches(java.lang.Object item)
+
+
+Matcher
+
+item - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher
+
+
+describeMismatch
+
+public final void describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
+
+Matchermatches(item) is false, but
+ will not check this.
+
+
+describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>
+
+item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.
+
+
+matches
+
+protected abstract boolean matches(java.lang.Object item,
+ Description mismatchDescription)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/EasyMock2Matchers.html b/docs/javadoc/1.3/org/hamcrest/EasyMock2Matchers.html
new file mode 100644
index 00000000..6c02f5d5
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/EasyMock2Matchers.html
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class EasyMock2Matchers
+java.lang.Object
+
+
org.hamcrest.EasyMock2Matchers
+
+
+
+
+
+public class EasyMock2Matchers
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+EasyMock2Matchers()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+static java.lang.String
+equalTo(java.lang.String string)
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+EasyMock2Matchers
+
+public EasyMock2Matchers()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+equalTo
+
+public static java.lang.String equalTo(java.lang.String string)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/Factory.html b/docs/javadoc/1.3/org/hamcrest/Factory.html
new file mode 100644
index 00000000..5fb6900f
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/Factory.html
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: REQUIRED | OPTIONAL
+
+DETAIL: ELEMENT
+
+
+
+
+org.hamcrest
+
+
+Annotation Type Factory
+
+
+
+
+@Retention(value=RUNTIME)
+@Target(value=METHOD)
+public @interface Factory
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: REQUIRED | OPTIONAL
+
+DETAIL: ELEMENT
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/FeatureMatcher.html b/docs/javadoc/1.3/org/hamcrest/FeatureMatcher.html
new file mode 100644
index 00000000..20078aac
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/FeatureMatcher.html
@@ -0,0 +1,348 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class FeatureMatcher<T,U>
+java.lang.Object
+
+
org.hamcrest.BaseMatcher<T>
+
org.hamcrest.TypeSafeDiagnosingMatcher<T>
+
org.hamcrest.FeatureMatcher<T,U>
+
+
+T - The type of the object to be matchedU - The type of the feature to be matched
+
+
+
+
+
+
+
+
+public abstract class FeatureMatcher<T,U>
featureValueOf()
+ in a subclass to pull out the feature to be matched against.
+
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+FeatureMatcher(Matcher<? super U> subMatcher,
+ java.lang.String featureDescription,
+ java.lang.String featureName)
+
+
+ Constructor
+
+
+
+
+
+Method Summary
+
+
+
+
+ void
+describeTo(Description description)
+
+
+ Generates a description of the object.
+
+
+
+protected abstract U
+featureValueOf(T actual)
+
+
+ Implement this to extract the interesting feature.
+
+
+
+protected boolean
+matchesSafely(T actual,
+ Description mismatch)
+
+
+ Subclasses should implement this.
+
+
+
+
+Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
+
+
+
+describeMismatch, matches
+
+
+
+
+Methods inherited from class org.hamcrest.BaseMatcher
+
+
+
+_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+FeatureMatcher
+
+public FeatureMatcher(Matcher<? super U> subMatcher,
+ java.lang.String featureDescription,
+ java.lang.String featureName)
+
+
+
+
+
+
+
+
+subMatcher - The matcher to apply to the featurefeatureDescription - Descriptive text to use in describeTofeatureName - Identifying text for mismatch message
+
+
+
+
+
+Method Detail
+
+featureValueOf
+
+protected abstract U featureValueOf(T actual)
+
+
+
+
+actual - the target object
+
+
+
+matchesSafely
+
+protected boolean matchesSafely(T actual,
+ Description mismatch)
+
+
+TypeSafeDiagnosingMatcher
+
+matchesSafely in class TypeSafeDiagnosingMatcher<T>
+
+
+
+
+describeTo
+
+public final void describeTo(Description description)
+
+
+
+SelfDescribing
+
+description - The description to be built or appended to.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/JMock1Matchers.html b/docs/javadoc/1.3/org/hamcrest/JMock1Matchers.html
new file mode 100644
index 00000000..5ede24f2
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/JMock1Matchers.html
@@ -0,0 +1,252 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class JMock1Matchers
+java.lang.Object
+
+
org.hamcrest.JMock1Matchers
+
+
+
+
+
+public class JMock1Matchers
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+JMock1Matchers()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+static org.jmock.core.Constraint
+equalTo(java.lang.String string)
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+JMock1Matchers
+
+public JMock1Matchers()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+equalTo
+
+public static org.jmock.core.Constraint equalTo(java.lang.String string)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/JavaLangMatcherAssert.html b/docs/javadoc/1.3/org/hamcrest/JavaLangMatcherAssert.html
new file mode 100644
index 00000000..1e418dd8
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/JavaLangMatcherAssert.html
@@ -0,0 +1,240 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class JavaLangMatcherAssert
+java.lang.Object
+
+
org.hamcrest.JavaLangMatcherAssert
+
+
+
+
+
+public class JavaLangMatcherAssert
assert keyword.
+ Example:
+
+ assert that("Foo", startsWith("f"));
+
+
+
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+static
+
+
+
+
+
+
+<T> boolean
+that(T argument,
+ Matcher<? super T> matcher)
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Method Detail
+
+that
+
+public static <T> boolean that(T argument,
+ Matcher<? super T> matcher)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/Matcher.html b/docs/javadoc/1.3/org/hamcrest/Matcher.html
new file mode 100644
index 00000000..c8c6d8d9
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/Matcher.html
@@ -0,0 +1,310 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Interface Matcher<T>
+
+
+
+
+
+
+
+
+public interface Matcher<T>
BaseMatcher abstract class,
+ which will ensure that the Matcher API can grow to support
+ new features and remain compatible with all Matcher implementations.
+
+ For easy access to common Matcher implementations, use the static factory
+ methods in CoreMatchers.
+
+ N.B. Well designed matchers should be immutable.
+
+
+CoreMatchers,
+BaseMatcher
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+ void
+_dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
+ Deprecated. to make
+
+
+
+ void
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
+
+ Generate a description of why the matcher has not accepted the item.
+
+
+
+ boolean
+matches(java.lang.Object item)
+
+
+ Evaluates the matcher for argument item.
+
+
+
+
+Methods inherited from interface org.hamcrest.SelfDescribing
+
+
+
+describeTo
+
+
+
+
+
+Method Detail
+
+matches
+
+boolean matches(java.lang.Object item)
+
+
+
+
+
+
+item - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher
+
+
+describeMismatch
+
+void describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
+
+matches(item) is false, but
+ will not check this.
+
+
+
+
+item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.
+
+
+_dont_implement_Matcher___instead_extend_BaseMatcher_
+
+@Deprecated
+void _dont_implement_Matcher___instead_extend_BaseMatcher_()
+
+
+
+
+
+
+
+for reasons why.,
+BaseMatcher
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/MatcherAssert.html b/docs/javadoc/1.3/org/hamcrest/MatcherAssert.html
new file mode 100644
index 00000000..0f0874d8
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/MatcherAssert.html
@@ -0,0 +1,312 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class MatcherAssert
+java.lang.Object
+
+
org.hamcrest.MatcherAssert
+
+
+
+
+
+public class MatcherAssert
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+MatcherAssert()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+static void
+assertThat(java.lang.String reason,
+ boolean assertion)
+
+
+
+
+
+
+static
+
+
+
+
+
+
+<T> void
+assertThat(java.lang.String reason,
+ T actual,
+ Matcher<? super T> matcher)
+
+
+
+
+
+
+static
+
+
+
+
+
+
+<T> void
+assertThat(T actual,
+ Matcher<? super T> matcher)
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+MatcherAssert
+
+public MatcherAssert()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+assertThat
+
+public static <T> void assertThat(T actual,
+ Matcher<? super T> matcher)
+
+
+
+
+
+
+
+assertThat
+
+public static <T> void assertThat(java.lang.String reason,
+ T actual,
+ Matcher<? super T> matcher)
+
+
+
+
+
+
+
+assertThat
+
+public static void assertThat(java.lang.String reason,
+ boolean assertion)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
diff --git a/docs/javadoc/1.3/org/hamcrest/Matchers.html b/docs/javadoc/1.3/org/hamcrest/Matchers.html
new file mode 100644
index 00000000..23072ad2
--- /dev/null
+++ b/docs/javadoc/1.3/org/hamcrest/Matchers.html
@@ -0,0 +1,3658 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+ Package
+ Class
+ Use
+ Tree
+ Deprecated
+ Index
+ Help
+
+
+
+
+
+
+ PREV CLASS
+ NEXT CLASS
+
+ FRAMES
+ NO FRAMES
+
+
+
+
+
+
+
+
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD
+
+DETAIL: FIELD | CONSTR | METHOD
+
+
+
+
+org.hamcrest
+
+
+Class Matchers
+java.lang.Object
+
+
org.hamcrest.Matchers
+
+
+
+
+
+public class Matchers
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+Matchers()
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T>... matchers)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+ Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+any(java.lang.Class<T> type)
+
+
+ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<? super T>... matchers)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> AnyOf<T>
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+ Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+
+
+
+static Matcher<java.lang.Object>
+anything()
+
+
+ Creates a matcher that always matches, regardless of the examined object.
+
+
+
+static Matcher<java.lang.Object>
+anything(java.lang.String description)
+
+
+ Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified String.
+
+
+
+static
+
+
+
+
+
+
+<T> IsArray<T>
+array(Matcher<? super T>... elementMatchers)
+
+
+ Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayContaining(E... items)
+
+
+ Creates a matcher for arrays that matcheswhen each item in the examined array is
+ logically equal to the corresponding item in the specified items.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
+
+ Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified list of matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayContaining(Matcher<? super E>... itemMatchers)
+
+
+ Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified collection of matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayContainingInAnyOrder(E... items)
+
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array is logically equal to one item anywhere in the specified items.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayWithSize(int size)
+
+
+ Creates a matcher for arrays that matches when the length of the array
+ equals the specified size.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+ Creates a matcher for arrays that matches when the length of the array
+ satisfies the specified matcher.
+
+
+
+static
+
+
+
+
+
+
+<LHS> CombinableMatcher.CombinableBothMatcher<LHS>
+both(Matcher<? super LHS> matcher)
+
+
+ Creates a matcher that matches when both of the specified matchers match the examined object.
+
+
+
+static Matcher<java.math.BigDecimal>
+closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+
+
+ Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error.
+
+
+
+static Matcher<java.lang.Double>
+closeTo(double operand,
+ double error)
+
+
+ Creates a matcher of Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error.
+
+
+
+static
+
+
+
+
+
+
+<T extends java.lang.Comparable<T>>
+
+Matcher<T>
+comparesEqualTo(T value)
+
+
+ Creates a matcher of Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<? extends E>>
+contains(E... items)
+
+
+ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<? extends E>>
+contains(java.util.List<Matcher<? super E>> itemMatchers)
+
+
+ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<? extends E>>
+contains(Matcher<? super E>... itemMatchers)
+
+
+ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<? extends E>>
+contains(Matcher<? super E> itemMatcher)
+
+
+ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<? extends T>>
+containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<? extends E>>
+containsInAnyOrder(Matcher<? super E> itemMatcher)
+
+
+ Deprecated. use contains(Matcher super E> itemMatcher) instead
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<? extends T>>
+containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<? extends T>>
+containsInAnyOrder(T... items)
+
+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items.
+
+
+
+static Matcher<java.lang.String>
+containsString(java.lang.String substring)
+
+
+ Creates a matcher that matches if the examined String contains the specified
+ String anywhere.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
+
+ Wraps an existing matcher, overriding its description with that specified.
+
+
+
+static
+
+
+
+
+
+
+<LHS> CombinableMatcher.CombinableEitherMatcher<LHS>
+either(Matcher<? super LHS> matcher)
+
+
+ Creates a matcher that matches when either of the specified matchers match the examined object.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.util.Collection<? extends E>>
+empty()
+
+
+ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<E[]>
+emptyArray()
+
+
+ Creates a matcher for arrays that matches when the length of the array
+ is zero.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.util.Collection<E>>
+emptyCollectionOf(java.lang.Class<E> type)
+
+
+ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<? extends E>>
+emptyIterable()
+
+
+ Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<E>>
+emptyIterableOf(java.lang.Class<E> type)
+
+
+ Creates a matcher for Iterables matching examined iterables that yield no items.
+
+
+
+static Matcher<java.lang.String>
+endsWith(java.lang.String suffix)
+
+
+ Creates a matcher that matches if the examined String ends with the specified
+ String.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+equalTo(T operand)
+
+
+ Creates a matcher that matches when the examined object is logically equal to the specified
+ operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.
+
+
+
+static Matcher<java.lang.String>
+equalToIgnoringCase(java.lang.String expectedString)
+
+
+ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+
+
+
+static Matcher<java.lang.String>
+equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
+
+ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored.
+
+
+
+static Matcher<java.util.EventObject>
+eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+
+
+ Creates a matcher of EventObject that matches any object
+ derived from eventClass announced by source.
+
+
+
+static Matcher<java.util.EventObject>
+eventFrom(java.lang.Object source)
+
+
+ Creates a matcher of EventObject that matches any EventObject
+ announced by source.
+
+
+
+static
+
+
+
+
+
+
+<U> Matcher<java.lang.Iterable<U>>
+everyItem(Matcher<U> itemMatcher)
+
+
+ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.
+
+
+
+static
+
+
+
+
+
+
+<T extends java.lang.Comparable<T>>
+
+Matcher<T>
+greaterThan(T value)
+
+
+ Creates a matcher of Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object.
+
+
+
+static
+
+
+
+
+
+
+<T extends java.lang.Comparable<T>>
+
+Matcher<T>
+greaterThanOrEqualTo(T value)
+
+
+ Creates a matcher of Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object.
+
+
+
+static
+
+
+
+
+
+
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+hasEntry(K key,
+ V value)
+
+
+ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value.
+
+
+
+static
+
+
+
+
+
+
+<K,V> Matcher<java.util.Map<? extends K,? extends V>>
+hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
+
+ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<? super T>>
+hasItem(Matcher<? super T> itemMatcher)
+
+
+ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<? super T>>
+hasItem(T item)
+
+
+ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T[]>
+hasItemInArray(Matcher<? super T> elementMatcher)
+
+
+ Creates a matcher for arrays that matches when the examined array contains at least one item
+ that is matched by the specified elementMatcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T[]>
+hasItemInArray(T element)
+
+
+ A shortcut to the frequently used hasItemInArray(equalTo(x)).
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<T>>
+hasItems(Matcher<? super T>... itemMatchers)
+
+
+ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Iterable<T>>
+hasItems(T... items)
+
+
+ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items.
+
+
+
+static
+
+
+
+
+
+
+<K> Matcher<java.util.Map<? extends K,?>>
+hasKey(K key)
+
+
+ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+
+
+
+static
+
+
+
+
+
+
+<K> Matcher<java.util.Map<? extends K,?>>
+hasKey(Matcher<? super K> keyMatcher)
+
+
+ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+hasProperty(java.lang.String propertyName)
+
+
+ Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
+
+ Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name whose value satisfies the specified matcher.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.util.Collection<? extends E>>
+hasSize(int size)
+
+
+ Creates a matcher for Collections that matches when the size() method returns
+ a value equal to the specified size.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.util.Collection<? extends E>>
+hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+ Creates a matcher for Collections that matches when the size() method returns
+ a value that satisfies the specified matcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
+
+ Creates a matcher that matches any examined object whose toString method
+ returns a value that satisfies the specified matcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+hasToString(java.lang.String expectedToString)
+
+
+ Creates a matcher that matches any examined object whose toString method
+ returns a value equalTo the specified string.
+
+
+
+static
+
+
+
+
+
+
+<V> Matcher<java.util.Map<?,? extends V>>
+hasValue(Matcher<? super V> valueMatcher)
+
+
+ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+
+
+
+static
+
+
+
+
+
+
+<V> Matcher<java.util.Map<?,? extends V>>
+hasValue(V value)
+
+
+ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+
+
+
+static Matcher<org.w3c.dom.Node>
+hasXPath(java.lang.String xPath)
+
+
+ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content.
+
+
+
+static Matcher<org.w3c.dom.Node>
+hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+
+
+ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher.
+
+
+
+static Matcher<org.w3c.dom.Node>
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+
+
+ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content.
+
+
+
+static Matcher<org.w3c.dom.Node>
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
+
+ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+instanceOf(java.lang.Class<?> type)
+
+
+ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+is(java.lang.Class<T> type)
+
+
+ Deprecated. use isA(Class
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+is(Matcher<T> matcher)
+
+
+ Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+is(T value)
+
+
+ A shortcut to the frequently used is(equalTo(x)).
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+isA(java.lang.Class<T> type)
+
+
+ A shortcut to the frequently used is(instanceOf(SomeClass.class)).
+
+
+
+static Matcher<java.lang.String>
+isEmptyOrNullString()
+
+
+ Creates a matcher of String that matches when the examined string is null, or
+ has zero length.
+
+
+
+static Matcher<java.lang.String>
+isEmptyString()
+
+
+ Creates a matcher of String that matches when the examined string has zero length.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+isIn(java.util.Collection<T> collection)
+
+
+ Creates a matcher that matches when the examined object is found within the
+ specified collection.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+isIn(T[] param1)
+
+
+
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+isOneOf(T... elements)
+
+
+ Creates a matcher that matches when the examined object is equal to one of the
+ specified elements.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<E>>
+iterableWithSize(int size)
+
+
+ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument.
+
+
+
+static
+
+
+
+
+
+
+<E> Matcher<java.lang.Iterable<E>>
+iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher.
+
+
+
+static
+
+
+
+
+
+
+<T extends java.lang.Comparable<T>>
+
+Matcher<T>
+lessThan(T value)
+
+
+ Creates a matcher of Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object.
+
+
+
+static
+
+
+
+
+
+
+<T extends java.lang.Comparable<T>>
+
+Matcher<T>
+lessThanOrEqualTo(T value)
+
+
+ Creates a matcher of Comparable object that matches when the examined object is
+ less than or equal to the specified value, as reported by the compareTo method
+ of the examined object.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+not(Matcher<T> matcher)
+
+
+ Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+not(T value)
+
+
+ A shortcut to the frequently used not(equalTo(x)).
+
+
+
+static Matcher<java.lang.Object>
+notNullValue()
+
+
+ A shortcut to the frequently used not(nullValue()).
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+notNullValue(java.lang.Class<T> type)
+
+
+ A shortcut to the frequently used not(nullValue(X.class)).
+
+
+
+static Matcher<java.lang.Object>
+nullValue()
+
+
+ Creates a matcher that matches if examined object is null.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+nullValue(java.lang.Class<T> type)
+
+
+ Creates a matcher that matches if examined object is null.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+sameInstance(T target)
+
+
+ Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+samePropertyValuesAs(T expectedBean)
+
+
+ Creates a matcher that matches when the examined object has values for all of
+ its JavaBean properties that are equal to the corresponding values of the
+ specified bean.
+
+
+
+static Matcher<java.lang.String>
+startsWith(java.lang.String prefix)
+
+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
+
+
+static Matcher<java.lang.String>
+stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
+
+ Creates a matcher of String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<T>
+theInstance(T target)
+
+
+ Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+
+
+
+static
+
+
+
+
+
+
+<T> Matcher<java.lang.Class<?>>
+typeCompatibleWith(java.lang.Class<T> baseType)
+
+
+ Creates a matcher of Class that matches when the specified baseType is
+ assignable from the examined class.
+
+
+
+
+Methods inherited from class java.lang.Object
+
+
+
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+Constructor Detail
+
+Matchers
+
+public Matchers()
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+allOf
+
+public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+allOf
+
+public static <T> Matcher<T> allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+anyOf
+
+public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
+
+
+assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
+
+
+
+
+
+both
+
+public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
+
+
+assertThat("fab", both(containsString("a")).and(containsString("b")))
+
+
+
+
+
+either
+
+public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
+
+
+assertThat("fan", either(containsString("a")).and(containsString("b")))
+
+
+
+
+
+describedAs
+
+public static <T> Matcher<T> describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
+
+describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
+
+
+description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised description
+
+
+everyItem
+
+public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)
+
+
+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")))
+
+
+itemMatcher - the matcher to apply to every item provided by the examined Iterable
+
+
+is
+
+public static <T> Matcher<T> is(T value)
+
+
+is(equalTo(x)).
+
+ For example:
+ assertThat(cheese, is(smelly))
+ instead of:
+ assertThat(cheese, is(equalTo(smelly)))
+
+
+
+
+
+is
+
+public static <T> Matcher<T> is(Matcher<T> matcher)
+
+
+assertThat(cheese, is(equalTo(smelly)))
+ instead of:
+ assertThat(cheese, equalTo(smelly))
+
+
+
+
+
+is
+
+public static <T> Matcher<T> is(java.lang.Class<T> type)
+
+
+is(instanceOf(SomeClass.class)).
+
+ For example:
+ assertThat(cheese, is(Cheddar.class))
+ instead of:
+ assertThat(cheese, is(instanceOf(Cheddar.class)))
+
+
+
+
+
+isA
+
+public static <T> Matcher<T> isA(java.lang.Class<T> type)
+
+
+is(instanceOf(SomeClass.class)).
+
+ For example:
+ assertThat(cheese, isA(Cheddar.class))
+ instead of:
+ assertThat(cheese, is(instanceOf(Cheddar.class)))
+
+
+
+
+
+anything
+
+public static Matcher<java.lang.Object> anything()
+
+
+
+
+
+
+
+anything
+
+public static Matcher<java.lang.Object> anything(java.lang.String description)
+
+
+String.
+
+
+description - a meaningful String used when describing itself
+
+
+hasItem
+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)
+
+
+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"))
+
+
+item - the item to compare against the items provided by the examined Iterable
+
+
+hasItem
+
+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)
+
+
+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")))
+
+
+itemMatcher - the matcher to apply to items provided by the examined Iterable
+
+
+hasItems
+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)
+
+
+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"))
+
+
+items - the items to compare against the items provided by the examined Iterable
+
+
+hasItems
+
+public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)
+
+
+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")))
+
+
+itemMatchers - the matchers to apply to items provided by the examined Iterable
+
+
+equalTo
+
+public static <T> Matcher<T> equalTo(T operand)
+
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.
+
+ 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.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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+
+
+
+
+
+
+any
+
+public static <T> Matcher<T> any(java.lang.Class<T> type)
+
+
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+ with(any(Thing.class))assertThat(new Canoe(), instanceOf(Canoe.class));
+
+
+
+
+
+instanceOf
+
+public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
+
+
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.
+
+ assertThat(new Canoe(), instanceOf(Paddlable.class));
+
+
+
+
+
+not
+
+public static <T> Matcher<T> not(Matcher<T> matcher)
+
+
+assertThat(cheese, is(not(equalTo(smelly))))
+
+
+matcher - the matcher whose sense should be inverted
+
+
+not
+
+public static <T> Matcher<T> not(T value)
+
+
+not(equalTo(x)).
+
+ For example:
+ assertThat(cheese, is(not(smelly)))
+ instead of:
+ assertThat(cheese, is(not(equalTo(smelly))))
+
+
+value - the value that any examined object should not equal
+
+
+nullValue
+
+public static Matcher<java.lang.Object> nullValue()
+
+
+null.
+
+ For example:
+ assertThat(cheese, is(nullValue())
+
+
+
+
+
+nullValue
+
+public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
+
+
+null. Accepts a
+ single dummy argument to facilitate type inference.
+
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
+
+
+type - dummy parameter used to infer the generic type of the returned matcher
+
+
+notNullValue
+
+public static Matcher<java.lang.Object> notNullValue()
+
+
+not(nullValue()).
+
+ For example:
+ assertThat(cheese, is(notNullValue()))
+ instead of:
+ assertThat(cheese, is(not(nullValue())))
+
+
+
+
+
+notNullValue
+
+public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
+
+
+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 - dummy parameter used to infer the generic type of the returned matcher
+
+
+sameInstance
+
+public static <T> Matcher<T> sameInstance(T target)
+
+
+
+
+target - the target instance against which others should be assessed
+
+
+theInstance
+
+public static <T> Matcher<T> theInstance(T target)
+
+
+
+
+target - the target instance against which others should be assessed
+
+
+containsString
+
+public static Matcher<java.lang.String> containsString(java.lang.String substring)
+
+
+String contains the specified
+ String anywhere.
+
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))
+
+
+substring - the substring that the returned matcher will expect to find within any examined string
+
+
+startsWith
+
+public static Matcher<java.lang.String> startsWith(java.lang.String prefix)
+
+
+String starts with the specified
+ String.
+
+ For example:
+ assertThat("myStringOfNote", startsWith("my"))
+
+
+prefix - the substring that the returned matcher will expect at the start of any examined string
+
+
+endsWith
+
+public static Matcher<java.lang.String> endsWith(java.lang.String suffix)
+
+
+String ends with the specified
+ String.
+
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))
+
+
+suffix - the substring that the returned matcher will expect at the end of any examined string
+
+
+array
+
+public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)
+
+
+assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
+
+
+elementMatchers - the matchers that the elements of examined arrays should satisfy
+
+
+hasItemInArray
+
+public static <T> Matcher<T[]> hasItemInArray(T element)
+
+
+hasItemInArray(equalTo(x)).
+
+ For example:
+ assertThat(hasItemInArray(x))
+ instead of:
+ assertThat(hasItemInArray(equalTo(x)))
+
+
+element - the element that should be present in examined arrays
+
+
+hasItemInArray
+
+public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
+
+
+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")))
+
+
+elementMatcher - the matcher to apply to elements in examined arrays
+
+
+arrayContaining
+
+public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
+
+assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
+
+
+itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
+
+
+arrayContaining
+
+public static <E> Matcher<E[]> arrayContaining(E... items)
+
+
+assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
+
+
+items - the items that must equal the items within an examined array
+
+
+arrayContaining
+
+public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)
+
+
+assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
+
+
+itemMatchers - the matchers that must be satisfied by the items in the examined array
+
+
+arrayContainingInAnyOrder
+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)
+
+
+assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
+
+
+items - the items that must equal the entries of an examined array, in any order
+
+
+arrayContainingInAnyOrder
+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
+
+assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
+
+
+itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array
+
+
+arrayContainingInAnyOrder
+
+public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
+
+assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
+
+
+itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array
+
+
+arrayWithSize
+
+public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+length of the array
+ satisfies the specified matcher.
+
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
+
+
+sizeMatcher - a matcher for the length of an examined array
+
+
+arrayWithSize
+
+public static <E> Matcher<E[]> arrayWithSize(int size)
+
+
+length of the array
+ equals the specified size.
+
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
+
+
+size - the length that an examined array must have for a positive match
+
+
+emptyArray
+
+public static <E> Matcher<E[]> emptyArray()
+
+
+length of the array
+ is zero.
+
+ For example:
+ assertThat(new String[0], emptyArray())
+
+
+
+
+
+hasSize
+
+public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+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)))
+
+
+sizeMatcher - a matcher for the size of an examined Collection
+
+
+hasSize
+
+public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
+
+
+Collections that matches when the size() method returns
+ a value equal to the specified size.
+
+ For example:
+ assertThat(Arrays.asList("foo", "bar"), hasSize(2))
+
+
+size - the expected size of an examined Collection
+
+
+empty
+
+public static <E> Matcher<java.util.Collection<? extends E>> empty()
+
+
+Collections matching examined collections whose isEmpty
+ method returns true.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(empty()))
+
+
+
+
+
+emptyCollectionOf
+
+public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> type)
+
+
+Collections matching examined collections whose isEmpty
+ method returns true.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
+
+
+type - the type of the collection's content
+
+
+emptyIterable
+
+public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()
+
+
+Iterables matching examined iterables that yield no items.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterable()))
+
+
+
+
+
+emptyIterableOf
+
+public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> type)
+
+
+Iterables matching examined iterables that yield no items.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
+
+
+type - the type of the iterable's content
+
+
+contains
+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)
+
+
+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")))
+
+
+itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
+
+
+contains
+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)
+
+
+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"))
+
+
+items - the items that must equal the items provided by an examined Iterable
+
+
+contains
+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)
+
+
+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")))
+
+
+itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterable
+
+
+contains
+
+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)
+
+
+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"))))
+
+
+itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by
+ an examined Iterable
+
+
+containsInAnyOrder
+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
+
+
+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"))
+
+
+items - the items that must equal the items provided by an examined Iterable in any order
+
+
+containsInAnyOrder
+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+
+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"))))
+
+
+itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
+
+
+containsInAnyOrder
+
+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+
+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")))
+
+
+itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
+
+
+containsInAnyOrder
+
+public static <E> Matcher<java.lang.Iterable<? extends E>> containsInAnyOrder(Matcher<? super E> itemMatcher)
+
+
+Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.
+ For a positive match, the examined iterable must only yield one item.
+
+ For example:
+ assertThat(Arrays.asList("foo"), containsInAnyOrder(equalTo("foo")))
+
+
+itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterable
+
+
+iterableWithSize
+
+public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
+
+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)))
+
+
+sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
+
+
+iterableWithSize
+
+public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
+
+
+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))
+
+
+size - the number of items that should be yielded by an examined Iterable
+
+
+hasEntry
+
+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
+ V value)
+
+
+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"))
+
+
+key - the key that, in combination with the value, must be describe at least one entryvalue - the value that, in combination with the key, must be describe at least one entry
+
+
+hasEntry
+
+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
+
+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")))
+
+
+keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entryvalueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry
+
+
+hasKey
+
+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
+
+
+Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+
+ For example:
+ assertThat(myMap, hasKey(equalTo("bar")))
+
+
+keyMatcher - the matcher that must be satisfied by at least one key
+
+
+hasKey
+
+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
+
+
+Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+
+ For example:
+ assertThat(myMap, hasKey("bar"))
+
+
+key - the key that satisfying maps must contain
+
+
+hasValue
+
+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
+
+
+Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+
+ For example:
+ assertThat(myMap, hasValue("foo"))
+
+
+value - the value that satisfying maps must contain
+
+
+hasValue
+
+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
+
+
+Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+
+ For example:
+ assertThat(myMap, hasValue(equalTo("foo")))
+
+
+valueMatcher - the matcher that must be satisfied by at least one value
+
+
+isIn
+
+public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
+
+
+assertThat("foo", isIn(Arrays.asList("bar", "foo")))
+
+
+collection - the collection in which matching items must be found
+
+
+isIn
+
+public static <T> Matcher<T> isIn(T[] param1)
+
+
+
+
+
+
+
+isOneOf
+
+public static <T> Matcher<T> isOneOf(T... elements)
+
+
+assertThat("foo", isIn("bar", "foo"))
+
+
+elements - the elements amongst which matching items will be found
+
+
+closeTo
+
+public static Matcher<java.lang.Double> closeTo(double operand,
+ double error)
+
+
+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)))
+
+
+operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowed
+
+
+closeTo
+
+public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+
+
+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"))))
+
+
+operand - the expected value of matching BigDecimalserror - the delta (+/-) within which matches will be allowed
+
+
+comparesEqualTo
+
+public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)
+
+
+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))
+
+
+value - the value which, when passed to the compareTo method of the examined object, should return zero
+
+
+greaterThan
+
+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
+
+
+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))
+
+
+value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than zero
+
+
+greaterThanOrEqualTo
+
+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
+
+
+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))
+
+
+value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than or equal to zero
+
+
+lessThan
+
+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
+
+
+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))
+
+
+value - the value which, when passed to the compareTo method of the examined object, should return less
+ than zero
+
+
+lessThanOrEqualTo
+
+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
+
+
+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))
+
+
+value - the value which, when passed to the compareTo method of the examined object, should return less
+ than or equal to zero
+
+
+equalToIgnoringCase
+
+public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)
+
+
+String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+
+ For example:
+ assertThat("Foo", equalToIgnoringCase("FOO"))
+
+
+expectedString - the expected value of matched strings
+
+
+equalToIgnoringWhiteSpace
+
+public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
+
+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:
+
+
+
+ For example:
+ assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))
+
+
+expectedString - the expected value of matched strings
+
+
+isEmptyString
+
+public static Matcher<java.lang.String> isEmptyString()
+
+
+String that matches when the examined string has zero length.
+
+ For example:
+ assertThat("", isEmptyString())
+
+
+
+
+
+isEmptyOrNullString
+
+public static Matcher<java.lang.String> isEmptyOrNullString()
+
+
+String that matches when the examined string is null, or
+ has zero length.
+
+ For example:
+ assertThat(((String)null), isEmptyString())
+
+
+
+
+
+stringContainsInOrder
+
+public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
+
+String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance.
+
+ For example:
+ assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
+
+
+substrings - the substrings that must be contained within matching strings
+
+
+hasToString
+
+public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
+
+toString method
+ returns a value that satisfies the specified matcher.
+
+ For example:
+ assertThat(true, hasToString(equalTo("TRUE")))
+
+
+toStringMatcher - the matcher used to verify the toString result
+
+
+hasToString
+
+public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
+
+
+toString method
+ returns a value equalTo the specified string.
+
+ For example:
+ assertThat(true, hasToString("TRUE"))
+
+
+expectedToString - the expected toString result
+
+
+typeCompatibleWith
+
+public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
+
+
+Class that matches when the specified baseType is
+ assignable from the examined class.
+
+ For example:
+ assertThat(Integer.class, typeCompatibleWith(Number.class))
+
+
+baseType - the base class to examine classes against
+
+
+eventFrom
+
+public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+
+
EventObject that matches any object
+ derived from eventClass announced by source.
+
assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))+
+
eventClass - the class of the event to match onsource - the source of the event+public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)+
EventObject that matches any EventObject
+ announced by source.
+
+ For example:
+ assertThat(myEvent, is(eventFrom(myBean)))+
+
source - the source of the event+public static <T> Matcher<T> hasProperty(java.lang.String propertyName)+
assertThat(myBean, hasProperty("foo"))
++
propertyName - the name of the JavaBean property that examined beans should possess+public static <T> Matcher<T> hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher)+
assertThat(myBean, hasProperty("foo", equalTo("bar"))
++
propertyName - the name of the JavaBean property that examined beans should possessvalueMatcher - a matcher for the value of the specified property of the examined bean+public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)+
assertThat(myBean, samePropertyValuesAs(myExpectedBean))+
+
expectedBean - the bean against which examined beans are compared+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext)+
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))
++
xPath - the target xpathnamespaceContext - the namespace for matching nodes+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)+
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"))
++
xPath - the target xpath+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
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")))
++
xPath - the target xpathnamespaceContext - the namespace for matching nodesvalueMatcher - matcher for the value at the specified xpath+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher)+
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")))
++
xPath - the target xpathvalueMatcher - matcher for the value at the specified xpath
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
public interface SelfDescribing
+The ability of an object to describe itself. +
+ +
+
| +Method Summary | +|
|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
| +Method Detail | +
|---|
+void describeTo(Description description)+
+
description - The description to be built or appended to.
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseDescription +
org.hamcrest.StringDescription +
public class StringDescription
+A Description that is stored as a string.
+
+ +
+
| +Nested Class Summary | +
|---|
| Nested classes/interfaces inherited from interface org.hamcrest.Description | +
|---|
Description.NullDescription |
+
| +Field Summary | +
|---|
| Fields inherited from interface org.hamcrest.Description | +
|---|
NONE |
+
| +Constructor Summary | +|
|---|---|
StringDescription()
+
++ |
+|
StringDescription(java.lang.Appendable out)
+
++ |
+|
| +Method Summary | +|
|---|---|
+protected void |
+append(char c)
+
++ Append the char c to the description. |
+
+protected void |
+append(java.lang.String str)
+
++ Append the String str to the description. |
+
+static java.lang.String |
+asString(SelfDescribing selfDescribing)
+
++ Alias for toString(SelfDescribing). |
+
+ java.lang.String |
+toString()
+
++ Returns the description as a string. |
+
+static java.lang.String |
+toString(SelfDescribing selfDescribing)
+
++ Return the description of a SelfDescribing object as a String. |
+
| Methods inherited from class org.hamcrest.BaseDescription | +
|---|
appendDescriptionOf, appendList, appendText, appendValue, appendValueList, appendValueList |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public StringDescription()+
+public StringDescription(java.lang.Appendable out)+
| +Method Detail | +
|---|
+public static java.lang.String toString(SelfDescribing selfDescribing)+
SelfDescribing object as a String.
++
selfDescribing - The object to be described.
++public static java.lang.String asString(SelfDescribing selfDescribing)+
toString(SelfDescribing).
++
+protected void append(java.lang.String str)+
BaseDescriptionBaseDescription.append(char).
+ Override in subclasses to provide an efficient implementation.
++
append in class BaseDescription+protected void append(char c)+
BaseDescription+
append in class BaseDescription+public java.lang.String toString()+
+
toString in class java.lang.Object
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
T - public abstract class TypeSafeDiagnosingMatcher<T>
+Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. + This implements the null check, checks the type and then casts. + To use, implement
matchesSafely(). +
+ +
+
| +Constructor Summary | +|
|---|---|
+protected |
+TypeSafeDiagnosingMatcher()
+
++ The default constructor for simple sub types |
+
+protected |
+TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)
+
++ Use this constructor if the subclass that implements matchesSafely
+ is not the class that binds <T> to a type. |
+
+protected |
+TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)
+
++ Use this constructor if the subclass that implements matchesSafely
+ is not the class that binds <T> to a type. |
+
| +Method Summary | +|
|---|---|
+ void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
++ Generate a description of why the matcher has not accepted the item. |
+
+ boolean |
+matches(java.lang.Object item)
+
++ Evaluates the matcher for argument item. |
+
+protected abstract boolean |
+matchesSafely(T item,
+ Description mismatchDescription)
+
++ Subclasses should implement this. |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| Methods inherited from interface org.hamcrest.SelfDescribing | +
|---|
describeTo |
+
| +Constructor Detail | +
|---|
+protected TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)+
matchesSafely
+ is not the class that binds <T> to a type.
++
expectedType - The expectedType of the actual value.+protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)+
matchesSafely
+ is not the class that binds <T> to a type.
++
typeFinder - A type finder to extract the type+protected TypeSafeDiagnosingMatcher()+
+
| +Method Detail | +
|---|
+protected abstract boolean matchesSafely(T item, + Description mismatchDescription)+
+
+public final boolean matches(java.lang.Object item)+
Matcher+
item - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public final void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.
++
describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T> +
public abstract class TypeSafeMatcher<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 Summary | +|
|---|---|
+protected |
+TypeSafeMatcher()
+
++ The default constructor for simple sub types |
+
+protected |
+TypeSafeMatcher(java.lang.Class<?> expectedType)
+
++ Use this constructor if the subclass that implements matchesSafely
+ is not the class that binds <T> to a type. |
+
+protected |
+TypeSafeMatcher(ReflectiveTypeFinder typeFinder)
+
++ Use this constructor if the subclass that implements matchesSafely
+ is not the class that binds <T> to a type. |
+
| +Method Summary | +|
|---|---|
+ void |
+describeMismatch(java.lang.Object item,
+ Description description)
+
++ Generate a description of why the matcher has not accepted the item. |
+
+protected void |
+describeMismatchSafely(T item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+
+ boolean |
+matches(java.lang.Object item)
+
++ Methods made final to prevent accidental override. |
+
+protected abstract boolean |
+matchesSafely(T item)
+
++ Subclasses should implement this. |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| Methods inherited from interface org.hamcrest.SelfDescribing | +
|---|
describeTo |
+
| +Constructor Detail | +
|---|
+protected TypeSafeMatcher()+
+
+protected TypeSafeMatcher(java.lang.Class<?> expectedType)+
matchesSafely
+ is not the class that binds <T> to a type.
++
expectedType - The expectedType of the actual value.+protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder)+
matchesSafely
+ is not the class that binds <T> to a type.
++
typeFinder - A type finder to extract the type| +Method Detail | +
|---|
+protected abstract boolean matchesSafely(T item)+
+
+protected void describeMismatchSafely(T item, + Description mismatchDescription)+
+
+public final boolean matches(java.lang.Object item)+
BaseMatcher.
++
item - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public final void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.
++
describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T> +
org.hamcrest.beans.HasProperty<T> +
public class HasProperty<T>
+A Matcher that checks that an object has a JavaBean property + with the specified name. If an error occurs during introspection + of the object then this is treated as a mismatch. +
+ +
+
| +Constructor Summary | +|
|---|---|
HasProperty(java.lang.String propertyName)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeMismatchSafely(T item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+hasProperty(java.lang.String propertyName)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. |
+|
+ boolean |
+matchesSafely(T obj)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public HasProperty(java.lang.String propertyName)+
| +Method Detail | +
|---|
+public boolean matchesSafely(T obj)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<T>+public void describeMismatchSafely(T item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<T>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> hasProperty(java.lang.String propertyName)+
assertThat(myBean, hasProperty("foo"))
++
propertyName - the name of the JavaBean property that examined beans should possess
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.beans.HasPropertyWithValue<T> +
public class HasPropertyWithValue<T>
+Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. This is useful for when objects + are created within code under test and passed to a mock object, and you wish + to assert that the created object has certain properties. +
+
+ public class Person {
+ private String name;
+ public Person(String person) {
+ this.person = person;
+ }
+ public String getName() {
+ return name;
+ }
+ }
+
+ And that these person objects are generated within a piece of code under test
+ (a class named PersonGenerator). This object is sent to one of our mock objects
+ which overrides the PersonGenerationListener interface:
+
+ public interface PersonGenerationListener {
+ public void personGenerated(Person person);
+ }
+
+ In order to check that the code under test generates a person with name
+ "Iain" we would do the following:
+
+ Mock personGenListenerMock = mock(PersonGenerationListener.class);
+ personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain")));
+ PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy();
+
+ If an exception is thrown by the getter method for a property, the property
+ does not exist, is not readable, or a reflection related exception is thrown
+ when trying to invoke it then this is treated as an evaluation failure and
+ the matches method will return false.
+
+ This matcher class will also work with JavaBean objects that have explicit
+ bean descriptions via an associated BeanInfo description class. See the
+ JavaBeans specification for more information:
+
+ http://java.sun.com/products/javabeans/docs/index.html
++ +
+
| +Constructor Summary | +|
|---|---|
HasPropertyWithValue(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. |
+|
+ boolean |
+matchesSafely(T bean,
+ Description mismatch)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public HasPropertyWithValue(java.lang.String propertyName, + Matcher<?> valueMatcher)+
| +Method Detail | +
|---|
+public boolean matchesSafely(T bean, + Description mismatch)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<T>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher)+
assertThat(myBean, hasProperty("foo", equalTo("bar"))
++
propertyName - the name of the JavaBean property that examined beans should possessvalueMatcher - a matcher for the value of the specified property of the examined bean
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.beans.PropertyUtil +
public class PropertyUtil
+Utility class for accessing properties on JavaBean objects. +
+ See http://java.sun.com/products/javabeans/docs/index.html for + more information on JavaBeans. ++ +
+
| +Field Summary | +|
|---|---|
+static java.lang.Object[] |
+NO_ARGUMENTS
+
++ |
+
| +Constructor Summary | +|
|---|---|
PropertyUtil()
+
++ |
+|
| +Method Summary | +|
|---|---|
+static java.beans.PropertyDescriptor |
+getPropertyDescriptor(java.lang.String propertyName,
+ java.lang.Object fromObj)
+
++ Returns the description of the property with the provided + name on the provided object's interface. |
+
+static java.beans.PropertyDescriptor[] |
+propertyDescriptorsFor(java.lang.Object fromObj,
+ java.lang.Class<java.lang.Object> stopClass)
+
++ Returns all the property descriptors for the class associated with the given object |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Field Detail | +
|---|
+public static final java.lang.Object[] NO_ARGUMENTS+
| +Constructor Detail | +
|---|
+public PropertyUtil()+
| +Method Detail | +
|---|
+public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName, + java.lang.Object fromObj) + throws java.lang.IllegalArgumentException+
+
java.lang.IllegalArgumentException - if there's a introspection failure+public static java.beans.PropertyDescriptor[] propertyDescriptorsFor(java.lang.Object fromObj, + java.lang.Class<java.lang.Object> stopClass) + throws java.lang.IllegalArgumentException+
+
fromObj - Use the class of this objectstopClass - Don't include any properties from this ancestor class upwards.
+java.lang.IllegalArgumentException - if there's a introspection failure
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.DiagnosingMatcher<java.lang.Object> +
org.hamcrest.beans.SamePropertyValuesAs.PropertyMatcher +
public static class SamePropertyValuesAs.PropertyMatcher
+
| +Constructor Summary | +|
|---|---|
SamePropertyValuesAs.PropertyMatcher(java.beans.PropertyDescriptor descriptor,
+ java.lang.Object expectedObject)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+ boolean |
+matches(java.lang.Object actual,
+ Description mismatch)
+
++ |
+
| Methods inherited from class org.hamcrest.DiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public SamePropertyValuesAs.PropertyMatcher(java.beans.PropertyDescriptor descriptor, + java.lang.Object expectedObject)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object actual, + Description mismatch)+
matches in class DiagnosingMatcher<java.lang.Object>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.beans.SamePropertyValuesAs<T> +
public class SamePropertyValuesAs<T>
+
| +Nested Class Summary | +|
|---|---|
+static class |
+SamePropertyValuesAs.PropertyMatcher
+
++ |
+
| +Constructor Summary | +|
|---|---|
SamePropertyValuesAs(T expectedBean)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matchesSafely(T bean,
+ Description mismatch)
+
++ Subclasses should implement this. |
+|
+static
+ |
+samePropertyValuesAs(T expectedBean)
+
++ Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. |
+|
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public SamePropertyValuesAs(T expectedBean)+
| +Method Detail | +
|---|
+public boolean matchesSafely(T bean, + Description mismatch)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<T>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)+
assertThat(myBean, samePropertyValuesAs(myExpectedBean))+
+
expectedBean - the bean against which examined beans are compared
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +HasProperty + +HasPropertyWithValue + +PropertyUtil + +SamePropertyValuesAs + +SamePropertyValuesAs.PropertyMatcher |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Class Summary | +|
|---|---|
| HasProperty<T> | +A Matcher that checks that an object has a JavaBean property + with the specified name. | +
| HasPropertyWithValue<T> | +Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. | +
| PropertyUtil | +Utility class for accessing properties on JavaBean objects. | +
| SamePropertyValuesAs<T> | ++ |
| SamePropertyValuesAs.PropertyMatcher | ++ |
+
Matchers of Java Bean properties and their values.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use BaseDescription | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| +Uses of BaseDescription in org.hamcrest | +
|---|
+ +
| Subclasses of BaseDescription in org.hamcrest | +|
|---|---|
+ class |
+StringDescription
+
++ A Description that is stored as a string. |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use BaseMatcher | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
| +Uses of BaseMatcher in org.hamcrest | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest | +|
|---|---|
+ class |
+CustomMatcher<T>
+
++ Utility class for writing one off matchers. |
+
+ class |
+CustomTypeSafeMatcher<T>
+
++ Utility class for writing one off matchers. |
+
+ class |
+DiagnosingMatcher<T>
+
++ TODO(ngd): Document. |
+
+ class |
+FeatureMatcher<T,U>
+
++ Supporting class for matching a feature of an object. |
+
+ class |
+TypeSafeDiagnosingMatcher<T>
+
++ Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+
+ class |
+TypeSafeMatcher<T>
+
++ Convenient base class for Matchers that require a non-null value of a specific type. |
+
| +Uses of BaseMatcher in org.hamcrest.beans | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest.beans | +|
|---|---|
+ class |
+HasProperty<T>
+
++ A Matcher that checks that an object has a JavaBean property + with the specified name. |
+
+ class |
+HasPropertyWithValue<T>
+
++ Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. |
+
+ class |
+SamePropertyValuesAs<T>
+
++ |
+
+static class |
+SamePropertyValuesAs.PropertyMatcher
+
++ |
+
| +Uses of BaseMatcher in org.hamcrest.collection | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest.collection | +|
|---|---|
+ class |
+IsArray<T>
+
++ Matcher for array whose elements satisfy a sequence of matchers. |
+
+ class |
+IsArrayContaining<T>
+
++ Matches if an array contains an item satisfying a nested matcher. |
+
+ class |
+IsArrayContainingInAnyOrder<E>
+
++ |
+
+ class |
+IsArrayContainingInOrder<E>
+
++ |
+
+ class |
+IsArrayWithSize<E>
+
++ Matches if array size satisfies a nested matcher. |
+
+ class |
+IsCollectionWithSize<E>
+
++ Matches if collection size satisfies a nested matcher. |
+
+ class |
+IsEmptyCollection<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsEmptyIterable<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsIn<T>
+
++ |
+
+ class |
+IsIterableContainingInAnyOrder<T>
+
++ |
+
+ class |
+IsIterableContainingInOrder<E>
+
++ |
+
+ class |
+IsIterableWithSize<E>
+
++ |
+
+ class |
+IsMapContaining<K,V>
+
++ |
+
| +Uses of BaseMatcher in org.hamcrest.core | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest.core | +|
|---|---|
+ class |
+AllOf<T>
+
++ Calculates the logical conjunction of multiple matchers. |
+
+ class |
+AnyOf<T>
+
++ Calculates the logical disjunction of multiple matchers. |
+
+ class |
+CombinableMatcher<T>
+
++ |
+
+ class |
+DescribedAs<T>
+
++ Provides a custom description to another matcher. |
+
+ class |
+Every<T>
+
++ |
+
+ class |
+Is<T>
+
++ Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. |
+
+ class |
+IsAnything<T>
+
++ A matcher that always returns true. |
+
+ class |
+IsCollectionContaining<T>
+
++ |
+
+ class |
+IsEqual<T>
+
++ Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod? |
+
+ class |
+IsInstanceOf
+
++ Tests whether the value is an instance of a class. |
+
+ class |
+IsNot<T>
+
++ Calculates the logical negation of a matcher. |
+
+ class |
+IsNull<T>
+
++ Is the value null? |
+
+ class |
+IsSame<T>
+
++ Is the value the same object as another value? |
+
+ class |
+StringContains
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringEndsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringStartsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+SubstringMatcher
+
++ |
+
| +Uses of BaseMatcher in org.hamcrest.number | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest.number | +|
|---|---|
+ class |
+BigDecimalCloseTo
+
++ |
+
+ class |
+IsCloseTo
+
++ Is the value a number equal to a value within some range of + acceptable error? |
+
+ class |
+OrderingComparison<T extends Comparable<T>>
+
++ |
+
| +Uses of BaseMatcher in org.hamcrest.object | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest.object | +|
|---|---|
+ class |
+HasToString<T>
+
++ |
+
+ class |
+IsCompatibleType<T>
+
++ |
+
+ class |
+IsEventFrom
+
++ Tests if the value is an event announced by a specific object. |
+
| +Uses of BaseMatcher in org.hamcrest.text | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest.text | +|
|---|---|
+ class |
+IsEmptyString
+
++ Matches empty Strings (and null). |
+
+ class |
+IsEqualIgnoringCase
+
++ Tests if a string is equal to another string, regardless of the case. |
+
+ class |
+IsEqualIgnoringWhiteSpace
+
++ Tests if a string is equal to another string, ignoring any changes in whitespace. |
+
+ class |
+StringContainsInOrder
+
++ |
+
| +Uses of BaseMatcher in org.hamcrest.xml | +
|---|
+ +
| Subclasses of BaseMatcher in org.hamcrest.xml | +|
|---|---|
+ class |
+HasXPath
+
++ Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression. |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use Condition.Step | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| +Uses of Condition.Step in org.hamcrest | +
|---|
+ +
| Methods in org.hamcrest with parameters of type Condition.Step | +||
|---|---|---|
+abstract
+ |
+Condition.and(Condition.Step<? super T,U> mapping)
+
++ |
+|
+
+ |
+Condition.then(Condition.Step<? super T,U> mapping)
+
++ |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use Condition | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| +Uses of Condition in org.hamcrest | +
|---|
+ +
| Methods in org.hamcrest that return Condition | +||
|---|---|---|
+abstract
+ |
+Condition.and(Condition.Step<? super T,U> mapping)
+
++ |
+|
+ Condition<O> |
+Condition.Step.apply(I value,
+ Description mismatch)
+
++ |
+|
+static
+ |
+Condition.matched(T theValue,
+ Description mismatch)
+
++ |
+|
+static
+ |
+Condition.notMatched()
+
++ |
+|
+
+ |
+Condition.then(Condition.Step<? super T,U> mapping)
+
++ |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use Description | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.internal | ++ |
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
| +Uses of Description in org.hamcrest | +
|---|
+ +
| Classes in org.hamcrest that implement Description | +|
|---|---|
+ class |
+BaseDescription
+
++ A Description that is stored as a string. |
+
+static class |
+Description.NullDescription
+
++ |
+
+ class |
+StringDescription
+
++ A Description that is stored as a string. |
+
+ +
| Fields in org.hamcrest declared as Description | +|
|---|---|
+static Description |
+Description.NONE
+
++ A description that consumes input but does nothing. |
+
+ +
| Methods in org.hamcrest that return Description | +||
|---|---|---|
+ Description |
+Description.appendDescriptionOf(SelfDescribing value)
+
++ Appends the description of a SelfDescribing value to this description. |
+|
+ Description |
+Description.NullDescription.appendDescriptionOf(SelfDescribing value)
+
++ |
+|
+ Description |
+BaseDescription.appendDescriptionOf(SelfDescribing value)
+
++ |
+|
+ Description |
+Description.appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
++ Appends a list of SelfDescribing objects
+ to the description. |
+|
+ Description |
+Description.NullDescription.appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
++ |
+|
+ Description |
+BaseDescription.appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
++ |
+|
+ Description |
+Description.appendText(java.lang.String text)
+
++ Appends some plain text to the description. |
+|
+ Description |
+Description.NullDescription.appendText(java.lang.String text)
+
++ |
+|
+ Description |
+BaseDescription.appendText(java.lang.String text)
+
++ |
+|
+ Description |
+Description.appendValue(java.lang.Object value)
+
++ Appends an arbitary value to the description. |
+|
+ Description |
+Description.NullDescription.appendValue(java.lang.Object value)
+
++ |
+|
+ Description |
+BaseDescription.appendValue(java.lang.Object value)
+
++ |
+|
+
+ |
+Description.appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
++ Appends a list of values to the description. |
+|
+
+ |
+Description.NullDescription.appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
++ |
+|
+
+ |
+BaseDescription.appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+
++ |
+|
+
+ |
+Description.appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
++ Appends a list of values to the description. |
+|
+
+ |
+Description.NullDescription.appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
++ |
+|
+
+ |
+BaseDescription.appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+
++ |
+|
+ +
| Methods in org.hamcrest with parameters of type Description | +||
|---|---|---|
+ Condition<O> |
+Condition.Step.apply(I value,
+ Description mismatch)
+
++ |
+|
+ void |
+TypeSafeMatcher.describeMismatch(java.lang.Object item,
+ Description description)
+
++ |
+|
+ void |
+TypeSafeDiagnosingMatcher.describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
++ |
+|
+ void |
+Matcher.describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
++ Generate a description of why the matcher has not accepted the item. |
+|
+ void |
+DiagnosingMatcher.describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
++ |
+|
+ void |
+BaseMatcher.describeMismatch(java.lang.Object item,
+ Description description)
+
++ |
+|
+protected void |
+TypeSafeMatcher.describeMismatchSafely(T item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+SelfDescribing.describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ void |
+FeatureMatcher.describeTo(Description description)
+
++ |
+|
+ void |
+CustomTypeSafeMatcher.describeTo(Description description)
+
++ |
+|
+ void |
+CustomMatcher.describeTo(Description description)
+
++ |
+|
+static
+ |
+Condition.matched(T theValue,
+ Description mismatch)
+
++ |
+|
+protected abstract boolean |
+DiagnosingMatcher.matches(java.lang.Object item,
+ Description mismatchDescription)
+
++ |
+|
+protected abstract boolean |
+TypeSafeDiagnosingMatcher.matchesSafely(T item,
+ Description mismatchDescription)
+
++ Subclasses should implement this. |
+|
+protected boolean |
+FeatureMatcher.matchesSafely(T actual,
+ Description mismatch)
+
++ |
+|
| +Uses of Description in org.hamcrest.beans | +
|---|
+ +
| Methods in org.hamcrest.beans with parameters of type Description | +|
|---|---|
+ void |
+HasProperty.describeMismatchSafely(T item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+SamePropertyValuesAs.describeTo(Description description)
+
++ |
+
+ void |
+SamePropertyValuesAs.PropertyMatcher.describeTo(Description description)
+
++ |
+
+ void |
+HasPropertyWithValue.describeTo(Description description)
+
++ |
+
+ void |
+HasProperty.describeTo(Description description)
+
++ |
+
+ boolean |
+SamePropertyValuesAs.PropertyMatcher.matches(java.lang.Object actual,
+ Description mismatch)
+
++ |
+
+ boolean |
+SamePropertyValuesAs.matchesSafely(T bean,
+ Description mismatch)
+
++ |
+
+ boolean |
+HasPropertyWithValue.matchesSafely(T bean,
+ Description mismatch)
+
++ |
+
| +Uses of Description in org.hamcrest.collection | +
|---|
+ +
| Methods in org.hamcrest.collection with parameters of type Description | +|
|---|---|
+ void |
+IsEmptyCollection.describeMismatchSafely(java.util.Collection<? extends E> item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsArrayContainingInOrder.describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsArrayContainingInAnyOrder.describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsEmptyIterable.describeMismatchSafely(java.lang.Iterable<? extends E> iter,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsMapContaining.describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsArrayContaining.describeMismatchSafely(T[] item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsArray.describeMismatchSafely(T[] actual,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsMapContaining.describeTo(Description description)
+
++ |
+
+ void |
+IsIterableContainingInOrder.describeTo(Description description)
+
++ |
+
+ void |
+IsIterableContainingInAnyOrder.describeTo(Description description)
+
++ |
+
+ void |
+IsIn.describeTo(Description buffer)
+
++ |
+
+ void |
+IsEmptyIterable.describeTo(Description description)
+
++ |
+
+ void |
+IsEmptyCollection.describeTo(Description description)
+
++ |
+
+ void |
+IsArrayContainingInOrder.describeTo(Description description)
+
++ |
+
+ void |
+IsArrayContainingInAnyOrder.describeTo(Description description)
+
++ |
+
+ void |
+IsArrayContaining.describeTo(Description description)
+
++ |
+
+ void |
+IsArray.describeTo(Description description)
+
++ |
+
+protected boolean |
+IsIterableContainingInOrder.matchesSafely(java.lang.Iterable<? extends E> iterable,
+ Description mismatchDescription)
+
++ |
+
+protected boolean |
+IsIterableContainingInAnyOrder.matchesSafely(java.lang.Iterable<? extends T> items,
+ Description mismatchDescription)
+
++ |
+
| +Uses of Description in org.hamcrest.core | +
|---|
+ +
| Methods in org.hamcrest.core with parameters of type Description | +|
|---|---|
+ void |
+Is.describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+DescribedAs.describeMismatch(java.lang.Object item,
+ Description description)
+
++ |
+
+ void |
+SubstringMatcher.describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+SubstringMatcher.describeTo(Description description)
+
++ |
+
+ void |
+IsSame.describeTo(Description description)
+
++ |
+
+ void |
+IsNull.describeTo(Description description)
+
++ |
+
+ void |
+IsNot.describeTo(Description description)
+
++ |
+
+ void |
+IsInstanceOf.describeTo(Description description)
+
++ |
+
+ void |
+IsEqual.describeTo(Description description)
+
++ |
+
+ void |
+IsCollectionContaining.describeTo(Description description)
+
++ |
+
+ void |
+IsAnything.describeTo(Description description)
+
++ |
+
+ void |
+Is.describeTo(Description description)
+
++ |
+
+ void |
+Every.describeTo(Description description)
+
++ |
+
+ void |
+DescribedAs.describeTo(Description description)
+
++ |
+
+ void |
+CombinableMatcher.describeTo(Description description)
+
++ |
+
+ void |
+AnyOf.describeTo(Description description)
+
++ |
+
+ void |
+AllOf.describeTo(Description description)
+
++ |
+
+protected boolean |
+IsInstanceOf.matches(java.lang.Object item,
+ Description mismatch)
+
++ |
+
+ boolean |
+AllOf.matches(java.lang.Object o,
+ Description mismatch)
+
++ |
+
+protected boolean |
+IsCollectionContaining.matchesSafely(java.lang.Iterable<? super T> collection,
+ Description mismatchDescription)
+
++ |
+
+ boolean |
+Every.matchesSafely(java.lang.Iterable<T> collection,
+ Description mismatchDescription)
+
++ |
+
+protected boolean |
+CombinableMatcher.matchesSafely(T item,
+ Description mismatch)
+
++ |
+
| +Uses of Description in org.hamcrest.internal | +
|---|
+ +
| Methods in org.hamcrest.internal with parameters of type Description | +|
|---|---|
+ void |
+SelfDescribingValue.describeTo(Description description)
+
++ |
+
| +Uses of Description in org.hamcrest.number | +
|---|
+ +
| Methods in org.hamcrest.number with parameters of type Description | +|
|---|---|
+ void |
+BigDecimalCloseTo.describeMismatchSafely(java.math.BigDecimal item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsCloseTo.describeMismatchSafely(java.lang.Double item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+OrderingComparison.describeMismatchSafely(T actual,
+ Description mismatchDescription)
+
++ |
+
+ void |
+OrderingComparison.describeTo(Description description)
+
++ |
+
+ void |
+IsCloseTo.describeTo(Description description)
+
++ |
+
+ void |
+BigDecimalCloseTo.describeTo(Description description)
+
++ |
+
| +Uses of Description in org.hamcrest.object | +
|---|
+ +
| Methods in org.hamcrest.object with parameters of type Description | +|
|---|---|
+ void |
+IsCompatibleType.describeMismatchSafely(java.lang.Class<?> cls,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsEventFrom.describeTo(Description description)
+
++ |
+
+ void |
+IsCompatibleType.describeTo(Description description)
+
++ |
+
+ boolean |
+IsEventFrom.matchesSafely(java.util.EventObject item,
+ Description mismatchDescription)
+
++ |
+
| +Uses of Description in org.hamcrest.text | +
|---|
+ +
| Methods in org.hamcrest.text with parameters of type Description | +|
|---|---|
+ void |
+StringContainsInOrder.describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsEqualIgnoringWhiteSpace.describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+IsEqualIgnoringCase.describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ |
+
+ void |
+StringContainsInOrder.describeTo(Description description)
+
++ |
+
+ void |
+IsEqualIgnoringWhiteSpace.describeTo(Description description)
+
++ |
+
+ void |
+IsEqualIgnoringCase.describeTo(Description description)
+
++ |
+
+ void |
+IsEmptyString.describeTo(Description description)
+
++ |
+
| +Uses of Description in org.hamcrest.xml | +
|---|
+ +
| Methods in org.hamcrest.xml with parameters of type Description | +|
|---|---|
+ void |
+HasXPath.describeTo(Description description)
+
++ |
+
+ boolean |
+HasXPath.matchesSafely(org.w3c.dom.Node item,
+ Description mismatch)
+
++ |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use DiagnosingMatcher | +|
|---|---|
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| +Uses of DiagnosingMatcher in org.hamcrest.beans | +
|---|
+ +
| Subclasses of DiagnosingMatcher in org.hamcrest.beans | +|
|---|---|
+static class |
+SamePropertyValuesAs.PropertyMatcher
+
++ |
+
| +Uses of DiagnosingMatcher in org.hamcrest.core | +
|---|
+ +
| Subclasses of DiagnosingMatcher in org.hamcrest.core | +|
|---|---|
+ class |
+AllOf<T>
+
++ Calculates the logical conjunction of multiple matchers. |
+
+ class |
+IsInstanceOf
+
++ Tests whether the value is an instance of a class. |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use Factory | +|
|---|---|
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
| +Uses of Factory in org.hamcrest.beans | +
|---|
+ +
| Methods in org.hamcrest.beans with annotations of type Factory | +||
|---|---|---|
+static
+ |
+HasProperty.hasProperty(java.lang.String propertyName)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. |
+|
+static
+ |
+HasPropertyWithValue.hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. |
+|
+static
+ |
+SamePropertyValuesAs.samePropertyValuesAs(T expectedBean)
+
++ Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. |
+|
| +Uses of Factory in org.hamcrest.collection | +
|---|
+ +
| Methods in org.hamcrest.collection with annotations of type Factory | +||
|---|---|---|
+static
+ |
+IsArray.array(Matcher<? super T>... elementMatchers)
+
++ Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. |
+|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(E... items)
+
++ Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items. |
+|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. |
+|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(E... items)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array is logically equal to one item anywhere in the specified items. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers. |
+|
+static
+ |
+IsArrayWithSize.arrayWithSize(int size)
+
++ Creates a matcher for arrays that matches when the length of the array
+ equals the specified size. |
+|
+static
+ |
+IsArrayWithSize.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for arrays that matches when the length of the array
+ satisfies the specified matcher. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(E... items)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super E> itemMatcher)
+
++ Deprecated. use contains(Matcher super E> itemMatcher) instead |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(T... items)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. |
+|
+static
+ |
+IsEmptyCollection.empty()
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+static
+ |
+IsArrayWithSize.emptyArray()
+
++ Creates a matcher for arrays that matches when the length of the array
+ is zero. |
+|
+static
+ |
+IsEmptyCollection.emptyCollectionOf(java.lang.Class<E> type)
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+static
+ |
+IsEmptyIterable.emptyIterable()
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+static
+ |
+IsEmptyIterable.emptyIterableOf(java.lang.Class<E> type)
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+static
+ |
+IsMapContaining.hasEntry(K key,
+ V value)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value. |
+|
+static
+ |
+IsMapContaining.hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+|
+static
+ |
+IsArrayContaining.hasItemInArray(Matcher<? super T> elementMatcher)
+
++ Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher. |
+|
+static
+ |
+IsArrayContaining.hasItemInArray(T element)
+
++ A shortcut to the frequently used hasItemInArray(equalTo(x)). |
+|
+static
+ |
+IsMapContaining.hasKey(K key)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that is equal to the specified key. |
+|
+static
+ |
+IsMapContaining.hasKey(Matcher<? super K> keyMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+|
+static
+ |
+IsCollectionWithSize.hasSize(int size)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value equal to the specified size. |
+|
+static
+ |
+IsCollectionWithSize.hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+|
+static
+ |
+IsMapContaining.hasValue(Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+|
+static
+ |
+IsMapContaining.hasValue(V value)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that is equal to the specified value. |
+|
+static
+ |
+IsIn.isIn(java.util.Collection<T> collection)
+
++ Creates a matcher that matches when the examined object is found within the + specified collection. |
+|
+static
+ |
+IsIn.isIn(T[] elements)
+
++ Creates a matcher that matches when the examined object is found within the + specified array. |
+|
+static
+ |
+IsIn.isOneOf(T... elements)
+
++ Creates a matcher that matches when the examined object is equal to one of the + specified elements. |
+|
+static
+ |
+IsIterableWithSize.iterableWithSize(int size)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument. |
+|
+static
+ |
+IsIterableWithSize.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+|
| +Uses of Factory in org.hamcrest.core | +
|---|
+ +
| Methods in org.hamcrest.core with annotations of type Factory | +||
|---|---|---|
+static
+ |
+AllOf.allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+IsInstanceOf.any(java.lang.Class<T> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static
+ |
+AnyOf.anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static Matcher<java.lang.Object> |
+IsAnything.anything()
+
++ Creates a matcher that always matches, regardless of the examined object. |
+|
+static Matcher<java.lang.Object> |
+IsAnything.anything(java.lang.String description)
+
++ Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. |
+|
+static
+ |
+CombinableMatcher.both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
+static Matcher<java.lang.String> |
+StringContains.containsString(java.lang.String substring)
+
++ Creates a matcher that matches if the examined String contains the specified
+ String anywhere. |
+|
+static
+ |
+DescribedAs.describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+static
+ |
+CombinableMatcher.either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
+static Matcher<java.lang.String> |
+StringEndsWith.endsWith(java.lang.String suffix)
+
++ Creates a matcher that matches if the examined String ends with the specified
+ String. |
+|
+static
+ |
+IsEqual.equalTo(T operand)
+
++ Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+|
+static
+ |
+Every.everyItem(Matcher<U> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+|
+static
+ |
+IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+|
+static
+ |
+IsCollectionContaining.hasItem(T item)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+|
+static
+ |
+IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+|
+static
+ |
+IsCollectionContaining.hasItems(T... items)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+|
+static
+ |
+IsInstanceOf.instanceOf(java.lang.Class<?> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static
+ |
+Is.is(java.lang.Class<T> type)
+
++ Deprecated. use isA(Class |
+|
+static
+ |
+Is.is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+Is.is(T value)
+
++ A shortcut to the frequently used is(equalTo(x)). |
+|
+static
+ |
+Is.isA(java.lang.Class<T> type)
+
++ A shortcut to the frequently used is(instanceOf(SomeClass.class)). |
+|
+static
+ |
+IsNot.not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+static
+ |
+IsNot.not(T value)
+
++ A shortcut to the frequently used not(equalTo(x)). |
+|
+static Matcher<java.lang.Object> |
+IsNull.notNullValue()
+
++ A shortcut to the frequently used not(nullValue()). |
+|
+static
+ |
+IsNull.notNullValue(java.lang.Class<T> type)
+
++ A shortcut to the frequently used not(nullValue(X.class)). |
+|
+static Matcher<java.lang.Object> |
+IsNull.nullValue()
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+IsNull.nullValue(java.lang.Class<T> type)
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+IsSame.sameInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+static Matcher<java.lang.String> |
+StringStartsWith.startsWith(java.lang.String prefix)
+
++ Creates a matcher that matches if the examined String starts with the specified
+ String. |
+|
+static
+ |
+IsSame.theInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
| +Uses of Factory in org.hamcrest.number | +
|---|
+ +
| Methods in org.hamcrest.number with annotations of type Factory | +||
|---|---|---|
+static Matcher<java.math.BigDecimal> |
+BigDecimalCloseTo.closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+
++ Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+|
+static Matcher<java.lang.Double> |
+IsCloseTo.closeTo(double operand,
+ double error)
+
++ Creates a matcher of Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+|
+static
+ |
+OrderingComparison.comparesEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+OrderingComparison.greaterThan(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+OrderingComparison.greaterThanOrEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+|
+static
+ |
+OrderingComparison.lessThan(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+OrderingComparison.lessThanOrEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ less than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+|
| +Uses of Factory in org.hamcrest.object | +
|---|
+ +
| Methods in org.hamcrest.object with annotations of type Factory | +||
|---|---|---|
+static Matcher<java.util.EventObject> |
+IsEventFrom.eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any object
+ derived from eventClass announced by source. |
+|
+static Matcher<java.util.EventObject> |
+IsEventFrom.eventFrom(java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any EventObject
+ announced by source. |
+|
+static
+ |
+HasToString.hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value that satisfies the specified matcher. |
+|
+static
+ |
+HasToString.hasToString(java.lang.String expectedToString)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value equalTo the specified string. |
+|
+static
+ |
+IsCompatibleType.typeCompatibleWith(java.lang.Class<T> baseType)
+
++ Creates a matcher of Class that matches when the specified baseType is
+ assignable from the examined class. |
+|
| +Uses of Factory in org.hamcrest.text | +
|---|
+ +
| Methods in org.hamcrest.text with annotations of type Factory | +|
|---|---|
+static Matcher<java.lang.String> |
+IsEqualIgnoringCase.equalToIgnoringCase(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+
+static Matcher<java.lang.String> |
+IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+
+static Matcher<java.lang.String> |
+IsEmptyString.isEmptyOrNullString()
+
++ Creates a matcher of String that matches when the examined string is null, or
+ has zero length. |
+
+static Matcher<java.lang.String> |
+IsEmptyString.isEmptyString()
+
++ Creates a matcher of String that matches when the examined string has zero length. |
+
+static Matcher<java.lang.String> |
+StringContainsInOrder.stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
++ Creates a matcher of String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance. |
+
| +Uses of Factory in org.hamcrest.xml | +
|---|
+ +
| Methods in org.hamcrest.xml with annotations of type Factory | +|
|---|---|
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use FeatureMatcher | +|
|---|---|
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| +Uses of FeatureMatcher in org.hamcrest.collection | +
|---|
+ +
| Subclasses of FeatureMatcher in org.hamcrest.collection | +|
|---|---|
+ class |
+IsArrayWithSize<E>
+
++ Matches if array size satisfies a nested matcher. |
+
+ class |
+IsCollectionWithSize<E>
+
++ Matches if collection size satisfies a nested matcher. |
+
+ class |
+IsIterableWithSize<E>
+
++ |
+
| +Uses of FeatureMatcher in org.hamcrest.object | +
|---|
+ +
| Subclasses of FeatureMatcher in org.hamcrest.object | +|
|---|---|
+ class |
+HasToString<T>
+
++ |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use Matcher | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.integration | ++ |
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
| +Uses of Matcher in org.hamcrest | +
|---|
+ +
| Classes in org.hamcrest that implement Matcher | +|
|---|---|
+ class |
+BaseMatcher<T>
+
++ BaseClass for all Matcher implementations. |
+
+ class |
+CustomMatcher<T>
+
++ Utility class for writing one off matchers. |
+
+ class |
+CustomTypeSafeMatcher<T>
+
++ Utility class for writing one off matchers. |
+
+ class |
+DiagnosingMatcher<T>
+
++ TODO(ngd): Document. |
+
+ class |
+FeatureMatcher<T,U>
+
++ Supporting class for matching a feature of an object. |
+
+ class |
+TypeSafeDiagnosingMatcher<T>
+
++ Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+
+ class |
+TypeSafeMatcher<T>
+
++ Convenient base class for Matchers that require a non-null value of a specific type. |
+
+ +
| Methods in org.hamcrest that return Matcher | +||
|---|---|---|
+static
+ |
+Matchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.any(java.lang.Class<T> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static
+ |
+CoreMatchers.any(java.lang.Class<T> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static Matcher<java.lang.Object> |
+Matchers.anything()
+
++ Creates a matcher that always matches, regardless of the examined object. |
+|
+static Matcher<java.lang.Object> |
+CoreMatchers.anything()
+
++ Creates a matcher that always matches, regardless of the examined object. |
+|
+static Matcher<java.lang.Object> |
+Matchers.anything(java.lang.String description)
+
++ Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. |
+|
+static Matcher<java.lang.Object> |
+CoreMatchers.anything(java.lang.String description)
+
++ Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. |
+|
+static
+ |
+Matchers.arrayContaining(E... items)
+
++ Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items. |
+|
+static
+ |
+Matchers.arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. |
+|
+static
+ |
+Matchers.arrayContaining(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers. |
+|
+static
+ |
+Matchers.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. |
+|
+static
+ |
+Matchers.arrayContainingInAnyOrder(E... items)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array is logically equal to one item anywhere in the specified items. |
+|
+static
+ |
+Matchers.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers. |
+|
+static
+ |
+Matchers.arrayWithSize(int size)
+
++ Creates a matcher for arrays that matches when the length of the array
+ equals the specified size. |
+|
+static
+ |
+Matchers.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for arrays that matches when the length of the array
+ satisfies the specified matcher. |
+|
+static Matcher<java.math.BigDecimal> |
+Matchers.closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+
++ Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+|
+static Matcher<java.lang.Double> |
+Matchers.closeTo(double operand,
+ double error)
+
++ Creates a matcher of Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+|
+static
+ |
+Matchers.comparesEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+Matchers.contains(E... items)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items. |
+|
+static
+ |
+Matchers.contains(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+|
+static
+ |
+Matchers.contains(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+|
+static
+ |
+Matchers.contains(Matcher<? super E> itemMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+|
+static
+ |
+Matchers.containsInAnyOrder(Matcher<? super E> itemMatcher)
+
++ Deprecated. use contains(Matcher super E> itemMatcher) instead |
+|
+static
+ |
+Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+|
+static
+ |
+Matchers.containsInAnyOrder(T... items)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. |
+|
+static Matcher<java.lang.String> |
+Matchers.containsString(java.lang.String substring)
+
++ Creates a matcher that matches if the examined String contains the specified
+ String anywhere. |
+|
+static Matcher<java.lang.String> |
+CoreMatchers.containsString(java.lang.String substring)
+
++ Creates a matcher that matches if the examined String contains the specified
+ String anywhere. |
+|
+static
+ |
+Matchers.describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+static
+ |
+CoreMatchers.describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+static
+ |
+Matchers.empty()
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+static
+ |
+Matchers.emptyArray()
+
++ Creates a matcher for arrays that matches when the length of the array
+ is zero. |
+|
+static
+ |
+Matchers.emptyCollectionOf(java.lang.Class<E> type)
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+static
+ |
+Matchers.emptyIterable()
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+static
+ |
+Matchers.emptyIterableOf(java.lang.Class<E> type)
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+static Matcher<java.lang.String> |
+Matchers.endsWith(java.lang.String suffix)
+
++ Creates a matcher that matches if the examined String ends with the specified
+ String. |
+|
+static Matcher<java.lang.String> |
+CoreMatchers.endsWith(java.lang.String suffix)
+
++ Creates a matcher that matches if the examined String ends with the specified
+ String. |
+|
+static
+ |
+Matchers.equalTo(T operand)
+
++ Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+|
+static
+ |
+CoreMatchers.equalTo(T operand)
+
++ Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+|
+static Matcher<java.lang.String> |
+Matchers.equalToIgnoringCase(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+|
+static Matcher<java.lang.String> |
+Matchers.equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+|
+static Matcher<java.util.EventObject> |
+Matchers.eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any object
+ derived from eventClass announced by source. |
+|
+static Matcher<java.util.EventObject> |
+Matchers.eventFrom(java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any EventObject
+ announced by source. |
+|
+static
+ |
+Matchers.everyItem(Matcher<U> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+|
+static
+ |
+CoreMatchers.everyItem(Matcher<U> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+|
+static
+ |
+Matchers.greaterThan(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+Matchers.greaterThanOrEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+|
+static
+ |
+Matchers.hasEntry(K key,
+ V value)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value. |
+|
+static
+ |
+Matchers.hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+|
+static
+ |
+Matchers.hasItem(Matcher<? super T> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+|
+static
+ |
+CoreMatchers.hasItem(Matcher<? super T> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+|
+static
+ |
+Matchers.hasItem(T item)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+|
+static
+ |
+CoreMatchers.hasItem(T item)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+|
+static
+ |
+Matchers.hasItemInArray(Matcher<? super T> elementMatcher)
+
++ Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher. |
+|
+static
+ |
+Matchers.hasItemInArray(T element)
+
++ A shortcut to the frequently used hasItemInArray(equalTo(x)). |
+|
+static
+ |
+Matchers.hasItems(Matcher<? super T>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+|
+static
+ |
+CoreMatchers.hasItems(Matcher<? super T>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+|
+static
+ |
+Matchers.hasItems(T... items)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+|
+static
+ |
+CoreMatchers.hasItems(T... items)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+|
+static
+ |
+Matchers.hasKey(K key)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that is equal to the specified key. |
+|
+static
+ |
+Matchers.hasKey(Matcher<? super K> keyMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasProperty(java.lang.String propertyName)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. |
+|
+static
+ |
+Matchers.hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasSize(int size)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value equal to the specified size. |
+|
+static
+ |
+Matchers.hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasToString(java.lang.String expectedToString)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value equalTo the specified string. |
+|
+static
+ |
+Matchers.hasValue(Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+|
+static
+ |
+Matchers.hasValue(V value)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that is equal to the specified value. |
+|
+static Matcher<org.w3c.dom.Node> |
+Matchers.hasXPath(java.lang.String xPath)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+|
+static Matcher<org.w3c.dom.Node> |
+Matchers.hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+|
+static Matcher<org.w3c.dom.Node> |
+Matchers.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+|
+static Matcher<org.w3c.dom.Node> |
+Matchers.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+|
+static
+ |
+Matchers.instanceOf(java.lang.Class<?> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static
+ |
+CoreMatchers.instanceOf(java.lang.Class<?> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static
+ |
+Matchers.is(java.lang.Class<T> type)
+
++ Deprecated. use isA(Class |
+|
+static
+ |
+CoreMatchers.is(java.lang.Class<T> type)
+
++ Deprecated. use isA(Class |
+|
+static
+ |
+Matchers.is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+CoreMatchers.is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+Matchers.is(T value)
+
++ A shortcut to the frequently used is(equalTo(x)). |
+|
+static
+ |
+CoreMatchers.is(T value)
+
++ A shortcut to the frequently used is(equalTo(x)). |
+|
+static
+ |
+Matchers.isA(java.lang.Class<T> type)
+
++ A shortcut to the frequently used is(instanceOf(SomeClass.class)). |
+|
+static
+ |
+CoreMatchers.isA(java.lang.Class<T> type)
+
++ A shortcut to the frequently used is(instanceOf(SomeClass.class)). |
+|
+static Matcher<java.lang.String> |
+Matchers.isEmptyOrNullString()
+
++ Creates a matcher of String that matches when the examined string is null, or
+ has zero length. |
+|
+static Matcher<java.lang.String> |
+Matchers.isEmptyString()
+
++ Creates a matcher of String that matches when the examined string has zero length. |
+|
+static
+ |
+Matchers.isIn(java.util.Collection<T> collection)
+
++ Creates a matcher that matches when the examined object is found within the + specified collection. |
+|
+static
+ |
+Matchers.isIn(T[] param1)
+
++ |
+|
+static
+ |
+Matchers.isOneOf(T... elements)
+
++ Creates a matcher that matches when the examined object is equal to one of the + specified elements. |
+|
+static
+ |
+Matchers.iterableWithSize(int size)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument. |
+|
+static
+ |
+Matchers.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+|
+static
+ |
+Matchers.lessThan(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+Matchers.lessThanOrEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ less than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+|
+static
+ |
+Matchers.not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+static
+ |
+CoreMatchers.not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+static
+ |
+Matchers.not(T value)
+
++ A shortcut to the frequently used not(equalTo(x)). |
+|
+static
+ |
+CoreMatchers.not(T value)
+
++ A shortcut to the frequently used not(equalTo(x)). |
+|
+static Matcher<java.lang.Object> |
+Matchers.notNullValue()
+
++ A shortcut to the frequently used not(nullValue()). |
+|
+static Matcher<java.lang.Object> |
+CoreMatchers.notNullValue()
+
++ A shortcut to the frequently used not(nullValue()). |
+|
+static
+ |
+Matchers.notNullValue(java.lang.Class<T> type)
+
++ A shortcut to the frequently used not(nullValue(X.class)). |
+|
+static
+ |
+CoreMatchers.notNullValue(java.lang.Class<T> type)
+
++ A shortcut to the frequently used not(nullValue(X.class)). |
+|
+static Matcher<java.lang.Object> |
+Matchers.nullValue()
+
++ Creates a matcher that matches if examined object is null. |
+|
+static Matcher<java.lang.Object> |
+CoreMatchers.nullValue()
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+Matchers.nullValue(java.lang.Class<T> type)
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+CoreMatchers.nullValue(java.lang.Class<T> type)
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+Matchers.sameInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+static
+ |
+CoreMatchers.sameInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+static
+ |
+Matchers.samePropertyValuesAs(T expectedBean)
+
++ Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. |
+|
+static Matcher<java.lang.String> |
+Matchers.startsWith(java.lang.String prefix)
+
++ Creates a matcher that matches if the examined String starts with the specified
+ String. |
+|
+static Matcher<java.lang.String> |
+CoreMatchers.startsWith(java.lang.String prefix)
+
++ Creates a matcher that matches if the examined String starts with the specified
+ String. |
+|
+static Matcher<java.lang.String> |
+Matchers.stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
++ Creates a matcher of String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance. |
+|
+static
+ |
+Matchers.theInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+static
+ |
+CoreMatchers.theInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+static
+ |
+Matchers.typeCompatibleWith(java.lang.Class<T> baseType)
+
++ Creates a matcher of Class that matches when the specified baseType is
+ assignable from the examined class. |
+|
+ +
| Methods in org.hamcrest with parameters of type Matcher | +||
|---|---|---|
+static
+ |
+Matchers.allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.array(Matcher<? super T>... elementMatchers)
+
++ Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. |
+|
+static
+ |
+Matchers.arrayContaining(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers. |
+|
+static
+ |
+Matchers.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers. |
+|
+static
+ |
+Matchers.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for arrays that matches when the length of the array
+ satisfies the specified matcher. |
+|
+static
+ |
+MatcherAssert.assertThat(java.lang.String reason,
+ T actual,
+ Matcher<? super T> matcher)
+
++ |
+|
+static
+ |
+MatcherAssert.assertThat(T actual,
+ Matcher<? super T> matcher)
+
++ |
+|
+static
+ |
+Matchers.both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
+static
+ |
+CoreMatchers.both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
+static
+ |
+Matchers.contains(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+|
+static
+ |
+Matchers.contains(Matcher<? super E> itemMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.containsInAnyOrder(Matcher<? super E> itemMatcher)
+
++ Deprecated. use contains(Matcher super E> itemMatcher) instead |
+|
+static
+ |
+Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+|
+static
+ |
+Matchers.describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+static
+ |
+CoreMatchers.describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+static
+ |
+Matchers.either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
+static
+ |
+CoreMatchers.either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
+static
+ |
+Matchers.everyItem(Matcher<U> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+|
+static
+ |
+CoreMatchers.everyItem(Matcher<U> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+|
+static
+ |
+Matchers.hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+|
+static
+ |
+Matchers.hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+|
+static
+ |
+Matchers.hasItem(Matcher<? super T> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+|
+static
+ |
+CoreMatchers.hasItem(Matcher<? super T> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+|
+static
+ |
+Matchers.hasItemInArray(Matcher<? super T> elementMatcher)
+
++ Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher. |
+|
+static
+ |
+Matchers.hasItems(Matcher<? super T>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+|
+static
+ |
+CoreMatchers.hasItems(Matcher<? super T>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+|
+static
+ |
+Matchers.hasKey(Matcher<? super K> keyMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value that satisfies the specified matcher. |
+|
+static
+ |
+Matchers.hasValue(Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+|
+static Matcher<org.w3c.dom.Node> |
+Matchers.hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+|
+static Matcher<org.w3c.dom.Node> |
+Matchers.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+|
+static
+ |
+Matchers.is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+CoreMatchers.is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+Matchers.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+|
+ boolean |
+Condition.matching(Matcher<T> match)
+
++ |
+|
+abstract boolean |
+Condition.matching(Matcher<T> match,
+ java.lang.String message)
+
++ |
+|
+static
+ |
+Matchers.not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+static
+ |
+CoreMatchers.not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+static
+ |
+JavaLangMatcherAssert.that(T argument,
+ Matcher<? super T> matcher)
+
++ |
+|
+ +
| Method parameters in org.hamcrest with type arguments of type Matcher | +||
|---|---|---|
+static
+ |
+Matchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+CoreMatchers.allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. |
+|
+static
+ |
+Matchers.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. |
+|
+static
+ |
+Matchers.contains(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+|
+static
+ |
+Matchers.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+|
+ +
| Constructors in org.hamcrest with parameters of type Matcher | +|
|---|---|
FeatureMatcher(Matcher<? super U> subMatcher,
+ java.lang.String featureDescription,
+ java.lang.String featureName)
+
++ Constructor |
+|
| +Uses of Matcher in org.hamcrest.beans | +
|---|
+ +
| Classes in org.hamcrest.beans that implement Matcher | +|
|---|---|
+ class |
+HasProperty<T>
+
++ A Matcher that checks that an object has a JavaBean property + with the specified name. |
+
+ class |
+HasPropertyWithValue<T>
+
++ Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. |
+
+ class |
+SamePropertyValuesAs<T>
+
++ |
+
+static class |
+SamePropertyValuesAs.PropertyMatcher
+
++ |
+
+ +
| Methods in org.hamcrest.beans that return Matcher | +||
|---|---|---|
+static
+ |
+HasProperty.hasProperty(java.lang.String propertyName)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name. |
+|
+static
+ |
+HasPropertyWithValue.hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. |
+|
+static
+ |
+SamePropertyValuesAs.samePropertyValuesAs(T expectedBean)
+
++ Creates a matcher that matches when the examined object has values for all of + its JavaBean properties that are equal to the corresponding values of the + specified bean. |
+|
+ +
| Methods in org.hamcrest.beans with parameters of type Matcher | +||
|---|---|---|
+static
+ |
+HasPropertyWithValue.hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ Creates a matcher that matches when the examined object has a JavaBean property + with the specified name whose value satisfies the specified matcher. |
+|
+ +
| Constructors in org.hamcrest.beans with parameters of type Matcher | +|
|---|---|
HasPropertyWithValue(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+
++ |
+|
| +Uses of Matcher in org.hamcrest.collection | +
|---|
+ +
| Classes in org.hamcrest.collection that implement Matcher | +|
|---|---|
+ class |
+IsArray<T>
+
++ Matcher for array whose elements satisfy a sequence of matchers. |
+
+ class |
+IsArrayContaining<T>
+
++ Matches if an array contains an item satisfying a nested matcher. |
+
+ class |
+IsArrayContainingInAnyOrder<E>
+
++ |
+
+ class |
+IsArrayContainingInOrder<E>
+
++ |
+
+ class |
+IsArrayWithSize<E>
+
++ Matches if array size satisfies a nested matcher. |
+
+ class |
+IsCollectionWithSize<E>
+
++ Matches if collection size satisfies a nested matcher. |
+
+ class |
+IsEmptyCollection<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsEmptyIterable<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsIn<T>
+
++ |
+
+ class |
+IsIterableContainingInAnyOrder<T>
+
++ |
+
+ class |
+IsIterableContainingInOrder<E>
+
++ |
+
+ class |
+IsIterableWithSize<E>
+
++ |
+
+ class |
+IsMapContaining<K,V>
+
++ |
+
+ +
| Methods in org.hamcrest.collection that return Matcher | +||
|---|---|---|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(E... items)
+
++ Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items. |
+|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. |
+|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(E... items)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array is logically equal to one item anywhere in the specified items. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers. |
+|
+static
+ |
+IsArrayWithSize.arrayWithSize(int size)
+
++ Creates a matcher for arrays that matches when the length of the array
+ equals the specified size. |
+|
+static
+ |
+IsArrayWithSize.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for arrays that matches when the length of the array
+ satisfies the specified matcher. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(E... items)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super E> itemMatcher)
+
++ Deprecated. use contains(Matcher super E> itemMatcher) instead |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(T... items)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. |
+|
+static
+ |
+IsEmptyCollection.empty()
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+static
+ |
+IsArrayWithSize.emptyArray()
+
++ Creates a matcher for arrays that matches when the length of the array
+ is zero. |
+|
+static
+ |
+IsEmptyCollection.emptyCollectionOf(java.lang.Class<E> type)
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+static
+ |
+IsEmptyIterable.emptyIterable()
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+static
+ |
+IsEmptyIterable.emptyIterableOf(java.lang.Class<E> type)
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+static
+ |
+IsMapContaining.hasEntry(K key,
+ V value)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value. |
+|
+static
+ |
+IsMapContaining.hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+|
+static
+ |
+IsArrayContaining.hasItemInArray(Matcher<? super T> elementMatcher)
+
++ Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher. |
+|
+static
+ |
+IsArrayContaining.hasItemInArray(T element)
+
++ A shortcut to the frequently used hasItemInArray(equalTo(x)). |
+|
+static
+ |
+IsMapContaining.hasKey(K key)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that is equal to the specified key. |
+|
+static
+ |
+IsMapContaining.hasKey(Matcher<? super K> keyMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+|
+static
+ |
+IsCollectionWithSize.hasSize(int size)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value equal to the specified size. |
+|
+static
+ |
+IsCollectionWithSize.hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+|
+static
+ |
+IsMapContaining.hasValue(Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+|
+static
+ |
+IsMapContaining.hasValue(V value)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that is equal to the specified value. |
+|
+static
+ |
+IsIn.isIn(java.util.Collection<T> collection)
+
++ Creates a matcher that matches when the examined object is found within the + specified collection. |
+|
+static
+ |
+IsIn.isIn(T[] elements)
+
++ Creates a matcher that matches when the examined object is found within the + specified array. |
+|
+static
+ |
+IsIn.isOneOf(T... elements)
+
++ Creates a matcher that matches when the examined object is equal to one of the + specified elements. |
+|
+static
+ |
+IsIterableWithSize.iterableWithSize(int size)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument. |
+|
+static
+ |
+IsIterableWithSize.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+|
+ +
| Methods in org.hamcrest.collection with parameters of type Matcher | +||
|---|---|---|
+static
+ |
+IsArray.array(Matcher<? super T>... elementMatchers)
+
++ Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. |
+|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified matchers. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified matchers. |
+|
+static
+ |
+IsArrayWithSize.arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for arrays that matches when the length of the array
+ satisfies the specified matcher. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super E> itemMatcher)
+
++ Deprecated. use contains(Matcher super E> itemMatcher) instead |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+|
+static
+ |
+IsMapContaining.hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+|
+static
+ |
+IsMapContaining.hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+|
+static
+ |
+IsArrayContaining.hasItemInArray(Matcher<? super T> elementMatcher)
+
++ Creates a matcher for arrays that matches when the examined array contains at least one item + that is matched by the specified elementMatcher. |
+|
+static
+ |
+IsMapContaining.hasKey(Matcher<? super K> keyMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+|
+static
+ |
+IsCollectionWithSize.hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+|
+static
+ |
+IsMapContaining.hasValue(Matcher<? super V> valueMatcher)
+
++ Creates a matcher for Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+|
+static
+ |
+IsIterableWithSize.iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+|
+ +
| Method parameters in org.hamcrest.collection with type arguments of type Matcher | +||
|---|---|---|
+static
+ |
+IsArrayContainingInOrder.arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. |
+|
+static
+ |
+IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. |
+|
+static
+ |
+IsIterableContainingInOrder.contains(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+|
+static
+ |
+IsIterableContainingInAnyOrder.containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+|
+ +
| Constructors in org.hamcrest.collection with parameters of type Matcher | +|
|---|---|
IsArray(Matcher<? super T>[] elementMatchers)
+
++ |
+|
IsArrayContaining(Matcher<? super T> elementMatcher)
+
++ |
+|
IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ |
+|
IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ |
+|
IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ |
+|
IsMapContaining(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ |
+|
IsMapContaining(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ |
+|
+ +
| Constructor parameters in org.hamcrest.collection with type arguments of type Matcher | +|
|---|---|
IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)
+
++ |
+|
IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers)
+
++ |
+|
IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)
+
++ |
+|
IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers)
+
++ |
+|
| +Uses of Matcher in org.hamcrest.core | +
|---|
+ +
| Classes in org.hamcrest.core that implement Matcher | +|
|---|---|
+ class |
+AllOf<T>
+
++ Calculates the logical conjunction of multiple matchers. |
+
+ class |
+AnyOf<T>
+
++ Calculates the logical disjunction of multiple matchers. |
+
+ class |
+CombinableMatcher<T>
+
++ |
+
+ class |
+DescribedAs<T>
+
++ Provides a custom description to another matcher. |
+
+ class |
+Every<T>
+
++ |
+
+ class |
+Is<T>
+
++ Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. |
+
+ class |
+IsAnything<T>
+
++ A matcher that always returns true. |
+
+ class |
+IsCollectionContaining<T>
+
++ |
+
+ class |
+IsEqual<T>
+
++ Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod? |
+
+ class |
+IsInstanceOf
+
++ Tests whether the value is an instance of a class. |
+
+ class |
+IsNot<T>
+
++ Calculates the logical negation of a matcher. |
+
+ class |
+IsNull<T>
+
++ Is the value null? |
+
+ class |
+IsSame<T>
+
++ Is the value the same object as another value? |
+
+ class |
+StringContains
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringEndsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringStartsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+SubstringMatcher
+
++ |
+
+ +
| Methods in org.hamcrest.core that return Matcher | +||
|---|---|---|
+static
+ |
+AllOf.allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+IsInstanceOf.any(java.lang.Class<T> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static Matcher<java.lang.Object> |
+IsAnything.anything()
+
++ Creates a matcher that always matches, regardless of the examined object. |
+|
+static Matcher<java.lang.Object> |
+IsAnything.anything(java.lang.String description)
+
++ Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. |
+|
+static Matcher<java.lang.String> |
+StringContains.containsString(java.lang.String substring)
+
++ Creates a matcher that matches if the examined String contains the specified
+ String anywhere. |
+|
+static
+ |
+DescribedAs.describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+static Matcher<java.lang.String> |
+StringEndsWith.endsWith(java.lang.String suffix)
+
++ Creates a matcher that matches if the examined String ends with the specified
+ String. |
+|
+static
+ |
+IsEqual.equalTo(T operand)
+
++ Creates a matcher that matches when the examined object is logically equal to the specified + operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+|
+static
+ |
+Every.everyItem(Matcher<U> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+|
+static
+ |
+IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+|
+static
+ |
+IsCollectionContaining.hasItem(T item)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+|
+static
+ |
+IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+|
+static
+ |
+IsCollectionContaining.hasItems(T... items)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+|
+static
+ |
+IsInstanceOf.instanceOf(java.lang.Class<?> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+static
+ |
+Is.is(java.lang.Class<T> type)
+
++ Deprecated. use isA(Class |
+|
+static
+ |
+Is.is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+Is.is(T value)
+
++ A shortcut to the frequently used is(equalTo(x)). |
+|
+static
+ |
+Is.isA(java.lang.Class<T> type)
+
++ A shortcut to the frequently used is(instanceOf(SomeClass.class)). |
+|
+static
+ |
+IsNot.not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+static
+ |
+IsNot.not(T value)
+
++ A shortcut to the frequently used not(equalTo(x)). |
+|
+static Matcher<java.lang.Object> |
+IsNull.notNullValue()
+
++ A shortcut to the frequently used not(nullValue()). |
+|
+static
+ |
+IsNull.notNullValue(java.lang.Class<T> type)
+
++ A shortcut to the frequently used not(nullValue(X.class)). |
+|
+static Matcher<java.lang.Object> |
+IsNull.nullValue()
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+IsNull.nullValue(java.lang.Class<T> type)
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+IsSame.sameInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+static Matcher<java.lang.String> |
+StringStartsWith.startsWith(java.lang.String prefix)
+
++ Creates a matcher that matches if the examined String starts with the specified
+ String. |
+|
+static
+ |
+IsSame.theInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+ +
| Methods in org.hamcrest.core with parameters of type Matcher | +||
|---|---|---|
+static
+ |
+AllOf.allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AllOf.allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+ CombinableMatcher<T> |
+CombinableMatcher.and(Matcher<? super T> other)
+
++ |
+|
+ CombinableMatcher<X> |
+CombinableMatcher.CombinableBothMatcher.and(Matcher<? super X> other)
+
++ |
+|
+static
+ |
+AnyOf.anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CombinableMatcher.both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
+static
+ |
+DescribedAs.describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+static
+ |
+CombinableMatcher.either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
+static
+ |
+Every.everyItem(Matcher<U> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+|
+static
+ |
+IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher)
+
++ Creates a matcher for Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+|
+static
+ |
+IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+|
+static
+ |
+Is.is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+IsNot.not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+ CombinableMatcher<T> |
+CombinableMatcher.or(Matcher<? super T> other)
+
++ |
+|
+ CombinableMatcher<X> |
+CombinableMatcher.CombinableEitherMatcher.or(Matcher<? super X> other)
+
++ |
+|
+ +
| Method parameters in org.hamcrest.core with type arguments of type Matcher | +||
|---|---|---|
+static
+ |
+AllOf.allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+ +
| Constructors in org.hamcrest.core with parameters of type Matcher | +|
|---|---|
CombinableMatcher.CombinableBothMatcher(Matcher<? super X> matcher)
+
++ |
+|
CombinableMatcher.CombinableEitherMatcher(Matcher<? super X> matcher)
+
++ |
+|
CombinableMatcher(Matcher<? super T> matcher)
+
++ |
+|
DescribedAs(java.lang.String descriptionTemplate,
+ Matcher<T> matcher,
+ java.lang.Object[] values)
+
++ |
+|
Every(Matcher<? super T> matcher)
+
++ |
+|
Is(Matcher<T> matcher)
+
++ |
+|
IsCollectionContaining(Matcher<? super T> elementMatcher)
+
++ |
+|
IsNot(Matcher<T> matcher)
+
++ |
+|
+ +
| Constructor parameters in org.hamcrest.core with type arguments of type Matcher | +|
|---|---|
AllOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ |
+|
AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ |
+|
| +Uses of Matcher in org.hamcrest.integration | +
|---|
+ +
| Methods in org.hamcrest.integration with parameters of type Matcher | +|
|---|---|
+static org.jmock.core.Constraint |
+JMock1Adapter.adapt(Matcher<?> matcher)
+
++ Convenience factory method that will adapt a + Hamcrest Matcher to act as an
+ jMock Constraint. |
+
+static org.easymock.IArgumentMatcher |
+EasyMock2Adapter.adapt(Matcher<?> matcher)
+
++ Convenience factory method that will adapt a + Hamcrest Matcher to act as an
+ EasyMock IArgumentMatcher and
+ report it to EasyMock so it can be kept track of. |
+
+ +
| Constructors in org.hamcrest.integration with parameters of type Matcher | +|
|---|---|
EasyMock2Adapter(Matcher<?> matcher)
+
++ |
+|
JMock1Adapter(Matcher<?> matcher)
+
++ |
+|
| +Uses of Matcher in org.hamcrest.number | +
|---|
+ +
| Classes in org.hamcrest.number that implement Matcher | +|
|---|---|
+ class |
+BigDecimalCloseTo
+
++ |
+
+ class |
+IsCloseTo
+
++ Is the value a number equal to a value within some range of + acceptable error? |
+
+ class |
+OrderingComparison<T extends Comparable<T>>
+
++ |
+
+ +
| Methods in org.hamcrest.number that return Matcher | +||
|---|---|---|
+static Matcher<java.math.BigDecimal> |
+BigDecimalCloseTo.closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+
++ Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+|
+static Matcher<java.lang.Double> |
+IsCloseTo.closeTo(double operand,
+ double error)
+
++ Creates a matcher of Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+|
+static
+ |
+OrderingComparison.comparesEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+OrderingComparison.greaterThan(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+OrderingComparison.greaterThanOrEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+|
+static
+ |
+OrderingComparison.lessThan(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object. |
+|
+static
+ |
+OrderingComparison.lessThanOrEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ less than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+|
| +Uses of Matcher in org.hamcrest.object | +
|---|
+ +
| Classes in org.hamcrest.object that implement Matcher | +|
|---|---|
+ class |
+HasToString<T>
+
++ |
+
+ class |
+IsCompatibleType<T>
+
++ |
+
+ class |
+IsEventFrom
+
++ Tests if the value is an event announced by a specific object. |
+
+ +
| Methods in org.hamcrest.object that return Matcher | +||
|---|---|---|
+static Matcher<java.util.EventObject> |
+IsEventFrom.eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any object
+ derived from eventClass announced by source. |
+|
+static Matcher<java.util.EventObject> |
+IsEventFrom.eventFrom(java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any EventObject
+ announced by source. |
+|
+static
+ |
+HasToString.hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value that satisfies the specified matcher. |
+|
+static
+ |
+HasToString.hasToString(java.lang.String expectedToString)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value equalTo the specified string. |
+|
+static
+ |
+IsCompatibleType.typeCompatibleWith(java.lang.Class<T> baseType)
+
++ Creates a matcher of Class that matches when the specified baseType is
+ assignable from the examined class. |
+|
+ +
| Methods in org.hamcrest.object with parameters of type Matcher | +||
|---|---|---|
+static
+ |
+HasToString.hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value that satisfies the specified matcher. |
+|
+ +
| Constructors in org.hamcrest.object with parameters of type Matcher | +|
|---|---|
HasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ |
+|
| +Uses of Matcher in org.hamcrest.text | +
|---|
+ +
| Classes in org.hamcrest.text that implement Matcher | +|
|---|---|
+ class |
+IsEmptyString
+
++ Matches empty Strings (and null). |
+
+ class |
+IsEqualIgnoringCase
+
++ Tests if a string is equal to another string, regardless of the case. |
+
+ class |
+IsEqualIgnoringWhiteSpace
+
++ Tests if a string is equal to another string, ignoring any changes in whitespace. |
+
+ class |
+StringContainsInOrder
+
++ |
+
+ +
| Methods in org.hamcrest.text that return Matcher | +|
|---|---|
+static Matcher<java.lang.String> |
+IsEqualIgnoringCase.equalToIgnoringCase(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+
+static Matcher<java.lang.String> |
+IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+
+static Matcher<java.lang.String> |
+IsEmptyString.isEmptyOrNullString()
+
++ Creates a matcher of String that matches when the examined string is null, or
+ has zero length. |
+
+static Matcher<java.lang.String> |
+IsEmptyString.isEmptyString()
+
++ Creates a matcher of String that matches when the examined string has zero length. |
+
+static Matcher<java.lang.String> |
+StringContainsInOrder.stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
++ Creates a matcher of String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance. |
+
| +Uses of Matcher in org.hamcrest.xml | +
|---|
+ +
| Classes in org.hamcrest.xml that implement Matcher | +|
|---|---|
+ class |
+HasXPath
+
++ Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression. |
+
+ +
| Methods in org.hamcrest.xml that return Matcher | +|
|---|---|
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
+ +
| Methods in org.hamcrest.xml with parameters of type Matcher | +|
|---|---|
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
+static Matcher<org.w3c.dom.Node> |
+HasXPath.hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
+ +
| Constructors in org.hamcrest.xml with parameters of type Matcher | +|
|---|---|
HasXPath(java.lang.String xPathExpression,
+ Matcher<java.lang.String> valueMatcher)
+
++ |
+|
HasXPath(java.lang.String xPathExpression,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use SelfDescribing | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.internal | ++ |
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
| +Uses of SelfDescribing in org.hamcrest | +
|---|
+ +
| Subinterfaces of SelfDescribing in org.hamcrest | +|
|---|---|
+ interface |
+Matcher<T>
+
++ A matcher over acceptable values. |
+
+ +
| Classes in org.hamcrest that implement SelfDescribing | +|
|---|---|
+ class |
+BaseMatcher<T>
+
++ BaseClass for all Matcher implementations. |
+
+ class |
+CustomMatcher<T>
+
++ Utility class for writing one off matchers. |
+
+ class |
+CustomTypeSafeMatcher<T>
+
++ Utility class for writing one off matchers. |
+
+ class |
+DiagnosingMatcher<T>
+
++ TODO(ngd): Document. |
+
+ class |
+FeatureMatcher<T,U>
+
++ Supporting class for matching a feature of an object. |
+
+ class |
+TypeSafeDiagnosingMatcher<T>
+
++ Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+
+ class |
+TypeSafeMatcher<T>
+
++ Convenient base class for Matchers that require a non-null value of a specific type. |
+
+ +
| Methods in org.hamcrest with parameters of type SelfDescribing | +|
|---|---|
+ Description |
+Description.appendDescriptionOf(SelfDescribing value)
+
++ Appends the description of a SelfDescribing value to this description. |
+
+ Description |
+Description.NullDescription.appendDescriptionOf(SelfDescribing value)
+
++ |
+
+ Description |
+BaseDescription.appendDescriptionOf(SelfDescribing value)
+
++ |
+
+static java.lang.String |
+StringDescription.asString(SelfDescribing selfDescribing)
+
++ Alias for StringDescription.toString(SelfDescribing). |
+
+static java.lang.String |
+StringDescription.toString(SelfDescribing selfDescribing)
+
++ Return the description of a SelfDescribing object as a String. |
+
+ +
| Method parameters in org.hamcrest with type arguments of type SelfDescribing | +|
|---|---|
+ Description |
+Description.appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
++ Appends a list of SelfDescribing objects
+ to the description. |
+
+ Description |
+Description.NullDescription.appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
++ |
+
+ Description |
+BaseDescription.appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+
++ |
+
| +Uses of SelfDescribing in org.hamcrest.beans | +
|---|
+ +
| Classes in org.hamcrest.beans that implement SelfDescribing | +|
|---|---|
+ class |
+HasProperty<T>
+
++ A Matcher that checks that an object has a JavaBean property + with the specified name. |
+
+ class |
+HasPropertyWithValue<T>
+
++ Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. |
+
+ class |
+SamePropertyValuesAs<T>
+
++ |
+
+static class |
+SamePropertyValuesAs.PropertyMatcher
+
++ |
+
| +Uses of SelfDescribing in org.hamcrest.collection | +
|---|
+ +
| Classes in org.hamcrest.collection that implement SelfDescribing | +|
|---|---|
+ class |
+IsArray<T>
+
++ Matcher for array whose elements satisfy a sequence of matchers. |
+
+ class |
+IsArrayContaining<T>
+
++ Matches if an array contains an item satisfying a nested matcher. |
+
+ class |
+IsArrayContainingInAnyOrder<E>
+
++ |
+
+ class |
+IsArrayContainingInOrder<E>
+
++ |
+
+ class |
+IsArrayWithSize<E>
+
++ Matches if array size satisfies a nested matcher. |
+
+ class |
+IsCollectionWithSize<E>
+
++ Matches if collection size satisfies a nested matcher. |
+
+ class |
+IsEmptyCollection<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsEmptyIterable<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsIn<T>
+
++ |
+
+ class |
+IsIterableContainingInAnyOrder<T>
+
++ |
+
+ class |
+IsIterableContainingInOrder<E>
+
++ |
+
+ class |
+IsIterableWithSize<E>
+
++ |
+
+ class |
+IsMapContaining<K,V>
+
++ |
+
| +Uses of SelfDescribing in org.hamcrest.core | +
|---|
+ +
| Classes in org.hamcrest.core that implement SelfDescribing | +|
|---|---|
+ class |
+AllOf<T>
+
++ Calculates the logical conjunction of multiple matchers. |
+
+ class |
+AnyOf<T>
+
++ Calculates the logical disjunction of multiple matchers. |
+
+ class |
+CombinableMatcher<T>
+
++ |
+
+ class |
+DescribedAs<T>
+
++ Provides a custom description to another matcher. |
+
+ class |
+Every<T>
+
++ |
+
+ class |
+Is<T>
+
++ Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. |
+
+ class |
+IsAnything<T>
+
++ A matcher that always returns true. |
+
+ class |
+IsCollectionContaining<T>
+
++ |
+
+ class |
+IsEqual<T>
+
++ Is the value equal to another value, as tested by the + Object.equals(java.lang.Object) invokedMethod? |
+
+ class |
+IsInstanceOf
+
++ Tests whether the value is an instance of a class. |
+
+ class |
+IsNot<T>
+
++ Calculates the logical negation of a matcher. |
+
+ class |
+IsNull<T>
+
++ Is the value null? |
+
+ class |
+IsSame<T>
+
++ Is the value the same object as another value? |
+
+ class |
+StringContains
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringEndsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringStartsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+SubstringMatcher
+
++ |
+
| +Uses of SelfDescribing in org.hamcrest.internal | +
|---|
+ +
| Classes in org.hamcrest.internal that implement SelfDescribing | +|
|---|---|
+ class |
+SelfDescribingValue<T>
+
++ |
+
+ +
| Methods in org.hamcrest.internal that return SelfDescribing | +|
|---|---|
+ SelfDescribing |
+SelfDescribingValueIterator.next()
+
++ |
+
| +Uses of SelfDescribing in org.hamcrest.number | +
|---|
+ +
| Classes in org.hamcrest.number that implement SelfDescribing | +|
|---|---|
+ class |
+BigDecimalCloseTo
+
++ |
+
+ class |
+IsCloseTo
+
++ Is the value a number equal to a value within some range of + acceptable error? |
+
+ class |
+OrderingComparison<T extends Comparable<T>>
+
++ |
+
| +Uses of SelfDescribing in org.hamcrest.object | +
|---|
+ +
| Classes in org.hamcrest.object that implement SelfDescribing | +|
|---|---|
+ class |
+HasToString<T>
+
++ |
+
+ class |
+IsCompatibleType<T>
+
++ |
+
+ class |
+IsEventFrom
+
++ Tests if the value is an event announced by a specific object. |
+
| +Uses of SelfDescribing in org.hamcrest.text | +
|---|
+ +
| Classes in org.hamcrest.text that implement SelfDescribing | +|
|---|---|
+ class |
+IsEmptyString
+
++ Matches empty Strings (and null). |
+
+ class |
+IsEqualIgnoringCase
+
++ Tests if a string is equal to another string, regardless of the case. |
+
+ class |
+IsEqualIgnoringWhiteSpace
+
++ Tests if a string is equal to another string, ignoring any changes in whitespace. |
+
+ class |
+StringContainsInOrder
+
++ |
+
| +Uses of SelfDescribing in org.hamcrest.xml | +
|---|
+ +
| Classes in org.hamcrest.xml that implement SelfDescribing | +|
|---|---|
+ class |
+HasXPath
+
++ Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression. |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use TypeSafeDiagnosingMatcher | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
| +Uses of TypeSafeDiagnosingMatcher in org.hamcrest | +
|---|
+ +
| Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest | +|
|---|---|
+ class |
+FeatureMatcher<T,U>
+
++ Supporting class for matching a feature of an object. |
+
| +Uses of TypeSafeDiagnosingMatcher in org.hamcrest.beans | +
|---|
+ +
| Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.beans | +|
|---|---|
+ class |
+HasPropertyWithValue<T>
+
++ Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. |
+
+ class |
+SamePropertyValuesAs<T>
+
++ |
+
| +Uses of TypeSafeDiagnosingMatcher in org.hamcrest.collection | +
|---|
+ +
| Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.collection | +|
|---|---|
+ class |
+IsArrayWithSize<E>
+
++ Matches if array size satisfies a nested matcher. |
+
+ class |
+IsCollectionWithSize<E>
+
++ Matches if collection size satisfies a nested matcher. |
+
+ class |
+IsIterableContainingInAnyOrder<T>
+
++ |
+
+ class |
+IsIterableContainingInOrder<E>
+
++ |
+
+ class |
+IsIterableWithSize<E>
+
++ |
+
| +Uses of TypeSafeDiagnosingMatcher in org.hamcrest.core | +
|---|
+ +
| Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.core | +|
|---|---|
+ class |
+CombinableMatcher<T>
+
++ |
+
+ class |
+Every<T>
+
++ |
+
+ class |
+IsCollectionContaining<T>
+
++ |
+
| +Uses of TypeSafeDiagnosingMatcher in org.hamcrest.object | +
|---|
+ +
| Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.object | +|
|---|---|
+ class |
+HasToString<T>
+
++ |
+
+ class |
+IsEventFrom
+
++ Tests if the value is an event announced by a specific object. |
+
| +Uses of TypeSafeDiagnosingMatcher in org.hamcrest.xml | +
|---|
+ +
| Subclasses of TypeSafeDiagnosingMatcher in org.hamcrest.xml | +|
|---|---|
+ class |
+HasXPath
+
++ Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression. |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use TypeSafeMatcher | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| +Uses of TypeSafeMatcher in org.hamcrest | +
|---|
+ +
| Subclasses of TypeSafeMatcher in org.hamcrest | +|
|---|---|
+ class |
+CustomTypeSafeMatcher<T>
+
++ Utility class for writing one off matchers. |
+
| +Uses of TypeSafeMatcher in org.hamcrest.beans | +
|---|
+ +
| Subclasses of TypeSafeMatcher in org.hamcrest.beans | +|
|---|---|
+ class |
+HasProperty<T>
+
++ A Matcher that checks that an object has a JavaBean property + with the specified name. |
+
| +Uses of TypeSafeMatcher in org.hamcrest.collection | +
|---|
+ +
| Subclasses of TypeSafeMatcher in org.hamcrest.collection | +|
|---|---|
+ class |
+IsArray<T>
+
++ Matcher for array whose elements satisfy a sequence of matchers. |
+
+ class |
+IsArrayContaining<T>
+
++ Matches if an array contains an item satisfying a nested matcher. |
+
+ class |
+IsArrayContainingInAnyOrder<E>
+
++ |
+
+ class |
+IsArrayContainingInOrder<E>
+
++ |
+
+ class |
+IsEmptyCollection<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsEmptyIterable<E>
+
++ Tests if collection is empty. |
+
+ class |
+IsMapContaining<K,V>
+
++ |
+
| +Uses of TypeSafeMatcher in org.hamcrest.core | +
|---|
+ +
| Subclasses of TypeSafeMatcher in org.hamcrest.core | +|
|---|---|
+ class |
+StringContains
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringEndsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringStartsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+SubstringMatcher
+
++ |
+
| +Uses of TypeSafeMatcher in org.hamcrest.number | +
|---|
+ +
| Subclasses of TypeSafeMatcher in org.hamcrest.number | +|
|---|---|
+ class |
+BigDecimalCloseTo
+
++ |
+
+ class |
+IsCloseTo
+
++ Is the value a number equal to a value within some range of + acceptable error? |
+
+ class |
+OrderingComparison<T extends Comparable<T>>
+
++ |
+
| +Uses of TypeSafeMatcher in org.hamcrest.object | +
|---|
+ +
| Subclasses of TypeSafeMatcher in org.hamcrest.object | +|
|---|---|
+ class |
+IsCompatibleType<T>
+
++ |
+
| +Uses of TypeSafeMatcher in org.hamcrest.text | +
|---|
+ +
| Subclasses of TypeSafeMatcher in org.hamcrest.text | +|
|---|---|
+ class |
+IsEqualIgnoringCase
+
++ Tests if a string is equal to another string, regardless of the case. |
+
+ class |
+IsEqualIgnoringWhiteSpace
+
++ Tests if a string is equal to another string, ignoring any changes in whitespace. |
+
+ class |
+StringContainsInOrder
+
++ |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T[]> +
org.hamcrest.collection.IsArray<T> +
public class IsArray<T>
+Matcher for array whose elements satisfy a sequence of matchers. + The array size must equal the number of element matchers. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsArray(Matcher<? super T>[] elementMatchers)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+array(Matcher<? super T>... elementMatchers)
+
++ Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. |
+|
+ void |
+describeMismatchSafely(T[] actual,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+protected java.lang.String |
+descriptionEnd()
+
++ Returns the string that ends the description. |
+|
+protected java.lang.String |
+descriptionSeparator()
+
++ Returns the string that separates the elements in the description. |
+|
+protected java.lang.String |
+descriptionStart()
+
++ Returns the string that starts the description. |
+|
+ boolean |
+matchesSafely(T[] array)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsArray(Matcher<? super T>[] elementMatchers)+
| +Method Detail | +
|---|
+public boolean matchesSafely(T[] array)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<T[]>+public void describeMismatchSafely(T[] actual, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<T[]>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+protected java.lang.String descriptionStart()+
+
+protected java.lang.String descriptionSeparator()+
+
+protected java.lang.String descriptionEnd()+
+
+public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)+
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
++
elementMatchers - the matchers that the elements of examined arrays should satisfy
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T[]> +
org.hamcrest.collection.IsArrayContaining<T> +
public class IsArrayContaining<T>
+Matches if an array contains an item satisfying a nested matcher. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsArrayContaining(Matcher<? super T> elementMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeMismatchSafely(T[] item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+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
+ |
+hasItemInArray(T element)
+
++ A shortcut to the frequently used hasItemInArray(equalTo(x)). |
+|
+ boolean |
+matchesSafely(T[] array)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsArrayContaining(Matcher<? super T> elementMatcher)+
| +Method Detail | +
|---|
+public boolean matchesSafely(T[] array)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<T[]>+public void describeMismatchSafely(T[] item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<T[]>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)+
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")))
++
elementMatcher - the matcher to apply to elements in examined arrays+public static <T> Matcher<T[]> hasItemInArray(T element)+
hasItemInArray(equalTo(x)).
+
+ For example:
+ assertThat(hasItemInArray(x))+ instead of: +
assertThat(hasItemInArray(equalTo(x)))+
+
element - the element that should be present in examined arrays
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<E[]> +
org.hamcrest.collection.IsArrayContainingInAnyOrder<E> +
public class IsArrayContainingInAnyOrder<E>
+
| +Constructor Summary | +|
|---|---|
IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. |
+|
+static
+ |
+arrayContainingInAnyOrder(E... items)
+
++ Creates an order agnostic matcher for arrays that matches when each item in the + examined array is logically equal to one item anywhere in the specified items. |
+|
+static
+ |
+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. |
+|
+ void |
+describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matchesSafely(E[] item)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)+
| +Method Detail | +
|---|
+public boolean matchesSafely(E[] item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<E[]>+public void describeMismatchSafely(E[] item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<E[]>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)+
+ For example: +
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
++
itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined array+public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)+
+ For example: +
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
++
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array+public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)+
+ For example: +
assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
++
items - the items that must equal the entries of an examined array, in any order
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<E[]> +
org.hamcrest.collection.IsArrayContainingInOrder<E> +
public class IsArrayContainingInOrder<E>
+
| +Constructor Summary | +|
|---|---|
IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+arrayContaining(E... items)
+
++ Creates a matcher for arrays that matcheswhen each item in the examined array is + logically equal to the corresponding item in the specified items. |
+|
+static
+ |
+arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for arrays that matches when each item in the examined array satisfies the + corresponding matcher in the specified list of matchers. |
+|
+static
+ |
+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. |
+|
+ void |
+describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matchesSafely(E[] item)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers)+
| +Method Detail | +
|---|
+public boolean matchesSafely(E[] item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<E[]>+public void describeMismatchSafely(E[] item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<E[]>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <E> Matcher<E[]> arrayContaining(E... items)+
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
++
items - the items that must equal the items within an examined array+public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)+
assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
++
itemMatchers - the matchers that must be satisfied by the items in the examined array+public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)+
assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
++
itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.FeatureMatcher<E[],java.lang.Integer> +
org.hamcrest.collection.IsArrayWithSize<E> +
public class IsArrayWithSize<E>
+Matches if array size satisfies a nested matcher. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+arrayWithSize(int size)
+
++ Creates a matcher for arrays that matches when the length of the array
+ equals the specified size. |
+|
+static
+ |
+arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for arrays that matches when the length of the array
+ satisfies the specified matcher. |
+|
+static
+ |
+emptyArray()
+
++ Creates a matcher for arrays that matches when the length of the array
+ is zero. |
+|
+protected java.lang.Integer |
+featureValueOf(E[] actual)
+
++ Implement this to extract the interesting feature. |
+|
| Methods inherited from class org.hamcrest.FeatureMatcher | +
|---|
describeTo, matchesSafely |
+
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
| +Method Detail | +
|---|
+protected java.lang.Integer featureValueOf(E[] actual)+
FeatureMatcher+
featureValueOf in class FeatureMatcher<E[],java.lang.Integer>actual - the target object
++public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
length of the array
+ satisfies the specified matcher.
+
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
++
sizeMatcher - a matcher for the length of an examined array+public static <E> Matcher<E[]> arrayWithSize(int size)+
length of the array
+ equals the specified size.
+
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
++
size - the length that an examined array must have for a positive match+public static <E> Matcher<E[]> emptyArray()+
length of the array
+ is zero.
+
+ For example:
+ assertThat(new String[0], emptyArray())+
+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer> +
org.hamcrest.collection.IsCollectionWithSize<E> +
public class IsCollectionWithSize<E>
+Matches if collection size satisfies a nested matcher. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+protected java.lang.Integer |
+featureValueOf(java.util.Collection<? extends E> actual)
+
++ Implement this to extract the interesting feature. |
+|
+static
+ |
+hasSize(int size)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value equal to the specified size. |
+|
+static
+ |
+hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+|
| Methods inherited from class org.hamcrest.FeatureMatcher | +
|---|
describeTo, matchesSafely |
+
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
| +Method Detail | +
|---|
+protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)+
FeatureMatcher+
featureValueOf in class FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>actual - the target object
++public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))
++
sizeMatcher - a matcher for the size of an examined Collection+public static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)+
Collections that matches when the size() method returns
+ a value equal to the specified size.
+
+ For example:
+ assertThat(Arrays.asList("foo", "bar"), hasSize(2))
++
size - the expected size of an examined Collection
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.util.Collection<? extends E>> +
org.hamcrest.collection.IsEmptyCollection<E> +
public class IsEmptyCollection<E>
+Tests if collection is empty. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsEmptyCollection()
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeMismatchSafely(java.util.Collection<? extends E> item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+empty()
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+static
+ |
+emptyCollectionOf(java.lang.Class<E> type)
+
++ Creates a matcher for Collections matching examined collections whose isEmpty
+ method returns true. |
+|
+ boolean |
+matchesSafely(java.util.Collection<? extends E> item)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsEmptyCollection()+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.util.Collection<? extends E> item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>+public void describeMismatchSafely(java.util.Collection<? extends E> item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <E> Matcher<java.util.Collection<? extends E>> empty()+
Collections matching examined collections whose isEmpty
+ method returns true.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(empty()))+
+
+public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> type)+
Collections matching examined collections whose isEmpty
+ method returns true.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))+
+
type - the type of the collection's content
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.Iterable<? extends E>> +
org.hamcrest.collection.IsEmptyIterable<E> +
public class IsEmptyIterable<E>
+Tests if collection is empty. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsEmptyIterable()
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeMismatchSafely(java.lang.Iterable<? extends E> iter,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+emptyIterable()
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+static
+ |
+emptyIterableOf(java.lang.Class<E> type)
+
++ Creates a matcher for Iterables matching examined iterables that yield no items. |
+|
+ boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsEmptyIterable()+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.Iterable<? extends E> iterable)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>+public void describeMismatchSafely(java.lang.Iterable<? extends E> iter, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()+
Iterables matching examined iterables that yield no items.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterable()))+
+
+public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> type)+
Iterables matching examined iterables that yield no items.
+
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))+
+
type - the type of the iterable's content
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.collection.IsIn<T> +
public class IsIn<T>
+
| +Constructor Summary | +|
|---|---|
IsIn(java.util.Collection<T> collection)
+
++ |
+|
IsIn(T[] elements)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description buffer)
+
++ Generates a description of the object. |
+|
+static
+ |
+isIn(java.util.Collection<T> collection)
+
++ Creates a matcher that matches when the examined object is found within the + specified collection. |
+|
+static
+ |
+isIn(T[] elements)
+
++ Creates a matcher that matches when the examined object is found within the + specified array. |
+|
+static
+ |
+isOneOf(T... elements)
+
++ Creates a matcher that matches when the examined object is equal to one of the + specified elements. |
+|
+ boolean |
+matches(java.lang.Object o)
+
++ Evaluates the matcher for argument item. |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsIn(java.util.Collection<T> collection)+
+public IsIn(T[] elements)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object o)+
Matcher+
o - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description buffer)+
SelfDescribing+
buffer - The description to be built or appended to.+public static <T> Matcher<T> isIn(java.util.Collection<T> collection)+
assertThat("foo", isIn(Arrays.asList("bar", "foo")))
++
collection - the collection in which matching items must be found+public static <T> Matcher<T> isIn(T[] elements)+
assertThat("foo", isIn(new String[]{"bar", "foo"}))
++
elements - the array in which matching items must be found+public static <T> Matcher<T> isOneOf(T... elements)+
assertThat("foo", isIn("bar", "foo"))
++
elements - the elements amongst which matching items will be found
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>> +
org.hamcrest.collection.IsIterableContainingInAnyOrder<T> +
public class IsIterableContainingInAnyOrder<T>
+
| +Constructor Summary | +|
|---|---|
IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
++ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+|
+static
+ |
+containsInAnyOrder(Matcher<? super E> itemMatcher)
+
++ Deprecated. use contains(Matcher super E> itemMatcher) instead |
+|
+static
+ |
+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
+ |
+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. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+protected boolean |
+matchesSafely(java.lang.Iterable<? extends T> items,
+ Description mismatchDescription)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)+
| +Method Detail | +
|---|
+protected boolean matchesSafely(java.lang.Iterable<? extends T> items, + Description mismatchDescription)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+@Deprecated +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInAnyOrder(Matcher<? super E> itemMatcher)+
+
Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.
+ For a positive match, the examined iterable must only yield one item.
+
+ For example:
+ assertThat(Arrays.asList("foo"), containsInAnyOrder(equalTo("foo")))
++
itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterable+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)+
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")))
++
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)+
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"))
++
items - the items that must equal the items provided by an examined Iterable in any order+public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)+
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"))))
++
itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>> +
org.hamcrest.collection.IsIterableContainingInOrder<E> +
public class IsIterableContainingInOrder<E>
+
| +Constructor Summary | +|
|---|---|
IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+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
+ |
+contains(java.util.List<Matcher<? super E>> itemMatchers)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+|
+static
+ |
+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
+ |
+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. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+protected boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable,
+ Description mismatchDescription)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers)+
| +Method Detail | +
|---|
+protected boolean matchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)+
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"))
++
items - the items that must equal the items provided by an examined Iterable+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)+
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")))
++
itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterable+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)+
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")))
++
itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable+public static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))
++
itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by
+ an examined Iterable
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer> +
org.hamcrest.collection.IsIterableWithSize<E> +
public class IsIterableWithSize<E>
+
| +Constructor Summary | +|
|---|---|
IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+protected java.lang.Integer |
+featureValueOf(java.lang.Iterable<E> actual)
+
++ Implement this to extract the interesting feature. |
+|
+static
+ |
+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
+ |
+iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+
++ Creates a matcher for Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+|
| Methods inherited from class org.hamcrest.FeatureMatcher | +
|---|
describeTo, matchesSafely |
+
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
| +Method Detail | +
|---|
+protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)+
FeatureMatcher+
featureValueOf in class FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>actual - the target object
++public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))
++
sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable+public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)+
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))
++
size - the number of items that should be yielded by an examined Iterable
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.util.Map<? extends K,? extends V>> +
org.hamcrest.collection.IsMapContaining<K,V> +
public class IsMapContaining<K,V>
+
| +Constructor Summary | +|
|---|---|
IsMapContaining(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+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
+ |
+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
+ |
+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
+ |
+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
+ |
+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
+ |
+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(java.util.Map<? extends K,? extends V> map)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsMapContaining(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.util.Map<? extends K,? extends V> map)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>+public void describeMismatchSafely(java.util.Map<? extends K,? extends V> map, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher)+
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")))
++
keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entryvalueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry+public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key, + V value)+
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"))
++
key - the key that, in combination with the value, must be describe at least one entryvalue - the value that, in combination with the key, must be describe at least one entry+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)+
Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+
+ For example:
+ assertThat(myMap, hasKey(equalTo("bar")))
++
keyMatcher - the matcher that must be satisfied by at least one key+public static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)+
Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+
+ For example:
+ assertThat(myMap, hasKey("bar"))
++
key - the key that satisfying maps must contain+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)+
Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+
+ For example:
+ assertThat(myMap, hasValue(equalTo("foo")))
++
valueMatcher - the matcher that must be satisfied by at least one value+public static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)+
Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+
+ For example:
+ assertThat(myMap, hasValue("foo"))
++
value - the value that satisfying maps must contain
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use IsArray | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| +Uses of IsArray in org.hamcrest | +
|---|
+ +
| Methods in org.hamcrest that return IsArray | +||
|---|---|---|
+static
+ |
+Matchers.array(Matcher<? super T>... elementMatchers)
+
++ Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. |
+|
| +Uses of IsArray in org.hamcrest.collection | +
|---|
+ +
| Methods in org.hamcrest.collection that return IsArray | +||
|---|---|---|
+static
+ |
+IsArray.array(Matcher<? super T>... elementMatchers)
+
++ Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +IsArray + +IsArrayContaining + +IsArrayContainingInAnyOrder + +IsArrayContainingInOrder + +IsArrayWithSize + +IsCollectionWithSize + +IsEmptyCollection + +IsEmptyIterable + +IsIn + +IsIterableContainingInAnyOrder + +IsIterableContainingInOrder + +IsIterableWithSize + +IsMapContaining |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Class Summary | +|
|---|---|
| IsArray<T> | +Matcher for array whose elements satisfy a sequence of matchers. | +
| IsArrayContaining<T> | +Matches if an array contains an item satisfying a nested matcher. | +
| IsArrayContainingInAnyOrder<E> | ++ |
| IsArrayContainingInOrder<E> | ++ |
| IsArrayWithSize<E> | +Matches if array size satisfies a nested matcher. | +
| IsCollectionWithSize<E> | +Matches if collection size satisfies a nested matcher. | +
| IsEmptyCollection<E> | +Tests if collection is empty. | +
| IsEmptyIterable<E> | +Tests if collection is empty. | +
| IsIn<T> | ++ |
| IsIterableContainingInAnyOrder<T> | ++ |
| IsIterableContainingInOrder<E> | ++ |
| IsIterableWithSize<E> | ++ |
| IsMapContaining<K,V> | ++ |
+
Matchers of arrays and collections.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use org.hamcrest.collection | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| +Classes in org.hamcrest.collection used by org.hamcrest | +|
|---|---|
| IsArray
+
+ + Matcher for array whose elements satisfy a sequence of matchers. |
+|
| +Classes in org.hamcrest.collection used by org.hamcrest.collection | +|
|---|---|
| IsArray
+
+ + Matcher for array whose elements satisfy a sequence of matchers. |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.DiagnosingMatcher<T> +
org.hamcrest.core.AllOf<T> +
public class AllOf<T>
+Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so
+ subsequent matchers are not called if an earlier matcher returns false.
+
+ +
+
| +Constructor Summary | +|
|---|---|
AllOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+allOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ALL of the specified matchers. |
+|
+static
+ |
+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
+ |
+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
+ |
+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
+ |
+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
+ |
+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. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matches(java.lang.Object o,
+ Description mismatch)
+
++ |
+|
| Methods inherited from class org.hamcrest.DiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public AllOf(java.lang.Iterable<Matcher<? super T>> matchers)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object o, + Description mismatch)+
matches in class DiagnosingMatcher<T>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
++
+public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
++
+public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
++
+public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
++
+public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
++
+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)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
++
+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)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
++
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.AnyOf<T> +
public class AnyOf<T>
+Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so
+ subsequent matchers are not called if an earlier matcher returns true.
+
+ +
+
| +Constructor Summary | +|
|---|---|
AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ void |
+describeTo(Description description,
+ java.lang.String operator)
+
++ |
+|
+ boolean |
+matches(java.lang.Object o)
+
++ Evaluates the matcher for argument item. |
+|
+protected boolean |
+matches(java.lang.Object o,
+ boolean shortcut)
+
++ |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object o)+
Matcher+
matches in interface Matcher<T>o - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
describeTo in interface SelfDescribingdescription - The description to be built or appended to.+public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
++
+public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
++
+public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
++
+public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
++
+public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
++
+public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
++
+public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
++
+protected boolean matches(java.lang.Object o, + boolean shortcut)+
+public void describeTo(Description description, + java.lang.String operator)+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<X> +
public static final class CombinableMatcher.CombinableBothMatcher<X>
+
| +Constructor Summary | +|
|---|---|
CombinableMatcher.CombinableBothMatcher(Matcher<? super X> matcher)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ CombinableMatcher<X> |
+and(Matcher<? super X> other)
+
++ |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public CombinableMatcher.CombinableBothMatcher(Matcher<? super X> matcher)+
| +Method Detail | +
|---|
+public CombinableMatcher<X> and(Matcher<? super X> other)+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher<X> +
public static final class CombinableMatcher.CombinableEitherMatcher<X>
+
| +Constructor Summary | +|
|---|---|
CombinableMatcher.CombinableEitherMatcher(Matcher<? super X> matcher)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ CombinableMatcher<X> |
+or(Matcher<? super X> other)
+
++ |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public CombinableMatcher.CombinableEitherMatcher(Matcher<? super X> matcher)+
| +Method Detail | +
|---|
+public CombinableMatcher<X> or(Matcher<? super X> other)+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.core.CombinableMatcher<T> +
public class CombinableMatcher<T>
+
| +Nested Class Summary | +|
|---|---|
+static class |
+CombinableMatcher.CombinableBothMatcher<X>
+
++ |
+
+static class |
+CombinableMatcher.CombinableEitherMatcher<X>
+
++ |
+
| +Constructor Summary | +|
|---|---|
CombinableMatcher(Matcher<? super T> matcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ CombinableMatcher<T> |
+and(Matcher<? super T> other)
+
++ |
+|
+static
+ |
+both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
+protected boolean |
+matchesSafely(T item,
+ Description mismatch)
+
++ Subclasses should implement this. |
+|
+ CombinableMatcher<T> |
+or(Matcher<? super T> other)
+
++ |
+|
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public CombinableMatcher(Matcher<? super T> matcher)+
| +Method Detail | +
|---|
+protected boolean matchesSafely(T item, + Description mismatch)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<T>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public CombinableMatcher<T> and(Matcher<? super T> other)+
+public CombinableMatcher<T> or(Matcher<? super T> other)+
+public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)+
assertThat("fab", both(containsString("a")).and(containsString("b")))
++
+public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)+
assertThat("fan", either(containsString("a")).and(containsString("b")))
++
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.DescribedAs<T> +
public class DescribedAs<T>
+Provides a custom description to another matcher. +
+ +
+
| +Constructor Summary | +|
|---|---|
DescribedAs(java.lang.String descriptionTemplate,
+ Matcher<T> matcher,
+ java.lang.Object[] values)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+
++ Wraps an existing matcher, overriding its description with that specified. |
+|
+ void |
+describeMismatch(java.lang.Object item,
+ Description description)
+
++ Generate a description of why the matcher has not accepted the item. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matches(java.lang.Object o)
+
++ Evaluates the matcher for argument item. |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public DescribedAs(java.lang.String descriptionTemplate, + Matcher<T> matcher, + java.lang.Object[] values)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object o)+
Matcher+
o - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.
++
describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.+public static <T> Matcher<T> describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values)+
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
++
description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised description
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<T>> +
org.hamcrest.core.Every<T> +
public class Every<T>
+
| +Constructor Summary | +|
|---|---|
Every(Matcher<? super T> matcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+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. |
+|
+ boolean |
+matchesSafely(java.lang.Iterable<T> collection,
+ Description mismatchDescription)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public Every(Matcher<? super T> matcher)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.Iterable<T> collection, + Description mismatchDescription)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<T>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)+
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")))
++
itemMatcher - the matcher to apply to every item provided by the examined Iterable
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.Is<T> +
public class Is<T>
+Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. + + For example: assertThat(cheese, equalTo(smelly)) + vs. assertThat(cheese, is(equalTo(smelly))) +
+ +
+
| +Constructor Summary | +|
|---|---|
Is(Matcher<T> matcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+
++ Generate a description of why the matcher has not accepted the item. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+is(java.lang.Class<T> type)
+
++ Deprecated. use isA(Class |
+|
+static
+ |
+is(Matcher<T> matcher)
+
++ Decorates another Matcher, retaining its behaviour, but allowing tests + to be slightly more expressive. |
+|
+static
+ |
+is(T value)
+
++ A shortcut to the frequently used is(equalTo(x)). |
+|
+static
+ |
+isA(java.lang.Class<T> type)
+
++ A shortcut to the frequently used is(instanceOf(SomeClass.class)). |
+|
+ boolean |
+matches(java.lang.Object arg)
+
++ Evaluates the matcher for argument item. |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public Is(Matcher<T> matcher)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object arg)+
Matcher+
arg - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.
++
describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.+public static <T> Matcher<T> is(Matcher<T> matcher)+
assertThat(cheese, is(equalTo(smelly)))+ instead of: +
assertThat(cheese, equalTo(smelly))+
+
+public static <T> Matcher<T> is(T value)+
is(equalTo(x)).
+
+ For example:
+ assertThat(cheese, is(smelly))+ instead of: +
assertThat(cheese, is(equalTo(smelly)))+
+
+@Deprecated +public static <T> Matcher<T> is(java.lang.Class<T> type)+
+
is(instanceOf(SomeClass.class)).
+
+ For example:
+ assertThat(cheese, is(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))+
+
+public static <T> Matcher<T> isA(java.lang.Class<T> type)+
is(instanceOf(SomeClass.class)).
+
+ For example:
+ assertThat(cheese, isA(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))+
+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsAnything<T> +
public class IsAnything<T>
+A matcher that always returns true.
+
+ +
+
| +Constructor Summary | +|
|---|---|
IsAnything()
+
++ |
+|
IsAnything(java.lang.String message)
+
++ |
+|
| +Method Summary | +|
|---|---|
+static Matcher<java.lang.Object> |
+anything()
+
++ Creates a matcher that always matches, regardless of the examined object. |
+
+static Matcher<java.lang.Object> |
+anything(java.lang.String description)
+
++ Creates a matcher that always matches, regardless of the examined object, but describes + itself with the specified String. |
+
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+ boolean |
+matches(java.lang.Object o)
+
++ Evaluates the matcher for argument item. |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsAnything()+
+public IsAnything(java.lang.String message)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object o)+
Matcher+
o - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.lang.Object> anything()+
+
+public static Matcher<java.lang.Object> anything(java.lang.String description)+
String.
++
description - a meaningful String used when describing itself
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>> +
org.hamcrest.core.IsCollectionContaining<T> +
public class IsCollectionContaining<T>
+
| +Constructor Summary | +|
|---|---|
IsCollectionContaining(Matcher<? super T> elementMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+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
+ |
+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
+ |
+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
+ |
+hasItems(T... items)
+
++ Creates a matcher for Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+|
+protected boolean |
+matchesSafely(java.lang.Iterable<? super T> collection,
+ Description mismatchDescription)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsCollectionContaining(Matcher<? super T> elementMatcher)+
| +Method Detail | +
|---|
+protected boolean matchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
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")))
++
itemMatcher - the matcher to apply to items provided by the examined Iterable+public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
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"))
++
item - the item to compare against the items provided by the examined Iterable+public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
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")))
++
itemMatchers - the matchers to apply to items provided by the examined Iterable+public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
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"))
++
items - the items to compare against the items provided by the examined Iterable
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsEqual<T> +
public class IsEqual<T>
+Is the value equal to another value, as tested by the
+ Object.equals(java.lang.Object) invokedMethod?
+
+ +
+
| +Constructor Summary | +|
|---|---|
IsEqual(T equalArg)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+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. |
+|
+ boolean |
+matches(java.lang.Object actualValue)
+
++ Evaluates the matcher for argument item. |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsEqual(T equalArg)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object actualValue)+
Matcher+
actualValue - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> equalTo(T operand)+
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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+
++
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.DiagnosingMatcher<java.lang.Object> +
org.hamcrest.core.IsInstanceOf +
public class IsInstanceOf
+Tests whether the value is an instance of a class. + Classes of basic types will be converted to the relevant "Object" classes +
+ +
+
| +Constructor Summary | +|
|---|---|
IsInstanceOf(java.lang.Class<?> expectedClass)
+
++ Creates a new instance of IsInstanceOf |
+|
| +Method Summary | +||
|---|---|---|
+static
+ |
+any(java.lang.Class<T> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+instanceOf(java.lang.Class<?> type)
+
++ Creates a matcher that matches when the examined object is an instance of the specified type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+|
+protected boolean |
+matches(java.lang.Object item,
+ Description mismatch)
+
++ |
+|
| Methods inherited from class org.hamcrest.DiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsInstanceOf(java.lang.Class<?> expectedClass)+
+
expectedClass - The predicate evaluates to true for instances of this class
+ or one of its subclasses.| +Method Detail | +
|---|
+protected boolean matches(java.lang.Object item, + Description mismatch)+
matches in class DiagnosingMatcher<java.lang.Object>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)+
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));+
+
+public static <T> Matcher<T> any(java.lang.Class<T> type)+
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))
assertThat(new Canoe(), instanceOf(Canoe.class));+
+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsNot<T> +
public class IsNot<T>
+Calculates the logical negation of a matcher. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsNot(Matcher<T> matcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matches(java.lang.Object arg)
+
++ Evaluates the matcher for argument item. |
+|
+static
+ |
+not(Matcher<T> matcher)
+
++ Creates a matcher that wraps an existing matcher, but inverts the logic by which + it will match. |
+|
+static
+ |
+not(T value)
+
++ A shortcut to the frequently used not(equalTo(x)). |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsNot(Matcher<T> matcher)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object arg)+
Matcher+
arg - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> not(Matcher<T> matcher)+
assertThat(cheese, is(not(equalTo(smelly))))+
+
matcher - the matcher whose sense should be inverted+public static <T> Matcher<T> not(T value)+
not(equalTo(x)).
+
+ For example:
+ assertThat(cheese, is(not(smelly)))+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))+
+
value - the value that any examined object should not equal
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsNull<T> +
public class IsNull<T>
+Is the value null? +
+ +
+
| +Constructor Summary | +|
|---|---|
IsNull()
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matches(java.lang.Object o)
+
++ Evaluates the matcher for argument item. |
+|
+static Matcher<java.lang.Object> |
+notNullValue()
+
++ A shortcut to the frequently used not(nullValue()). |
+|
+static
+ |
+notNullValue(java.lang.Class<T> type)
+
++ A shortcut to the frequently used not(nullValue(X.class)). |
+|
+static Matcher<java.lang.Object> |
+nullValue()
+
++ Creates a matcher that matches if examined object is null. |
+|
+static
+ |
+nullValue(java.lang.Class<T> type)
+
++ Creates a matcher that matches if examined object is null. |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsNull()+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object o)+
Matcher+
o - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.lang.Object> nullValue()+
null.
+
+ For example:
+ assertThat(cheese, is(nullValue())+
+
+public static Matcher<java.lang.Object> notNullValue()+
not(nullValue()).
+
+ For example:
+ assertThat(cheese, is(notNullValue()))+ instead of: +
assertThat(cheese, is(not(nullValue())))+
+
+public static <T> Matcher<T> nullValue(java.lang.Class<T> type)+
null. Accepts a
+ single dummy argument to facilitate type inference.
+
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))+
+
type - dummy parameter used to infer the generic type of the returned matcher+public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)+
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 - dummy parameter used to infer the generic type of the returned matcher
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.core.IsSame<T> +
public class IsSame<T>
+Is the value the same object as another value? +
+ +
+
| +Constructor Summary | +|
|---|---|
IsSame(T object)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matches(java.lang.Object arg)
+
++ Evaluates the matcher for argument item. |
+|
+static
+ |
+sameInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
+static
+ |
+theInstance(T target)
+
++ Creates a matcher that matches only when the examined object is the same instance as + the specified target object. |
+|
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsSame(T object)+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object arg)+
Matcher+
arg - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<T> sameInstance(T target)+
+
target - the target instance against which others should be assessed+public static <T> Matcher<T> theInstance(T target)+
+
target - the target instance against which others should be assessed
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.String> +
org.hamcrest.core.SubstringMatcher +
org.hamcrest.core.StringContains +
public class StringContains
+Tests if the argument is a string that contains a substring. +
+ +
+
| +Field Summary | +
|---|
| Fields inherited from class org.hamcrest.core.SubstringMatcher | +
|---|
substring |
+
| +Constructor Summary | +|
|---|---|
StringContains(java.lang.String substring)
+
++ |
+|
| +Method Summary | +|
|---|---|
+static Matcher<java.lang.String> |
+containsString(java.lang.String substring)
+
++ Creates a matcher that matches if the examined String contains the specified
+ String anywhere. |
+
+protected boolean |
+evalSubstringOf(java.lang.String s)
+
++ |
+
+protected java.lang.String |
+relationship()
+
++ |
+
| Methods inherited from class org.hamcrest.core.SubstringMatcher | +
|---|
describeMismatchSafely, describeTo, matchesSafely |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public StringContains(java.lang.String substring)+
| +Method Detail | +
|---|
+protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcher+protected java.lang.String relationship()+
relationship in class SubstringMatcher+public static Matcher<java.lang.String> containsString(java.lang.String substring)+
String contains the specified
+ String anywhere.
+
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))
++
substring - the substring that the returned matcher will expect to find within any examined string
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.String> +
org.hamcrest.core.SubstringMatcher +
org.hamcrest.core.StringEndsWith +
public class StringEndsWith
+Tests if the argument is a string that contains a substring. +
+ +
+
| +Field Summary | +
|---|
| Fields inherited from class org.hamcrest.core.SubstringMatcher | +
|---|
substring |
+
| +Constructor Summary | +|
|---|---|
StringEndsWith(java.lang.String substring)
+
++ |
+|
| +Method Summary | +|
|---|---|
+static Matcher<java.lang.String> |
+endsWith(java.lang.String suffix)
+
++ Creates a matcher that matches if the examined String ends with the specified
+ String. |
+
+protected boolean |
+evalSubstringOf(java.lang.String s)
+
++ |
+
+protected java.lang.String |
+relationship()
+
++ |
+
| Methods inherited from class org.hamcrest.core.SubstringMatcher | +
|---|
describeMismatchSafely, describeTo, matchesSafely |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public StringEndsWith(java.lang.String substring)+
| +Method Detail | +
|---|
+protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcher+protected java.lang.String relationship()+
relationship in class SubstringMatcher+public static Matcher<java.lang.String> endsWith(java.lang.String suffix)+
String ends with the specified
+ String.
+
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))
++
suffix - the substring that the returned matcher will expect at the end of any examined string
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.String> +
org.hamcrest.core.SubstringMatcher +
org.hamcrest.core.StringStartsWith +
public class StringStartsWith
+Tests if the argument is a string that contains a substring. +
+ +
+
| +Field Summary | +
|---|
| Fields inherited from class org.hamcrest.core.SubstringMatcher | +
|---|
substring |
+
| +Constructor Summary | +|
|---|---|
StringStartsWith(java.lang.String substring)
+
++ |
+|
| +Method Summary | +|
|---|---|
+protected boolean |
+evalSubstringOf(java.lang.String s)
+
++ |
+
+protected java.lang.String |
+relationship()
+
++ |
+
+static Matcher<java.lang.String> |
+startsWith(java.lang.String prefix)
+
++ Creates a matcher that matches if the examined String starts with the specified
+ String. |
+
| Methods inherited from class org.hamcrest.core.SubstringMatcher | +
|---|
describeMismatchSafely, describeTo, matchesSafely |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public StringStartsWith(java.lang.String substring)+
| +Method Detail | +
|---|
+protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcher+protected java.lang.String relationship()+
relationship in class SubstringMatcher+public static Matcher<java.lang.String> startsWith(java.lang.String prefix)+
String starts with the specified
+ String.
+
+ For example:
+ assertThat("myStringOfNote", startsWith("my"))
++
prefix - the substring that the returned matcher will expect at the start of any examined string
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.String> +
org.hamcrest.core.SubstringMatcher +
public abstract class SubstringMatcher
+
| +Field Summary | +|
|---|---|
+protected java.lang.String |
+substring
+
++ |
+
| +Constructor Summary | +|
|---|---|
+protected |
+SubstringMatcher(java.lang.String substring)
+
++ |
+
| +Method Summary | +|
|---|---|
+ void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+protected abstract boolean |
+evalSubstringOf(java.lang.String string)
+
++ |
+
+ boolean |
+matchesSafely(java.lang.String item)
+
++ Subclasses should implement this. |
+
+protected abstract java.lang.String |
+relationship()
+
++ |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Field Detail | +
|---|
+protected final java.lang.String substring+
| +Constructor Detail | +
|---|
+protected SubstringMatcher(java.lang.String substring)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.String item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.lang.String>+public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+protected abstract boolean evalSubstringOf(java.lang.String string)+
+protected abstract java.lang.String relationship()+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use AnyOf | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| +Uses of AnyOf in org.hamcrest | +
|---|
+ +
| Methods in org.hamcrest that return AnyOf | +||
|---|---|---|
+static
+ |
+Matchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+Matchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+CoreMatchers.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
| +Uses of AnyOf in org.hamcrest.core | +
|---|
+ +
| Methods in org.hamcrest.core that return AnyOf | +||
|---|---|---|
+static
+ |
+AnyOf.anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<? super T>... matchers)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+static
+ |
+AnyOf.anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+
++ Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use CombinableMatcher.CombinableBothMatcher | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| +Uses of CombinableMatcher.CombinableBothMatcher in org.hamcrest | +
|---|
+ +
| Methods in org.hamcrest that return CombinableMatcher.CombinableBothMatcher | +||
|---|---|---|
+static
+ |
+Matchers.both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
+static
+ |
+CoreMatchers.both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
| +Uses of CombinableMatcher.CombinableBothMatcher in org.hamcrest.core | +
|---|
+ +
| Methods in org.hamcrest.core that return CombinableMatcher.CombinableBothMatcher | +||
|---|---|---|
+static
+ |
+CombinableMatcher.both(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when both of the specified matchers match the examined object. |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use CombinableMatcher.CombinableEitherMatcher | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| +Uses of CombinableMatcher.CombinableEitherMatcher in org.hamcrest | +
|---|
+ +
| Methods in org.hamcrest that return CombinableMatcher.CombinableEitherMatcher | +||
|---|---|---|
+static
+ |
+Matchers.either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
+static
+ |
+CoreMatchers.either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
| +Uses of CombinableMatcher.CombinableEitherMatcher in org.hamcrest.core | +
|---|
+ +
| Methods in org.hamcrest.core that return CombinableMatcher.CombinableEitherMatcher | +||
|---|---|---|
+static
+ |
+CombinableMatcher.either(Matcher<? super LHS> matcher)
+
++ Creates a matcher that matches when either of the specified matchers match the examined object. |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use CombinableMatcher | +|
|---|---|
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| +Uses of CombinableMatcher in org.hamcrest.core | +
|---|
+ +
| Methods in org.hamcrest.core that return CombinableMatcher | +|
|---|---|
+ CombinableMatcher<T> |
+CombinableMatcher.and(Matcher<? super T> other)
+
++ |
+
+ CombinableMatcher<X> |
+CombinableMatcher.CombinableBothMatcher.and(Matcher<? super X> other)
+
++ |
+
+ CombinableMatcher<T> |
+CombinableMatcher.or(Matcher<? super T> other)
+
++ |
+
+ CombinableMatcher<X> |
+CombinableMatcher.CombinableEitherMatcher.or(Matcher<? super X> other)
+
++ |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use SubstringMatcher | +|
|---|---|
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| +Uses of SubstringMatcher in org.hamcrest.core | +
|---|
+ +
| Subclasses of SubstringMatcher in org.hamcrest.core | +|
|---|---|
+ class |
+StringContains
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringEndsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+ class |
+StringStartsWith
+
++ Tests if the argument is a string that contains a substring. |
+
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +AllOf + +AnyOf + +CombinableMatcher + +CombinableMatcher.CombinableBothMatcher + +CombinableMatcher.CombinableEitherMatcher + +DescribedAs + +Every + +Is + +IsAnything + +IsCollectionContaining + +IsEqual + +IsInstanceOf + +IsNot + +IsNull + +IsSame + +StringContains + +StringEndsWith + +StringStartsWith + +SubstringMatcher |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Class Summary | +|
|---|---|
| AllOf<T> | +Calculates the logical conjunction of multiple matchers. | +
| AnyOf<T> | +Calculates the logical disjunction of multiple matchers. | +
| CombinableMatcher<T> | ++ |
| CombinableMatcher.CombinableBothMatcher<X> | ++ |
| CombinableMatcher.CombinableEitherMatcher<X> | ++ |
| DescribedAs<T> | +Provides a custom description to another matcher. | +
| Every<T> | ++ |
| Is<T> | +Decorates another Matcher, retaining the behaviour but allowing tests + to be slightly more expressive. | +
| IsAnything<T> | +A matcher that always returns true. |
+
| IsCollectionContaining<T> | ++ |
| IsEqual<T> | +Is the value equal to another value, as tested by the
+ Object.equals(java.lang.Object) invokedMethod? |
+
| IsInstanceOf | +Tests whether the value is an instance of a class. | +
| IsNot<T> | +Calculates the logical negation of a matcher. | +
| IsNull<T> | +Is the value null? | +
| IsSame<T> | +Is the value the same object as another value? | +
| StringContains | +Tests if the argument is a string that contains a substring. | +
| StringEndsWith | +Tests if the argument is a string that contains a substring. | +
| StringStartsWith | +Tests if the argument is a string that contains a substring. | +
| SubstringMatcher | ++ |
+
Fundamental matchers of objects and values, and composite matchers.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use org.hamcrest.core | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| +Classes in org.hamcrest.core used by org.hamcrest | +|
|---|---|
| AnyOf
+
+ + Calculates the logical disjunction of multiple matchers. |
+|
| CombinableMatcher.CombinableBothMatcher
+
+ + |
+|
| CombinableMatcher.CombinableEitherMatcher
+
+ + |
+|
| +Classes in org.hamcrest.core used by org.hamcrest.core | +|
|---|---|
| AnyOf
+
+ + Calculates the logical disjunction of multiple matchers. |
+|
| CombinableMatcher
+
+ + |
+|
| CombinableMatcher.CombinableBothMatcher
+
+ + |
+|
| CombinableMatcher.CombinableEitherMatcher
+
+ + |
+|
| SubstringMatcher
+
+ + |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.integration.EasyMock2Adapter +
public class EasyMock2Adapter
+An adapter allowing a Hamcrest Matcher
+ to act as an EasyMock IArgumentMatcher.
+
+ +
+
| +Constructor Summary | +|
|---|---|
EasyMock2Adapter(Matcher<?> matcher)
+
++ |
+|
| +Method Summary | +|
|---|---|
+static org.easymock.IArgumentMatcher |
+adapt(Matcher<?> matcher)
+
++ Convenience factory method that will adapt a + Hamcrest Matcher to act as an
+ EasyMock IArgumentMatcher and
+ report it to EasyMock so it can be kept track of. |
+
+ void |
+appendTo(java.lang.StringBuffer buffer)
+
++ |
+
+ boolean |
+matches(java.lang.Object argument)
+
++ |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public EasyMock2Adapter(Matcher<?> matcher)+
| +Method Detail | +
|---|
+public static org.easymock.IArgumentMatcher adapt(Matcher<?> matcher)+
Matcher to act as an
+ EasyMock IArgumentMatcher and
+ report it to EasyMock so it can be kept track of.
++
+public boolean matches(java.lang.Object argument)+
matches in interface org.easymock.IArgumentMatcher+public void appendTo(java.lang.StringBuffer buffer)+
appendTo in interface org.easymock.IArgumentMatcher
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.integration.JMock1Adapter +
public class JMock1Adapter
+An adapter allowing a Hamcrest Matcher
+ to act as an jMock1 Constraint.
+ Note, this is not necessary for jMock2 as it supports Hamcrest
+ out of the box.
+
+ +
+
| +Constructor Summary | +|
|---|---|
JMock1Adapter(Matcher<?> matcher)
+
++ |
+|
| +Method Summary | +|
|---|---|
+static org.jmock.core.Constraint |
+adapt(Matcher<?> matcher)
+
++ Convenience factory method that will adapt a + Hamcrest Matcher to act as an
+ jMock Constraint. |
+
+ java.lang.StringBuffer |
+describeTo(java.lang.StringBuffer buffer)
+
++ |
+
+ boolean |
+eval(java.lang.Object o)
+
++ |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public JMock1Adapter(Matcher<?> matcher)+
| +Method Detail | +
|---|
+public static org.jmock.core.Constraint adapt(Matcher<?> matcher)+
Matcher to act as an
+ jMock Constraint.
++
+public boolean eval(java.lang.Object o)+
eval in interface org.jmock.core.Constraint+public java.lang.StringBuffer describeTo(java.lang.StringBuffer buffer)+
describeTo in interface org.jmock.core.SelfDescribing
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +EasyMock2Adapter + +JMock1Adapter |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Class Summary | +|
|---|---|
| EasyMock2Adapter | +An adapter allowing a Hamcrest Matcher
+ to act as an EasyMock IArgumentMatcher. |
+
| JMock1Adapter | +An adapter allowing a Hamcrest Matcher
+ to act as an jMock1 Constraint. |
+
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.internal.ArrayIterator +
public class ArrayIterator
+
| +Constructor Summary | +|
|---|---|
ArrayIterator(java.lang.Object array)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ boolean |
+hasNext()
+
++ |
+
+ java.lang.Object |
+next()
+
++ |
+
+ void |
+remove()
+
++ |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public ArrayIterator(java.lang.Object array)+
| +Method Detail | +
|---|
+public boolean hasNext()+
hasNext in interface java.util.Iterator<java.lang.Object>+public java.lang.Object next()+
next in interface java.util.Iterator<java.lang.Object>+public void remove()+
remove in interface java.util.Iterator<java.lang.Object>
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.internal.ReflectiveTypeFinder +
public class ReflectiveTypeFinder
+
| +Constructor Summary | +|
|---|---|
ReflectiveTypeFinder(java.lang.String methodName,
+ int expectedNumberOfParameters,
+ int typedParameter)
+
++ |
+|
| +Method Summary | +|
|---|---|
+protected boolean |
+canObtainExpectedTypeFrom(java.lang.reflect.Method method)
+
++ |
+
+protected java.lang.Class<?> |
+expectedTypeFrom(java.lang.reflect.Method method)
+
++ |
+
+ java.lang.Class<?> |
+findExpectedType(java.lang.Class<?> fromClass)
+
++ |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public ReflectiveTypeFinder(java.lang.String methodName, + int expectedNumberOfParameters, + int typedParameter)+
| +Method Detail | +
|---|
+public java.lang.Class<?> findExpectedType(java.lang.Class<?> fromClass)+
+protected boolean canObtainExpectedTypeFrom(java.lang.reflect.Method method)+
method - The method to examine.
++protected java.lang.Class<?> expectedTypeFrom(java.lang.reflect.Method method)+
method - The method from which to extract
+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.internal.SelfDescribingValue<T> +
public class SelfDescribingValue<T>
+
| +Constructor Summary | +|
|---|---|
SelfDescribingValue(T value)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public SelfDescribingValue(T value)+
| +Method Detail | +
|---|
+public void describeTo(Description description)+
SelfDescribing+
describeTo in interface SelfDescribingdescription - The description to be built or appended to.
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.internal.SelfDescribingValueIterator<T> +
public class SelfDescribingValueIterator<T>
+
| +Constructor Summary | +|
|---|---|
SelfDescribingValueIterator(java.util.Iterator<T> values)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ boolean |
+hasNext()
+
++ |
+
+ SelfDescribing |
+next()
+
++ |
+
+ void |
+remove()
+
++ |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public SelfDescribingValueIterator(java.util.Iterator<T> values)+
| +Method Detail | +
|---|
+public boolean hasNext()+
hasNext in interface java.util.Iterator<SelfDescribing>+public SelfDescribing next()+
next in interface java.util.Iterator<SelfDescribing>+public void remove()+
remove in interface java.util.Iterator<SelfDescribing>
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use ReflectiveTypeFinder | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| +Uses of ReflectiveTypeFinder in org.hamcrest | +
|---|
+ +
| Constructors in org.hamcrest with parameters of type ReflectiveTypeFinder | +|
|---|---|
TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)
+
++ Use this constructor if the subclass that implements matchesSafely
+ is not the class that binds <T> to a type. |
+|
TypeSafeMatcher(ReflectiveTypeFinder typeFinder)
+
++ Use this constructor if the subclass that implements matchesSafely
+ is not the class that binds <T> to a type. |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +ArrayIterator + +ReflectiveTypeFinder + +SelfDescribingValue + +SelfDescribingValueIterator |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Class Summary | +|
|---|---|
| ArrayIterator | ++ |
| ReflectiveTypeFinder | ++ |
| SelfDescribingValue<T> | ++ |
| SelfDescribingValueIterator<T> | ++ |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use org.hamcrest.internal | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| +Classes in org.hamcrest.internal used by org.hamcrest | +|
|---|---|
| ReflectiveTypeFinder
+
+ + |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.math.BigDecimal> +
org.hamcrest.number.BigDecimalCloseTo +
public class BigDecimalCloseTo
+
| +Constructor Summary | +|
|---|---|
BigDecimalCloseTo(java.math.BigDecimal value,
+ java.math.BigDecimal error)
+
++ |
+|
| +Method Summary | +|
|---|---|
+static Matcher<java.math.BigDecimal> |
+closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+
++ Creates a matcher of BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+
+ void |
+describeMismatchSafely(java.math.BigDecimal item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+ boolean |
+matchesSafely(java.math.BigDecimal item)
+
++ Subclasses should implement this. |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public BigDecimalCloseTo(java.math.BigDecimal value, + java.math.BigDecimal error)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.math.BigDecimal item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.math.BigDecimal>+public void describeMismatchSafely(java.math.BigDecimal item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.math.BigDecimal>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error)+
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"))))
++
operand - the expected value of matching BigDecimalserror - the delta (+/-) within which matches will be allowed
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.Double> +
org.hamcrest.number.IsCloseTo +
public class IsCloseTo
+Is the value a number equal to a value within some range of + acceptable error? +
+ +
+
| +Constructor Summary | +|
|---|---|
IsCloseTo(double value,
+ double error)
+
++ |
+|
| +Method Summary | +|
|---|---|
+static Matcher<java.lang.Double> |
+closeTo(double operand,
+ double error)
+
++ Creates a matcher of Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+
+ void |
+describeMismatchSafely(java.lang.Double item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+ boolean |
+matchesSafely(java.lang.Double item)
+
++ Subclasses should implement this. |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsCloseTo(double value, + double error)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.Double item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.lang.Double>+public void describeMismatchSafely(java.lang.Double item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.lang.Double>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.lang.Double> closeTo(double operand, + double error)+
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)))+
+
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowed
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<T> +
org.hamcrest.number.OrderingComparison<T> +
public class OrderingComparison<T extends java.lang.Comparable<T>>
+
| +Method Summary | +||
|---|---|---|
+static
+ |
+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. |
+|
+ void |
+describeMismatchSafely(T actual,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+static
+ |
+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
+ |
+greaterThanOrEqualTo(T value)
+
++ Creates a matcher of Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+|
+static
+ |
+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
+ |
+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. |
+|
+ boolean |
+matchesSafely(T actual)
+
++ Subclasses should implement this. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Method Detail | +
|---|
+public boolean matchesSafely(T actual)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<T extends java.lang.Comparable<T>>+public void describeMismatchSafely(T actual, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<T extends java.lang.Comparable<T>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)+
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))+
+
value - the value which, when passed to the compareTo method of the examined object, should return zero+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)+
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))+
+
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than zero+public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)+
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))+
+
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than or equal to zero+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)+
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))+
+
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than zero+public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)+
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))+
+
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than or equal to zero
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +BigDecimalCloseTo + +IsCloseTo + +OrderingComparison |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Class Summary | +|
|---|---|
| BigDecimalCloseTo | ++ |
| IsCloseTo | +Is the value a number equal to a value within some range of + acceptable error? | +
| OrderingComparison<T extends Comparable<T>> | ++ |
+
Matchers that perform numeric comparisons.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<T> +
org.hamcrest.FeatureMatcher<T,java.lang.String> +
org.hamcrest.object.HasToString<T> +
public class HasToString<T>
+
| +Constructor Summary | +|
|---|---|
HasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+protected java.lang.String |
+featureValueOf(T actual)
+
++ Implement this to extract the interesting feature. |
+|
+static
+ |
+hasToString(Matcher<? super java.lang.String> toStringMatcher)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value that satisfies the specified matcher. |
+|
+static
+ |
+hasToString(java.lang.String expectedToString)
+
++ Creates a matcher that matches any examined object whose toString method
+ returns a value equalTo the specified string. |
+|
| Methods inherited from class org.hamcrest.FeatureMatcher | +
|---|
describeTo, matchesSafely |
+
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public HasToString(Matcher<? super java.lang.String> toStringMatcher)+
| +Method Detail | +
|---|
+protected java.lang.String featureValueOf(T actual)+
FeatureMatcher+
featureValueOf in class FeatureMatcher<T,java.lang.String>actual - the target object
++public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)+
toString method
+ returns a value that satisfies the specified matcher.
+
+ For example:
+ assertThat(true, hasToString(equalTo("TRUE")))
++
toStringMatcher - the matcher used to verify the toString result+public static <T> Matcher<T> hasToString(java.lang.String expectedToString)+
toString method
+ returns a value equalTo the specified string.
+
+ For example:
+ assertThat(true, hasToString("TRUE"))
++
expectedToString - the expected toString result
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.Class<?>> +
org.hamcrest.object.IsCompatibleType<T> +
public class IsCompatibleType<T>
+
| +Constructor Summary | +|
|---|---|
IsCompatibleType(java.lang.Class<T> type)
+
++ |
+|
| +Method Summary | +||
|---|---|---|
+ void |
+describeMismatchSafely(java.lang.Class<?> cls,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+|
+ boolean |
+matchesSafely(java.lang.Class<?> cls)
+
++ Subclasses should implement this. |
+|
+static
+ |
+typeCompatibleWith(java.lang.Class<T> baseType)
+
++ Creates a matcher of Class that matches when the specified baseType is
+ assignable from the examined class. |
+|
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsCompatibleType(java.lang.Class<T> type)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.Class<?> cls)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.lang.Class<?>>+public void describeMismatchSafely(java.lang.Class<?> cls, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.lang.Class<?>>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)+
Class that matches when the specified baseType is
+ assignable from the examined class.
+
+ For example:
+ assertThat(Integer.class, typeCompatibleWith(Number.class))+
+
baseType - the base class to examine classes against
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<java.util.EventObject> +
org.hamcrest.object.IsEventFrom +
public class IsEventFrom
+Tests if the value is an event announced by a specific object. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsEventFrom(java.lang.Class<?> eventClass,
+ java.lang.Object source)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any object
+ derived from eventClass announced by source. |
+
+static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Object source)
+
++ Creates a matcher of EventObject that matches any EventObject
+ announced by source. |
+
+ boolean |
+matchesSafely(java.util.EventObject item,
+ Description mismatchDescription)
+
++ Subclasses should implement this. |
+
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsEventFrom(java.lang.Class<?> eventClass, + java.lang.Object source)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.util.EventObject item, + Description mismatchDescription)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<java.util.EventObject>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source)+
EventObject that matches any object
+ derived from eventClass announced by source.
+
+ For example:
+ assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))+
+
eventClass - the class of the event to match onsource - the source of the event+public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)+
EventObject that matches any EventObject
+ announced by source.
+
+ For example:
+ assertThat(myEvent, is(eventFrom(myBean)))+
+
source - the source of the event
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +HasToString + +IsCompatibleType + +IsEventFrom |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Class Summary | +|
|---|---|
| HasToString<T> | ++ |
| IsCompatibleType<T> | ++ |
| IsEventFrom | +Tests if the value is an event announced by a specific object. | +
+
Matchers that inspect objects and classes.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Interfaces
+
+ +Condition.Step + +Description + +Matcher + +SelfDescribing |
+
|
+Classes
+
+ +BaseDescription + +BaseMatcher + +Condition + +CoreMatchers + +CustomMatcher + +CustomTypeSafeMatcher + +Description.NullDescription + +DiagnosingMatcher + +EasyMock2Matchers + +FeatureMatcher + +JavaLangMatcherAssert + +JMock1Matchers + +MatcherAssert + +Matchers + +StringDescription + +TypeSafeDiagnosingMatcher + +TypeSafeMatcher |
+
|
+Annotation Types
+
+ +Factory |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Interface Summary | +|
|---|---|
| Condition.Step<I,O> | ++ |
| Description | +A description of a Matcher. | +
| Matcher<T> | +A matcher over acceptable values. | +
| SelfDescribing | +The ability of an object to describe itself. | +
+ +
| +Class Summary | +|
|---|---|
| BaseDescription | +A Description that is stored as a string. |
+
| BaseMatcher<T> | +BaseClass for all Matcher implementations. | +
| Condition<T> | +A Condition implements part of a multi-step match. | +
| CoreMatchers | ++ |
| CustomMatcher<T> | +Utility class for writing one off matchers. | +
| CustomTypeSafeMatcher<T> | +Utility class for writing one off matchers. | +
| Description.NullDescription | ++ |
| DiagnosingMatcher<T> | +TODO(ngd): Document. | +
| EasyMock2Matchers | ++ |
| FeatureMatcher<T,U> | +Supporting class for matching a feature of an object. | +
| JavaLangMatcherAssert | +Integration method for use with Java's assert keyword. |
+
| JMock1Matchers | ++ |
| MatcherAssert | ++ |
| Matchers | ++ |
| StringDescription | +A Description that is stored as a string. |
+
| TypeSafeDiagnosingMatcher<T> | +Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. | +
| TypeSafeMatcher<T> | +Convenient base class for Matchers that require a non-null value of a specific type. | +
+ +
| +Annotation Types Summary | +|
|---|---|
| Factory | +Marks a Hamcrest static factory method so tools recognise them. | +
+
The stable API defining Matcher and its associated interfaces and classes. + Hamcrest sub-projects define their convenience classes in the org.hamcrest package. +
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| +Packages that use org.hamcrest | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.integration | ++ |
| org.hamcrest.internal | ++ |
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
| +Classes in org.hamcrest used by org.hamcrest | +|
|---|---|
| BaseDescription
+
+ + A Description that is stored as a string. |
+|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Condition
+
+ + A Condition implements part of a multi-step match. |
+|
| Condition.Step
+
+ + |
+|
| Description
+
+ + A description of a Matcher. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeDiagnosingMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+|
| TypeSafeMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type. |
+|
| +Classes in org.hamcrest used by org.hamcrest.beans | +|
|---|---|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Description
+
+ + A description of a Matcher. |
+|
| DiagnosingMatcher
+
+ + TODO(ngd): Document. |
+|
| Factory
+
+ + Marks a Hamcrest static factory method so tools recognise them. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeDiagnosingMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+|
| TypeSafeMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type. |
+|
| +Classes in org.hamcrest used by org.hamcrest.collection | +|
|---|---|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Description
+
+ + A description of a Matcher. |
+|
| Factory
+
+ + Marks a Hamcrest static factory method so tools recognise them. |
+|
| FeatureMatcher
+
+ + Supporting class for matching a feature of an object. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeDiagnosingMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+|
| TypeSafeMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type. |
+|
| +Classes in org.hamcrest used by org.hamcrest.core | +|
|---|---|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Description
+
+ + A description of a Matcher. |
+|
| DiagnosingMatcher
+
+ + TODO(ngd): Document. |
+|
| Factory
+
+ + Marks a Hamcrest static factory method so tools recognise them. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeDiagnosingMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+|
| TypeSafeMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type. |
+|
| +Classes in org.hamcrest used by org.hamcrest.integration | +|
|---|---|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| +Classes in org.hamcrest used by org.hamcrest.internal | +|
|---|---|
| Description
+
+ + A description of a Matcher. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| +Classes in org.hamcrest used by org.hamcrest.number | +|
|---|---|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Description
+
+ + A description of a Matcher. |
+|
| Factory
+
+ + Marks a Hamcrest static factory method so tools recognise them. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type. |
+|
| +Classes in org.hamcrest used by org.hamcrest.object | +|
|---|---|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Description
+
+ + A description of a Matcher. |
+|
| Factory
+
+ + Marks a Hamcrest static factory method so tools recognise them. |
+|
| FeatureMatcher
+
+ + Supporting class for matching a feature of an object. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeDiagnosingMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+|
| TypeSafeMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type. |
+|
| +Classes in org.hamcrest used by org.hamcrest.text | +|
|---|---|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Description
+
+ + A description of a Matcher. |
+|
| Factory
+
+ + Marks a Hamcrest static factory method so tools recognise them. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type. |
+|
| +Classes in org.hamcrest used by org.hamcrest.xml | +|
|---|---|
| BaseMatcher
+
+ + BaseClass for all Matcher implementations. |
+|
| Description
+
+ + A description of a Matcher. |
+|
| Factory
+
+ + Marks a Hamcrest static factory method so tools recognise them. |
+|
| Matcher
+
+ + A matcher over acceptable values. |
+|
| SelfDescribing
+
+ + The ability of an object to describe itself. |
+|
| TypeSafeDiagnosingMatcher
+
+ + Convenient base class for Matchers that require a non-null value of a specific type + and that will report why the received value has been rejected. |
+|
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<java.lang.String> +
org.hamcrest.text.IsEmptyString +
public final class IsEmptyString
+Matches empty Strings (and null). +
+ +
+
| +Constructor Summary | +|
|---|---|
IsEmptyString()
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+static Matcher<java.lang.String> |
+isEmptyOrNullString()
+
++ Creates a matcher of String that matches when the examined string is null, or
+ has zero length. |
+
+static Matcher<java.lang.String> |
+isEmptyString()
+
++ Creates a matcher of String that matches when the examined string has zero length. |
+
+ boolean |
+matches(java.lang.Object item)
+
++ Evaluates the matcher for argument item. |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsEmptyString()+
| +Method Detail | +
|---|
+public boolean matches(java.lang.Object item)+
Matcher+
item - the object against which the matcher is evaluated.
+true if item matches, otherwise false.BaseMatcher+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.lang.String> isEmptyString()+
String that matches when the examined string has zero length.
+
+ For example:
+ assertThat("", isEmptyString())
++
+public static Matcher<java.lang.String> isEmptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+
+ For example:
+ assertThat(((String)null), isEmptyString())+
+
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.String> +
org.hamcrest.text.IsEqualIgnoringCase +
public class IsEqualIgnoringCase
+Tests if a string is equal to another string, regardless of the case. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsEqualIgnoringCase(java.lang.String string)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+static Matcher<java.lang.String> |
+equalToIgnoringCase(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+
+ boolean |
+matchesSafely(java.lang.String item)
+
++ Subclasses should implement this. |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsEqualIgnoringCase(java.lang.String string)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.String item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.lang.String>+public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)+
String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+
+ For example:
+ assertThat("Foo", equalToIgnoringCase("FOO"))
++
expectedString - the expected value of matched strings
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.String> +
org.hamcrest.text.IsEqualIgnoringWhiteSpace +
public class IsEqualIgnoringWhiteSpace
+Tests if a string is equal to another string, ignoring any changes in whitespace. +
+ +
+
| +Constructor Summary | +|
|---|---|
IsEqualIgnoringWhiteSpace(java.lang.String string)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+static Matcher<java.lang.String> |
+equalToIgnoringWhiteSpace(java.lang.String expectedString)
+
++ Creates a matcher of String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+
+ boolean |
+matchesSafely(java.lang.String item)
+
++ Subclasses should implement this. |
+
+ java.lang.String |
+stripSpace(java.lang.String toBeStripped)
+
++ |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public IsEqualIgnoringWhiteSpace(java.lang.String string)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.String item)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.lang.String>+public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public java.lang.String stripSpace(java.lang.String toBeStripped)+
+public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)+
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:
+ assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))
++
expectedString - the expected value of matched strings
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeMatcher<java.lang.String> +
org.hamcrest.text.StringContainsInOrder +
public class StringContainsInOrder
+
| +Constructor Summary | +|
|---|---|
StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+
++ Subclasses should override this. |
+
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+ boolean |
+matchesSafely(java.lang.String s)
+
++ Subclasses should implement this. |
+
+static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+
++ Creates a matcher of String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance. |
+
| Methods inherited from class org.hamcrest.TypeSafeMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Constructor Detail | +
|---|
+public StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
| +Method Detail | +
|---|
+public boolean matchesSafely(java.lang.String s)+
TypeSafeMatcher+
matchesSafely in class TypeSafeMatcher<java.lang.String>+public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcher+
describeMismatchSafely in class TypeSafeMatcher<java.lang.String>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
String that matches when the examined string contains all of
+ the specified substrings, regardless of the order of their appearance.
+
+ For example:
+ assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
++
substrings - the substrings that must be contained within matching strings
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +IsEmptyString + +IsEqualIgnoringCase + +IsEqualIgnoringWhiteSpace + +StringContainsInOrder |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Class Summary | +|
|---|---|
| IsEmptyString | +Matches empty Strings (and null). | +
| IsEqualIgnoringCase | +Tests if a string is equal to another string, regardless of the case. | +
| IsEqualIgnoringWhiteSpace | +Tests if a string is equal to another string, ignoring any changes in whitespace. | +
| StringContainsInOrder | ++ |
+
Matchers that perform text comparisons.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+java.lang.Object ++org.hamcrest.BaseMatcher<T> +
org.hamcrest.TypeSafeDiagnosingMatcher<org.w3c.dom.Node> +
org.hamcrest.xml.HasXPath +
public class HasXPath
+Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression. +
+ +
+
| +Field Summary | +|
|---|---|
+static javax.xml.namespace.NamespaceContext |
+NO_NAMESPACE_CONTEXT
+
++ |
+
| +Constructor Summary | +|
|---|---|
HasXPath(java.lang.String xPathExpression,
+ Matcher<java.lang.String> valueMatcher)
+
++ |
+|
HasXPath(java.lang.String xPathExpression,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ |
+|
| +Method Summary | +|
|---|---|
+ void |
+describeTo(Description description)
+
++ Generates a description of the object. |
+
+static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+
+static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
+static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+
++ Creates a matcher of Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+
+static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+
++ Creates a matcher of Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
+ boolean |
+matchesSafely(org.w3c.dom.Node item,
+ Description mismatch)
+
++ Subclasses should implement this. |
+
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher | +
|---|
describeMismatch, matches |
+
| Methods inherited from class org.hamcrest.BaseMatcher | +
|---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
+
| Methods inherited from class java.lang.Object | +
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
+
| +Field Detail | +
|---|
+public static final javax.xml.namespace.NamespaceContext NO_NAMESPACE_CONTEXT+
| +Constructor Detail | +
|---|
+public HasXPath(java.lang.String xPathExpression, + Matcher<java.lang.String> valueMatcher)+
xPathExpression - XPath expression.valueMatcher - Matcher to use at given XPath.
+ May be null to specify that the XPath must exist but the value is irrelevant.+public HasXPath(java.lang.String xPathExpression, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
xPathExpression - XPath expression.namespaceContext - Resolves XML namespace prefixes in the XPath expressionvalueMatcher - Matcher to use at given XPath.
+ May be null to specify that the XPath must exist but the value is irrelevant.| +Method Detail | +
|---|
+public boolean matchesSafely(org.w3c.dom.Node item, + Description mismatch)+
TypeSafeDiagnosingMatcher+
matchesSafely in class TypeSafeDiagnosingMatcher<org.w3c.dom.Node>+public void describeTo(Description description)+
SelfDescribing+
description - The description to be built or appended to.+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher)+
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")))
++
xPath - the target xpathvalueMatcher - matcher for the value at the specified xpath+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
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")))
++
xPath - the target xpathnamespaceContext - the namespace for matching nodesvalueMatcher - matcher for the value at the specified xpath+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)+
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"))
++
xPath - the target xpath+public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext)+
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))
++
xPath - the target xpathnamespaceContext - the namespace for matching nodes
+
+
|
++ + | +|||||||||
| + PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
|
+Classes
+
+ +HasXPath |
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Class Summary | +|
|---|---|
| HasXPath | +Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression. | +
+
Matchers of XML documents.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
| + | +
|---|
| All Classes
+
+
+Packages
+ |
+
+ + + diff --git a/docs/javadoc/1.3/overview-summary.html b/docs/javadoc/1.3/overview-summary.html new file mode 100644 index 00000000..74687e8d --- /dev/null +++ b/docs/javadoc/1.3/overview-summary.html @@ -0,0 +1,221 @@ + + + +
+ +
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+See:
+
+ Description
+
+ +
| +Hamcrest API and Utility Classes | +|
|---|---|
| org.hamcrest | +The stable API defining Matcher and its associated interfaces and classes. | +
+ +
| +Matcher Library | +|
|---|---|
| org.hamcrest.beans | +Matchers of Java Bean properties and their values. | +
| org.hamcrest.collection | +Matchers of arrays and collections. | +
| org.hamcrest.core | +Fundamental matchers of objects and values, and composite matchers. | +
| org.hamcrest.internal | ++ |
| org.hamcrest.number | +Matchers that perform numeric comparisons. | +
| org.hamcrest.object | +Matchers that inspect objects and classes. | +
| org.hamcrest.text | +Matchers that perform text comparisons. | +
| org.hamcrest.xml | +Matchers of XML documents. | +
+ +
| +Integration | +|
|---|---|
| org.hamcrest.integration | ++ |
+
Hamcrest is a library of matchers, which can be combined in +to create flexible expressions of intent in tests.
+ +Documentation can be found at: http://hamcrest.org/.
++ +
+
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
+
+
|
++ + | +|||||||||
| + PREV + NEXT | ++ FRAMES + NO FRAMES + + + + + | +|||||||||
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.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.Maps that matches when the size() method returns
+ a value equal to the specified size.Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.Maps that matches when the size() method returns
+ a value equal to the specified size.Maps that matches when the size() method returns
+ zero.Maps that matches when the size() method returns
+ zero.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.String.String.String.SelfDescribing value to this description.SelfDescribing objects
+ to the description.length of the array
+ satisfies the specified matcher.length of the array
+ equals the specified size.length of the array
+ satisfies the specified matcher.length of the array
+ equals the specified size.StringDescription.toString(SelfDescribing).Description that is stored as a string.String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error.BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error.BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error.Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error.Comparatorss of T.T object that matches when the examined object is
+ equal to the specified value, as reported by the Comparator used to
+ create this builder.Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object.Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object.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.Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.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.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.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.Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.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.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.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.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.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.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.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.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.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: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.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.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: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.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.String contains the specified
+ String anywhere.String contains the specified
+ String anywhere.String contains the specified
+ String anywhere.String contains the specified
+ String anywhere, ignoring case.String contains the specified
+ String anywhere, ignoring case.String contains the specified
+ String anywhere, ignoring case.Collections matching examined collections whose isEmpty
+ method returns true.Collections matching examined collections whose isEmpty
+ method returns true.length of the array
+ is zero.length of the array
+ is zero.Collections matching examined collections whose isEmpty
+ method returns true.Collections matching examined collections whose isEmpty
+ method returns true.Iterables matching examined iterables that yield no items.Iterables matching examined iterables that yield no items.Iterables matching examined iterables that yield no items.Iterables matching examined iterables that yield no items.String that matches when the examined string is null, or
+ has zero length.String that matches when the examined string is null, or
+ has zero length.String that matches when the examined string has zero length.String that matches when the examined string has zero length.String ends with the specified
+ String.String ends with the specified
+ String.String ends with the specified
+ String.String ends with the specified
+ String, ignoring case.String ends with the specified
+ String, ignoring case.String ends with the specified
+ String, ignoring case.operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored.String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored.IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.EventObject that matches any object
+ derived from eventClass announced by source.EventObject that matches any EventObject
+ announced by source.EventObject that matches any object
+ derived from eventClass announced by source.EventObject that matches any EventObject
+ announced by source.Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.T object that matches when the examined object is
+ greater than the specified value, as reported by the Comparator used to
+ create this builder.Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object.Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object.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.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.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.Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value.Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.elementMatcher.hasItemInArray(equalTo(x)).elementMatcher.hasItemInArray(equalTo(x)).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.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.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.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.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.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.Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.Collections that matches when the size() method returns
+ a value that satisfies the specified matcher.Collections that matches when the size() method returns
+ a value equal to the specified size.Collections that matches when the size() method returns
+ a value that satisfies the specified matcher.Collections that matches when the size() method returns
+ a value equal to the specified size.toString method
+ returns a value that satisfies the specified matcher.toString method
+ returns a value equalTo the specified string.toString method
+ returns a value that satisfies the specified matcher.toString method
+ returns a value equalTo the specified string.Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher.Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher.Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content.Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content.Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher.Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher.Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content.Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.is(equalTo(x)).is(equalTo(x)).is(equalTo(x)).is(instanceOf(SomeClass.class)).is(instanceOf(SomeClass.class)).is(instanceOf(SomeClass.class)).true.Object.equals(java.lang.Object) invokedMethod?Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher.Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument.Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher.Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument.T object that matches when the examined object is
+ less than the specified value, as reported by the Comparator used to
+ create this builder.Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object.Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object.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.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.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.String that matches when the examined string
+ exactly matches the given Pattern.String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.String that matches when the examined string
+ exactly matches the given Pattern.String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.not(equalTo(x)).not(equalTo(x)).not(equalTo(x)).Doubles that matches when an examined double is not a number.Doubles that matches when an examined double is not a number.not(nullValue()).not(nullValue(X.class)).not(nullValue()).not(nullValue(X.class)).not(nullValue()).not(nullValue(X.class)).null.null.null.null.null.null.String starts with the specified
+ String.String starts with the specified
+ String.String starts with the specified
+ String.String starts with the specified
+ String, ignoring caseString starts with the specified
+ String, ignoring caseString starts with the specified
+ String, ignoring caseString that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.Description that is stored as a string.SelfDescribing object as a String.Class that matches when the specified baseType is
+ assignable from the examined class.Class that matches when the specified baseType is
+ assignable from the examined class.matchesSafely
+ is not the class that binds <T> to a type.matchesSafely
+ is not the class that binds <T> to a type.matchesSafely
+ is not the class that binds <T> to a type.matchesSafely
+ is not the class that binds <T> to a type.Comparables.This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version.
+public abstract class BaseDescription +extends java.lang.Object +implements Description+
Description that is stored as a string.Description.NullDescriptionNONE| Constructor and Description | +
|---|
BaseDescription() |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected abstract void |
+append(char c)
+Append the char c to the description.
+ |
+
protected void |
+append(java.lang.String str)
+Append the String str to the description.
+ |
+
Description |
+appendDescriptionOf(SelfDescribing value)
+Appends the description of a
+SelfDescribing value to this description. |
+
Description |
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+Appends a list of
+SelfDescribing objects
+ to the description. |
+
Description |
+appendText(java.lang.String text)
+Appends some plain text to the description.
+ |
+
Description |
+appendValue(java.lang.Object value)
+Appends an arbitrary value to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+Appends a list of values to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+Appends a list of values to the description.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Description appendText(java.lang.String text)+
DescriptionappendText in interface Descriptionpublic Description appendDescriptionOf(SelfDescribing value)+
DescriptionSelfDescribing value to this description.appendDescriptionOf in interface Descriptionpublic Description appendValue(java.lang.Object value)+
DescriptionappendValue in interface Descriptionpublic <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values)+
DescriptionappendValueList in interface Descriptionpublic <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values)+
DescriptionappendValueList in interface Descriptionpublic Description appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values)+
DescriptionSelfDescribing objects
+ to the description.appendList in interface Descriptionprotected void append(java.lang.String str)+
append(char).
+ Override in subclasses to provide an efficient implementation.protected abstract void append(char c)+
public abstract class BaseMatcher<T> +extends java.lang.Object +implements Matcher<T>+
Matcher| Constructor and Description | +
|---|
BaseMatcher() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+_dont_implement_Matcher___instead_extend_BaseMatcher_()
+Deprecated.
+ |
+
void |
+describeMismatch(java.lang.Object item,
+ Description description)
+Generate a description of why the matcher has not accepted the item.
+ |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeTo@Deprecated +public final void _dont_implement_Matcher___instead_extend_BaseMatcher_()+
Matcher_dont_implement_Matcher___instead_extend_BaseMatcher_ in interface Matcher<T>Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_()public void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.public java.lang.String toString()+
toString in class java.lang.Object| Modifier and Type | +Method and Description | +
|---|---|
Condition<O> |
+apply(I value,
+ Description mismatch) |
+
public abstract class Condition<T>
+extends java.lang.Object
+| Modifier and Type | +Class and Description | +
|---|---|
static interface |
+Condition.Step<I,O> |
+
| Modifier and Type | +Field and Description | +
|---|---|
static org.hamcrest.Condition.NotMatched<java.lang.Object> |
+NOT_MATCHED |
+
| Modifier and Type | +Method and Description | +
|---|---|
abstract <U> Condition<U> |
+and(Condition.Step<? super T,U> mapping) |
+
static <T> Condition<T> |
+matched(T theValue,
+ Description mismatch) |
+
boolean |
+matching(Matcher<T> match) |
+
abstract boolean |
+matching(Matcher<T> match,
+ java.lang.String message) |
+
static <T> Condition<T> |
+notMatched() |
+
<U> Condition<U> |
+then(Condition.Step<? super T,U> mapping) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final org.hamcrest.Condition.NotMatched<java.lang.Object> NOT_MATCHED+
public abstract <U> Condition<U> and(Condition.Step<? super T,U> mapping)+
public final <U> Condition<U> then(Condition.Step<? super T,U> mapping)+
public static <T> Condition<T> notMatched()+
public static <T> Condition<T> matched(T theValue, + Description mismatch)+
public class CoreMatchers
+extends java.lang.Object
+| Constructor and Description | +
|---|
CoreMatchers() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+any(java.lang.Class<T> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> AnyOf<T> |
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static Matcher<java.lang.Object> |
+anything()
+Creates a matcher that always matches, regardless of the examined object.
+ |
+
static Matcher<java.lang.Object> |
+anything(java.lang.String description)
+Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified
+String. |
+
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
+both(Matcher<? super LHS> matcher)
+Creates a matcher that matches when both of the specified matchers match the examined object.
+ |
+
static Matcher<java.lang.String> |
+containsString(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere. |
+
static Matcher<java.lang.String> |
+containsStringIgnoringCase(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere, ignoring case. |
+
static <T> Matcher<T> |
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+Wraps an existing matcher, overriding its description with that specified.
+ |
+
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
+either(Matcher<? super LHS> matcher)
+Creates a matcher that matches when either of the specified matchers match the examined object.
+ |
+
static Matcher<java.lang.String> |
+endsWith(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String. |
+
static Matcher<java.lang.String> |
+endsWithIgnoringCase(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String, ignoring case. |
+
static <T> Matcher<T> |
+equalTo(T operand)
+Creates a matcher that matches when the examined object is logically equal to the specified
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+
static Matcher<java.lang.Object> |
+equalToObject(java.lang.Object operand)
+Creates an
+IsEqual matcher that does not enforce the values being
+ compared to be of the same static type. |
+
static <U> Matcher<java.lang.Iterable<? extends U>> |
+everyItem(Matcher<U> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(Matcher<? super T> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(T item)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(Matcher<? super T>... itemMatchers)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(T... items)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+
static <T> Matcher<T> |
+instanceOf(java.lang.Class<?> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> Matcher<T> |
+is(Matcher<T> matcher)
+Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+ |
+
static <T> Matcher<T> |
+is(T value)
+A shortcut to the frequently used
+is(equalTo(x)). |
+
static <T> Matcher<T> |
+isA(java.lang.Class<T> type)
+A shortcut to the frequently used
+is(instanceOf(SomeClass.class)). |
+
static <T> Matcher<T> |
+not(Matcher<T> matcher)
+Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+ |
+
static <T> Matcher<T> |
+not(T value)
+A shortcut to the frequently used
+not(equalTo(x)). |
+
static Matcher<java.lang.Object> |
+notNullValue()
+A shortcut to the frequently used
+not(nullValue()). |
+
static <T> Matcher<T> |
+notNullValue(java.lang.Class<T> type)
+A shortcut to the frequently used
+not(nullValue(X.class)). |
+
static Matcher<java.lang.Object> |
+nullValue()
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+nullValue(java.lang.Class<T> type)
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+sameInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static Matcher<java.lang.String> |
+startsWith(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String. |
+
static Matcher<java.lang.String> |
+startsWithIgnoringCase(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String, ignoring case |
+
static <T> Matcher<T> |
+theInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))@SafeVarargs +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))@SafeVarargs +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)+
assertThat("fab", both(containsString("a")).and(containsString("b")))public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)+
assertThat("fan", either(containsString("a")).or(containsString("b")))public static <T> Matcher<T> describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values)+
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised descriptionpublic static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)+
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")))itemMatcher - the matcher to apply to every item provided by the examined Iterablepublic static <T> Matcher<T> is(Matcher<T> matcher)+
assertThat(cheese, is(equalTo(smelly)))+ instead of: +
assertThat(cheese, equalTo(smelly))
public static <T> Matcher<T> is(T value)+
is(equalTo(x)).
+ For example:
+ assertThat(cheese, is(smelly))+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
public static <T> Matcher<T> isA(java.lang.Class<T> type)+
is(instanceOf(SomeClass.class)).
+ For example:
+ assertThat(cheese, isA(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
public static Matcher<java.lang.Object> anything()+
public static Matcher<java.lang.Object> anything(java.lang.String description)+
String.description - a meaningful String used when describing itselfpublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
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")))itemMatcher - the matcher to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
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"))item - the item to compare against the items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
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")))itemMatchers - the matchers to apply to items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
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"))items - the items to compare against the items provided by the examined Iterablepublic static <T> Matcher<T> equalTo(T operand)+
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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)+
IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.public static <T> Matcher<T> any(java.lang.Class<T> type)+
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))
assertThat(new Canoe(), instanceOf(Canoe.class));
public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)+
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));
public static <T> Matcher<T> not(Matcher<T> matcher)+
assertThat(cheese, is(not(equalTo(smelly))))
matcher - the matcher whose sense should be invertedpublic static <T> Matcher<T> not(T value)+
not(equalTo(x)).
+ For example:
+ assertThat(cheese, is(not(smelly)))+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
value - the value that any examined object should not equalpublic static Matcher<java.lang.Object> notNullValue()+
not(nullValue()).
+ For example:
+ assertThat(cheese, is(notNullValue()))+ instead of: +
assertThat(cheese, is(not(nullValue())))
public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)+
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 - dummy parameter used to infer the generic type of the returned matcherpublic static Matcher<java.lang.Object> nullValue()+
null.
+ For example:
+ assertThat(cheese, is(nullValue())
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)+
null. Accepts a
+ single dummy argument to facilitate type inference.
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
type - dummy parameter used to infer the generic type of the returned matcherpublic static <T> Matcher<T> sameInstance(T target)+
target - the target instance against which others should be assessedpublic static <T> Matcher<T> theInstance(T target)+
target - the target instance against which others should be assessedpublic static Matcher<java.lang.String> containsString(java.lang.String substring)+
String contains the specified
+ String anywhere.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)+
String contains the specified
+ String anywhere, ignoring case.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> startsWith(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String, ignoring case
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> endsWith(java.lang.String suffix)+
String ends with the specified
+ String.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)+
String ends with the specified
+ String, ignoring case.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringT - The type of object being matched.public abstract class CustomMatcher<T> +extends BaseMatcher<T>+
+ 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.
| Constructor and Description | +
|---|
CustomMatcher(java.lang.String description) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic CustomMatcher(java.lang.String description)+
public final void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.T - The type of object being matchedpublic abstract class CustomTypeSafeMatcher<T> +extends TypeSafeMatcher<T>+
+ Matcher<String> aNonEmptyString = new CustomTypeSafeMatcher<String>("a non empty string") {
+ public boolean matchesSafely(String string) {
+ return !string.isEmpty();
+ }
+ public void describeMismatchSafely(String string, Description mismatchDescription) {
+ mismatchDescription.appendText("was empty");
+ }
+ };
+
+ This is a variant of CustomMatcher that first type checks
+ the argument being matched. By the time TypeSafeMatcher.matchesSafely(T) is
+ is called the argument is guaranteed to be non-null and of the correct
+ type.| Constructor and Description | +
|---|
CustomTypeSafeMatcher(java.lang.String description) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
describeMismatch, describeMismatchSafely, matches, matchesSafely_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic CustomTypeSafeMatcher(java.lang.String description)+
public final void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static final class Description.NullDescription +extends java.lang.Object +implements Description+
Description.NullDescriptionNONE| Constructor and Description | +
|---|
NullDescription() |
+
| Modifier and Type | +Method and Description | +
|---|---|
Description |
+appendDescriptionOf(SelfDescribing value)
+Appends the description of a
+SelfDescribing value to this description. |
+
Description |
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+Appends a list of
+SelfDescribing objects
+ to the description. |
+
Description |
+appendText(java.lang.String text)
+Appends some plain text to the description.
+ |
+
Description |
+appendValue(java.lang.Object value)
+Appends an arbitrary value to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+Appends a list of values to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+Appends a list of values to the description.
+ |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic Description appendDescriptionOf(SelfDescribing value)+
DescriptionSelfDescribing value to this description.appendDescriptionOf in interface Descriptionpublic Description appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values)+
DescriptionSelfDescribing objects
+ to the description.appendList in interface Descriptionpublic Description appendText(java.lang.String text)+
DescriptionappendText in interface Descriptionpublic Description appendValue(java.lang.Object value)+
DescriptionappendValue in interface Descriptionpublic <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values)+
DescriptionappendValueList in interface Descriptionpublic <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values)+
DescriptionappendValueList in interface Descriptionpublic java.lang.String toString()+
toString in class java.lang.Objectpublic interface Description
+SelfDescribing.describeTo(Description)| Modifier and Type | +Interface and Description | +
|---|---|
static class |
+Description.NullDescription |
+
| Modifier and Type | +Field and Description | +
|---|---|
static Description |
+NONE
+A description that consumes input but does nothing.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Description |
+appendDescriptionOf(SelfDescribing value)
+Appends the description of a
+SelfDescribing value to this description. |
+
Description |
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+Appends a list of
+SelfDescribing objects
+ to the description. |
+
Description |
+appendText(java.lang.String text)
+Appends some plain text to the description.
+ |
+
Description |
+appendValue(java.lang.Object value)
+Appends an arbitrary value to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+Appends a list of values to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+Appends a list of values to the description.
+ |
+
static final Description NONE+
Description appendText(java.lang.String text)+
Description appendDescriptionOf(SelfDescribing value)+
SelfDescribing value to this description.Description appendValue(java.lang.Object value)+
<T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values)+
<T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values)+
Description appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values)+
SelfDescribing objects
+ to the description.T - public abstract class DiagnosingMatcher<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
DiagnosingMatcher() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
boolean |
+matches(java.lang.Object item)
+Evaluates the matcher for argument item.
+ |
+
protected abstract boolean |
+matches(java.lang.Object item,
+ Description mismatchDescription) |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeTopublic final boolean matches(java.lang.Object item)+
Matcheritem - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic final void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.protected abstract boolean matches(java.lang.Object item, + Description mismatchDescription)+
T - The type of the object to be matchedU - The type of the feature to be matchedpublic abstract class FeatureMatcher<T,U> +extends TypeSafeDiagnosingMatcher<T>+
featureValueOf()
+ in a subclass to pull out the feature to be matched against.| Constructor and Description | +
|---|
FeatureMatcher(Matcher<? super U> subMatcher,
+ java.lang.String featureDescription,
+ java.lang.String featureName)
+Constructor
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected abstract U |
+featureValueOf(T actual)
+Implement this to extract the interesting feature.
+ |
+
protected boolean |
+matchesSafely(T actual,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic FeatureMatcher(Matcher<? super U> subMatcher, + java.lang.String featureDescription, + java.lang.String featureName)+
subMatcher - The matcher to apply to the featurefeatureDescription - Descriptive text to use in describeTofeatureName - Identifying text for mismatch messageprotected abstract U featureValueOf(T actual)+
actual - the target objectprotected boolean matchesSafely(T actual, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public final void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.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.
+
+ N.B. Well designed matchers should be immutable. +
BaseMatcher| Modifier and Type | +Method and Description | +
|---|---|
void |
+_dont_implement_Matcher___instead_extend_BaseMatcher_()
+Deprecated.
+
+to make
+ |
+
void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
boolean |
+matches(java.lang.Object item)
+Evaluates the matcher for argument item.
+ |
+
describeToboolean matches(java.lang.Object item)+
item - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatchervoid describeMismatch(java.lang.Object item, + Description mismatchDescription)+
matches(item) is false, but
+ will not check this.item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.@Deprecated +void _dont_implement_Matcher___instead_extend_BaseMatcher_()+
for reasons why.,
+BaseMatcherpublic class MatcherAssert
+extends java.lang.Object
+| Constructor and Description | +
|---|
MatcherAssert() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static void |
+assertThat(java.lang.String reason,
+ boolean assertion) |
+
static <T> void |
+assertThat(java.lang.String reason,
+ T actual,
+ Matcher<? super T> matcher) |
+
static <T> void |
+assertThat(T actual,
+ Matcher<? super T> matcher) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T> void assertThat(T actual, + Matcher<? super T> matcher)+
public static <T> void assertThat(java.lang.String reason, + T actual, + Matcher<? super T> matcher)+
public static void assertThat(java.lang.String reason, + boolean assertion)+
public class Matchers
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(int size)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value equal to the specified size. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+anEmptyMap()
+Creates a matcher for
+Maps that matches when the size() method returns
+ zero. |
+
static <T> Matcher<T> |
+any(java.lang.Class<T> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> AnyOf<T> |
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static Matcher<java.lang.Object> |
+anything()
+Creates a matcher that always matches, regardless of the examined object.
+ |
+
static Matcher<java.lang.Object> |
+anything(java.lang.String description)
+Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified
+String. |
+
static <T> IsArray<T> |
+array(Matcher<? super T>... elementMatchers)
+Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(E... items)
+Creates a matcher for arrays that matches when each item in the examined array is
+ logically equal to the corresponding item in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified list of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(Matcher<? super E>... itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified collection of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(E... items)
+Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array is logically equal to one item anywhere in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayWithSize(int size)
+Creates a matcher for arrays that matches when the
+length of the array
+ equals the specified size. |
+
static <E> Matcher<E[]> |
+arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for arrays that matches when the
+length of the array
+ satisfies the specified matcher. |
+
static Matcher<java.lang.String> |
+blankOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else. |
+
static Matcher<java.lang.String> |
+blankString()
+Creates a matcher of
+String that matches when the examined string contains
+ zero or more whitespace characters and nothing else. |
+
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
+both(Matcher<? super LHS> matcher)
+Creates a matcher that matches when both of the specified matchers match the examined object.
+ |
+
static Matcher<java.math.BigDecimal> |
+closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+Creates a matcher of
+BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+
static Matcher<java.lang.Double> |
+closeTo(double operand,
+ double error)
+Creates a matcher of
+Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+
static <T extends java.lang.Comparable<T>> |
+comparesEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E> itemMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(T... items)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items logically equal to the
+ corresponding item in the specified items, in the same relative order
+ For example: |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items satisfying the corresponding
+ matcher in the specified list of matchers, in the same relative order. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that each satisfying the corresponding
+ matcher in the specified matchers, in the same relative order. |
+
static Matcher<java.lang.String> |
+containsString(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere. |
+
static Matcher<java.lang.String> |
+containsStringIgnoringCase(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere, ignoring case. |
+
static <T> Matcher<T> |
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+Wraps an existing matcher, overriding its description with that specified.
+ |
+
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
+either(Matcher<? super LHS> matcher)
+Creates a matcher that matches when either of the specified matchers match the examined object.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+empty()
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
static <E> Matcher<E[]> |
+emptyArray()
+Creates a matcher for arrays that matches when the
+length of the array
+ is zero. |
+
static <E> Matcher<java.util.Collection<E>> |
+emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+emptyIterable()
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
static Matcher<java.lang.String> |
+emptyOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ has zero length. |
+
static Matcher<java.lang.String> |
+emptyString()
+Creates a matcher of
+String that matches when the examined string has zero length. |
+
static Matcher<java.lang.String> |
+endsWith(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String. |
+
static Matcher<java.lang.String> |
+endsWithIgnoringCase(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String, ignoring case. |
+
static <T> Matcher<T> |
+equalTo(T operand)
+Creates a matcher that matches when the examined object is logically equal to the specified
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+
static Matcher<java.lang.String> |
+equalToIgnoringCase(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+
static Matcher<java.lang.String> |
+equalToIgnoringWhiteSpace(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+
static Matcher<java.lang.Object> |
+equalToObject(java.lang.Object operand)
+Creates an
+IsEqual matcher that does not enforce the values being
+ compared to be of the same static type. |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+Creates a matcher of
+EventObject that matches any object
+ derived from eventClass announced by source. |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Object source)
+Creates a matcher of
+EventObject that matches any EventObject
+ announced by source. |
+
static <U> Matcher<java.lang.Iterable<? extends U>> |
+everyItem(Matcher<U> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThanOrEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(K key,
+ V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(Matcher<? super T> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(T item)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+
static <T> Matcher<T[]> |
+hasItemInArray(Matcher<? super T> elementMatcher)
+Creates a matcher for arrays that matches when the examined array contains at least one item
+ that is matched by the specified
+elementMatcher. |
+
static <T> Matcher<T[]> |
+hasItemInArray(T element)
+A shortcut to the frequently used
+hasItemInArray(equalTo(x)). |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(Matcher<? super T>... itemMatchers)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(T... items)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(K key)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that is equal to the specified key. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(Matcher<? super K> keyMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name.
+ |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name whose value satisfies the specified matcher.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(int size)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value equal to the specified size. |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
static <T> Matcher<T> |
+hasToString(Matcher<? super java.lang.String> toStringMatcher)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value that satisfies the specified matcher. |
+
static <T> Matcher<T> |
+hasToString(java.lang.String expectedToString)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value equalTo the specified string. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that is equal to the specified value. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
static <T> Matcher<T> |
+in(java.util.Collection<T> collection)
+Creates a matcher that matches when the examined object is found within the
+ specified collection.
+ |
+
static <T> Matcher<T> |
+in(T[] elements)
+Creates a matcher that matches when the examined object is found within the
+ specified array.
+ |
+
static <T> Matcher<T> |
+instanceOf(java.lang.Class<?> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> Matcher<T> |
+is(Matcher<T> matcher)
+Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+ |
+
static <T> Matcher<T> |
+is(T value)
+A shortcut to the frequently used
+is(equalTo(x)). |
+
static <T> Matcher<T> |
+isA(java.lang.Class<T> type)
+A shortcut to the frequently used
+is(instanceOf(SomeClass.class)). |
+
static Matcher<java.lang.String> |
+isEmptyOrNullString()
+Deprecated.
+
+use is(emptyOrNullString()) instead
+ |
+
static Matcher<java.lang.String> |
+isEmptyString()
+Deprecated.
+
+use is(emptyString()) instead
+ |
+
static <T> Matcher<T> |
+isIn(java.util.Collection<T> collection)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isIn(T[] elements)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isOneOf(T... elements)
+Deprecated.
+
+use is(oneOf(...)) instead
+ |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(int size)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+
static <T extends java.lang.Comparable<T>> |
+lessThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+lessThanOrEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ less than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+
static Matcher<java.lang.String> |
+matchesPattern(java.util.regex.Pattern pattern)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given Pattern. |
+
static Matcher<java.lang.String> |
+matchesPattern(java.lang.String regex)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern. |
+
static <T> Matcher<T> |
+not(Matcher<T> matcher)
+Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+ |
+
static <T> Matcher<T> |
+not(T value)
+A shortcut to the frequently used
+not(equalTo(x)). |
+
static Matcher<java.lang.Double> |
+notANumber()
+Creates a matcher of
+Doubles that matches when an examined double is not a number. |
+
static Matcher<java.lang.Object> |
+notNullValue()
+A shortcut to the frequently used
+not(nullValue()). |
+
static <T> Matcher<T> |
+notNullValue(java.lang.Class<T> type)
+A shortcut to the frequently used
+not(nullValue(X.class)). |
+
static Matcher<java.lang.Object> |
+nullValue()
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+nullValue(java.lang.Class<T> type)
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+oneOf(T... elements)
+Creates a matcher that matches when the examined object is equal to one of the
+ specified elements.
+ |
+
static <T> Matcher<T> |
+sameInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static <T> Matcher<T> |
+samePropertyValuesAs(T expectedBean)
+Creates a matcher that matches when the examined object has values for all of
+ its JavaBean properties that are equal to the corresponding values of the
+ specified bean.
+ |
+
static Matcher<java.lang.String> |
+startsWith(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String. |
+
static Matcher<java.lang.String> |
+startsWithIgnoringCase(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String, ignoring case |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.String... substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
static <T> Matcher<T> |
+theInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static <T> Matcher<java.lang.Class<?>> |
+typeCompatibleWith(java.lang.Class<T> baseType)
+Creates a matcher of
+Class that matches when the specified baseType is
+ assignable from the examined class. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))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)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))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)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)+
assertThat("fab", both(containsString("a")).and(containsString("b")))public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)+
assertThat("fan", either(containsString("a")).or(containsString("b")))public static <T> Matcher<T> describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values)+
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised descriptionpublic static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)+
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")))itemMatcher - the matcher to apply to every item provided by the examined Iterablepublic static <T> Matcher<T> is(Matcher<T> matcher)+
assertThat(cheese, is(equalTo(smelly)))+ instead of: +
assertThat(cheese, equalTo(smelly))
public static <T> Matcher<T> is(T value)+
is(equalTo(x)).
+ For example:
+ assertThat(cheese, is(smelly))+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
public static <T> Matcher<T> isA(java.lang.Class<T> type)+
is(instanceOf(SomeClass.class)).
+ For example:
+ assertThat(cheese, isA(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
public static Matcher<java.lang.Object> anything()+
public static Matcher<java.lang.Object> anything(java.lang.String description)+
String.description - a meaningful String used when describing itselfpublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
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")))itemMatcher - the matcher to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
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"))item - the item to compare against the items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
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")))itemMatchers - the matchers to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
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"))items - the items to compare against the items provided by the examined Iterablepublic static <T> Matcher<T> equalTo(T operand)+
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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)+
IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.public static <T> Matcher<T> any(java.lang.Class<T> type)+
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))
assertThat(new Canoe(), instanceOf(Canoe.class));
public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)+
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));
public static <T> Matcher<T> not(Matcher<T> matcher)+
assertThat(cheese, is(not(equalTo(smelly))))
matcher - the matcher whose sense should be invertedpublic static <T> Matcher<T> not(T value)+
not(equalTo(x)).
+ For example:
+ assertThat(cheese, is(not(smelly)))+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
value - the value that any examined object should not equalpublic static Matcher<java.lang.Object> notNullValue()+
not(nullValue()).
+ For example:
+ assertThat(cheese, is(notNullValue()))+ instead of: +
assertThat(cheese, is(not(nullValue())))
public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)+
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 - dummy parameter used to infer the generic type of the returned matcherpublic static Matcher<java.lang.Object> nullValue()+
null.
+ For example:
+ assertThat(cheese, is(nullValue())
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)+
null. Accepts a
+ single dummy argument to facilitate type inference.
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
type - dummy parameter used to infer the generic type of the returned matcherpublic static <T> Matcher<T> sameInstance(T target)+
target - the target instance against which others should be assessedpublic static <T> Matcher<T> theInstance(T target)+
target - the target instance against which others should be assessedpublic static Matcher<java.lang.String> containsString(java.lang.String substring)+
String contains the specified
+ String anywhere.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)+
String contains the specified
+ String anywhere, ignoring case.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> startsWith(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String, ignoring case
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> endsWith(java.lang.String suffix)+
String ends with the specified
+ String.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)+
String ends with the specified
+ String, ignoring case.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)+
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))elementMatchers - the matchers that the elements of examined arrays should satisfypublic static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)+
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")))elementMatcher - the matcher to apply to elements in examined arrayspublic static <T> Matcher<T[]> hasItemInArray(T element)+
hasItemInArray(equalTo(x)).
+ For example:
+ assertThat(hasItemInArray(x))+ instead of: +
assertThat(hasItemInArray(equalTo(x)))
element - the element that should be present in examined arrayspublic static <E> Matcher<E[]> arrayContaining(E... items)+
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))items - the items that must equal the items within an examined arraypublic static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)+
assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))itemMatchers - the matchers that must be satisfied by the items in the examined arraypublic static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)+
assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined arraypublic 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")))itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined arraypublic static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. + For a positive match, the examined array must be of the same length as the specified collection + of matchers. +
++ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined array. +
++ For example: +
+assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined arraypublic 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"))items - the items that must equal the entries of an examined array, in any orderpublic static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
length of the array
+ satisfies the specified matcher.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))sizeMatcher - a matcher for the length of an examined arraypublic static <E> Matcher<E[]> arrayWithSize(int size)+
length of the array
+ equals the specified size.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))size - the length that an examined array must have for a positive matchpublic static <E> Matcher<E[]> emptyArray()+
length of the array
+ is zero.
+ For example:
+ assertThat(new String[0], emptyArray())
public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, is(aMapWithSize(equalTo(2))))
sizeMatcher - a matcher for the size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)+
Maps that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(myMap, is(aMapWithSize(2)))
size - the expected size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()+
Maps that matches when the size() method returns
+ zero.
+ For example:
+ assertThat(myMap, is(anEmptyMap()))
public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the size of an examined Collectionpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)+
Collections that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(Arrays.asList("foo", "bar"), hasSize(2))size - the expected size of an examined Collectionpublic static <E> Matcher<java.util.Collection<? extends E>> empty()+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(empty()))
public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
unusedToForceReturnType - the type of the collection's contentpublic static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterable()))
public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
unusedToForceReturnType - the type of the iterable's contentpublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)+
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"))items - the items that must equal the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)+
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")))itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by
+ an examined Iterablepublic static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. For a positive match, the examined iterable must be of the same
+ length as the number of specified matchers.
+
+ N.B. each of the specified matchers will only be used once during a given examination, so be + careful when specifying matchers that may be satisfied by more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterablepublic static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. For a positive match, the examined iterable
+ must be of the same length as the number of specified items.
+
+ N.B. each of the specified items will only be used once during a given examination, so be + careful when specifying items that may be equal to more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))items - the items that must equal the items provided by an examined Iterable in any orderpublic static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. For a positive match, the examined iterable
+ must be of the same length as the specified collection of matchers.
+
+ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined iterable. +
+For example:
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)+
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"))items - the items that must be contained within items provided by an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the items provided by
+ an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)+
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))size - the number of items that should be yielded by an examined Iterablepublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher)+
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")))keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entryvalueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entrypublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key, + V value)+
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"))key - the key that, in combination with the value, must be describe at least one entryvalue - the value that, in combination with the key, must be describe at least one entrypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)+
Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, hasKey(equalTo("bar")))keyMatcher - the matcher that must be satisfied by at least one keypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)+
Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+ For example:
+ assertThat(myMap, hasKey("bar"))key - the key that satisfying maps must containpublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)+
Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+ For example:
+ assertThat(myMap, hasValue(equalTo("foo")))valueMatcher - the matcher that must be satisfied by at least one valuepublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)+
Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+ For example:
+ assertThat(myMap, hasValue("foo"))value - the value that satisfying maps must containpublic static <T> Matcher<T> in(java.util.Collection<T> collection)+
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))collection - the collection in which matching items must be foundpublic static <T> Matcher<T> in(T[] elements)+
assertThat("foo", is(in(new String[]{"bar", "foo"})))elements - the array in which matching items must be foundpublic static <T> Matcher<T> isIn(java.util.Collection<T> collection)+
assertThat("foo", isIn(Arrays.asList("bar", "foo")))collection - the collection in which matching items must be foundpublic static <T> Matcher<T> isIn(T[] elements)+
assertThat("foo", isIn(new String[]{"bar", "foo"}))elements - the array in which matching items must be foundpublic static <T> Matcher<T> isOneOf(T... elements)+
assertThat("foo", isOneOf("bar", "foo"))elements - the elements amongst which matching items will be foundpublic static <T> Matcher<T> oneOf(T... elements)+
assertThat("foo", is(oneOf("bar", "foo")))elements - the elements amongst which matching items will be foundpublic static Matcher<java.lang.Double> closeTo(double operand, + double error)+
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)))
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowedpublic static Matcher<java.lang.Double> notANumber()+
Doubles that matches when an examined double is not a number.
+ For example:
+ assertThat(Double.NaN, is(notANumber()))
public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error)+
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"))))operand - the expected value of matching BigDecimalserror - the delta (+/-) within which matches will be allowedpublic static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than or equal to zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than or equal to zeropublic static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)+
String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+ For example:
+ assertThat("Foo", equalToIgnoringCase("FOO"))expectedString - the expected value of matched stringspublic static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)+
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:
+ assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))expectedString - the expected value of matched stringspublic static Matcher<java.lang.String> emptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), is(emptyOrNullString()))
public static Matcher<java.lang.String> emptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", is(emptyString()))public static Matcher<java.lang.String> isEmptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), isEmptyOrNullString())
public static Matcher<java.lang.String> isEmptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", isEmptyString())public static Matcher<java.lang.String> blankOrNullString()+
String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(((String)null), is(blankOrNullString()))
public static Matcher<java.lang.String> blankString()+
String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(" ", is(blankString()))public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)+
String that matches when the examined string
+ exactly matches the given Pattern.public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)+
String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
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"substrings - the substrings that must be contained within matching stringspublic static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)+
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"substrings - the substrings that must be contained within matching stringspublic static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)+
toString method
+ returns a value that satisfies the specified matcher.
+ For example:
+ assertThat(true, hasToString(equalTo("TRUE")))toStringMatcher - the matcher used to verify the toString resultpublic static <T> Matcher<T> hasToString(java.lang.String expectedToString)+
toString method
+ returns a value equalTo the specified string.
+ For example:
+ assertThat(true, hasToString("TRUE"))expectedToString - the expected toString resultpublic static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)+
Class that matches when the specified baseType is
+ assignable from the examined class.
+ For example:
+ assertThat(Integer.class, typeCompatibleWith(Number.class))
baseType - the base class to examine classes againstpublic static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source)+
EventObject that matches any object
+ derived from eventClass announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
eventClass - the class of the event to match onsource - the source of the eventpublic static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)+
EventObject that matches any EventObject
+ announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(myBean)))
source - the source of the eventpublic static <T> Matcher<T> hasProperty(java.lang.String propertyName)+
assertThat(myBean, hasProperty("foo"))propertyName - the name of the JavaBean property that examined beans should possesspublic static <T> Matcher<T> hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher)+
assertThat(myBean, hasProperty("foo", equalTo("bar"))propertyName - the name of the JavaBean property that examined beans should possessvalueMatcher - a matcher for the value of the specified property of the examined beanpublic static <T> Matcher<T> samePropertyValuesAs(T expectedBean)+
assertThat(myBean, samePropertyValuesAs(myExpectedBean))
expectedBean - the bean against which examined beans are comparedpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathnamespaceContext - the namespace for matching nodesvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)+
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"))xPath - the target xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext)+
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))xPath - the target xpathnamespaceContext - the namespace for matching nodespublic interface SelfDescribing
+| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
void describeTo(Description description)+
description - The description to be built or appended to.public class StringDescription +extends BaseDescription+
Description that is stored as a string.Description.NullDescriptionNONE| Constructor and Description | +
|---|
StringDescription() |
+
StringDescription(java.lang.Appendable out) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected void |
+append(char c)
+Append the char c to the description.
+ |
+
protected void |
+append(java.lang.String str)
+Append the String str to the description.
+ |
+
static java.lang.String |
+asString(SelfDescribing selfDescribing)
+Alias for
+toString(SelfDescribing). |
+
java.lang.String |
+toString()
+Returns the description as a string.
+ |
+
static java.lang.String |
+toString(SelfDescribing selfDescribing)
+Return the description of a
+SelfDescribing object as a String. |
+
appendDescriptionOf, appendList, appendText, appendValue, appendValueList, appendValueListclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringDescription()+
public StringDescription(java.lang.Appendable out)+
public static java.lang.String toString(SelfDescribing selfDescribing)+
SelfDescribing object as a String.selfDescribing - The object to be described.public static java.lang.String asString(SelfDescribing selfDescribing)+
toString(SelfDescribing).protected void append(java.lang.String str)+
BaseDescriptionBaseDescription.append(char).
+ Override in subclasses to provide an efficient implementation.append in class BaseDescriptionprotected void append(char c)+
BaseDescriptionappend in class BaseDescriptionpublic java.lang.String toString()+
toString in class java.lang.ObjectT - public abstract class TypeSafeDiagnosingMatcher<T> +extends BaseMatcher<T>+
matchesSafely().
| Modifier | +Constructor and Description | +
|---|---|
protected |
+TypeSafeDiagnosingMatcher()
+The default constructor for simple sub types
+ |
+
protected |
+TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
protected |
+TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
boolean |
+matches(java.lang.Object item)
+Evaluates the matcher for argument item.
+ |
+
protected abstract boolean |
+matchesSafely(T item,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeToprotected TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)+
matchesSafely
+ is not the class that binds <T> to a type.expectedType - The expectedType of the actual value.protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)+
matchesSafely
+ is not the class that binds <T> to a type.typeFinder - A type finder to extract the typeprotected TypeSafeDiagnosingMatcher()+
protected abstract boolean matchesSafely(T item, + Description mismatchDescription)+
public final boolean matches(java.lang.Object item)+
Matcheritem - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic final void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.public abstract class TypeSafeMatcher<T> +extends BaseMatcher<T>+
| Modifier | +Constructor and Description | +
|---|---|
protected |
+TypeSafeMatcher()
+The default constructor for simple sub types
+ |
+
protected |
+TypeSafeMatcher(java.lang.Class<?> expectedType)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
protected |
+TypeSafeMatcher(ReflectiveTypeFinder typeFinder)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description description)
+Generate a description of why the matcher has not accepted the item.
+ |
+
protected void |
+describeMismatchSafely(T item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
boolean |
+matches(java.lang.Object item)
+Methods made final to prevent accidental override.
+ |
+
protected abstract boolean |
+matchesSafely(T item)
+Subclasses should implement this.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeToprotected TypeSafeMatcher()+
protected TypeSafeMatcher(java.lang.Class<?> expectedType)+
matchesSafely
+ is not the class that binds <T> to a type.expectedType - The expectedType of the actual value.protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder)+
matchesSafely
+ is not the class that binds <T> to a type.typeFinder - A type finder to extract the typeprotected abstract boolean matchesSafely(T item)+
protected void describeMismatchSafely(T item, + Description mismatchDescription)+
public final boolean matches(java.lang.Object item)+
BaseMatcher.item - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic final void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.public class HasProperty<T> +extends TypeSafeMatcher<T>+
| Constructor and Description | +
|---|
HasProperty(java.lang.String propertyName) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(T item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name.
+ |
+
boolean |
+matchesSafely(T obj)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HasProperty(java.lang.String propertyName)+
public boolean matchesSafely(T obj)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<T>public void describeMismatchSafely(T item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> hasProperty(java.lang.String propertyName)+
assertThat(myBean, hasProperty("foo"))propertyName - the name of the JavaBean property that examined beans should possesspublic class HasPropertyWithValue<T> +extends TypeSafeDiagnosingMatcher<T>+
Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. This is useful for when objects + are created within code under test and passed to a mock object, and you wish + to assert that the created object has certain properties. +
+ +
+ public class Person {
+ private String name;
+ public Person(String person) {
+ this.person = person;
+ }
+ public String getName() {
+ return name;
+ }
+ }
+
+ And that these person objects are generated within a piece of code under test
+ (a class named PersonGenerator). This object is sent to one of our mock objects
+ which overrides the PersonGenerationListener interface:
+
+ public interface PersonGenerationListener {
+ public void personGenerated(Person person);
+ }
+
+ In order to check that the code under test generates a person with name
+ "Iain" we would do the following:
+
+ Mock personGenListenerMock = mock(PersonGenerationListener.class);
+ personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain")));
+ PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy();
+
+ If an exception is thrown by the getter method for a property, the property + does not exist, is not readable, or a reflection related exception is thrown + when trying to invoke it then this is treated as an evaluation failure and + the matches method will return false. +
+This matcher class will also work with JavaBean objects that have explicit + bean descriptions via an associated BeanInfo description class. See the + JavaBeans specification for more information: + http://java.sun.com/products/javabeans/docs/index.html +
| Constructor and Description | +
|---|
HasPropertyWithValue(java.lang.String propertyName,
+ Matcher<?> valueMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name whose value satisfies the specified matcher.
+ |
+
boolean |
+matchesSafely(T bean,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HasPropertyWithValue(java.lang.String propertyName, + Matcher<?> valueMatcher)+
public boolean matchesSafely(T bean, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher)+
assertThat(myBean, hasProperty("foo", equalTo("bar"))propertyName - the name of the JavaBean property that examined beans should possessvalueMatcher - a matcher for the value of the specified property of the examined beanpublic class PropertyUtil
+extends java.lang.Object
+| Modifier and Type | +Field and Description | +
|---|---|
static java.lang.Object[] |
+NO_ARGUMENTS |
+
| Constructor and Description | +
|---|
PropertyUtil() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static java.beans.PropertyDescriptor |
+getPropertyDescriptor(java.lang.String propertyName,
+ java.lang.Object fromObj)
+Returns the description of the property with the provided
+ name on the provided object's interface.
+ |
+
static java.beans.PropertyDescriptor[] |
+propertyDescriptorsFor(java.lang.Object fromObj,
+ java.lang.Class<java.lang.Object> stopClass)
+Returns all the property descriptors for the class associated with the given object
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final java.lang.Object[] NO_ARGUMENTS+
public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName, + java.lang.Object fromObj) + throws java.lang.IllegalArgumentException+
java.lang.IllegalArgumentException - if there's a introspection failurepublic static java.beans.PropertyDescriptor[] propertyDescriptorsFor(java.lang.Object fromObj, + java.lang.Class<java.lang.Object> stopClass) + throws java.lang.IllegalArgumentException+
fromObj - Use the class of this objectstopClass - Don't include any properties from this ancestor class upwards.java.lang.IllegalArgumentException - if there's a introspection failurepublic static class SamePropertyValuesAs.PropertyMatcher +extends DiagnosingMatcher<java.lang.Object>+
| Constructor and Description | +
|---|
PropertyMatcher(java.beans.PropertyDescriptor descriptor,
+ java.lang.Object expectedObject) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object actual,
+ Description mismatch) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic PropertyMatcher(java.beans.PropertyDescriptor descriptor, + java.lang.Object expectedObject)+
public boolean matches(java.lang.Object actual, + Description mismatch)+
matches in class DiagnosingMatcher<java.lang.Object>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public class SamePropertyValuesAs<T> +extends TypeSafeDiagnosingMatcher<T>+
| Modifier and Type | +Class and Description | +
|---|---|
static class |
+SamePropertyValuesAs.PropertyMatcher |
+
| Constructor and Description | +
|---|
SamePropertyValuesAs(T expectedBean) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(T bean,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
static <T> Matcher<T> |
+samePropertyValuesAs(T expectedBean)
+Creates a matcher that matches when the examined object has values for all of
+ its JavaBean properties that are equal to the corresponding values of the
+ specified bean.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic SamePropertyValuesAs(T expectedBean)+
public boolean matchesSafely(T bean, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)+
assertThat(myBean, samePropertyValuesAs(myExpectedBean))
expectedBean - the bean against which examined beans are comparedSee: Description
+| Class | +Description | +
|---|---|
| HasProperty<T> | +
+ A Matcher that checks that an object has a JavaBean property
+ with the specified name.
+ |
+
| HasPropertyWithValue<T> | +
+ Matcher that asserts that a JavaBean property on an argument passed to the
+ mock object meets the provided matcher.
+ |
+
| PropertyUtil | +
+ Utility class for accessing properties on JavaBean objects.
+ |
+
| SamePropertyValuesAs<T> | ++ |
| SamePropertyValuesAs.PropertyMatcher | ++ |
Matchers of Java Bean properties and their values.
public class IsArray<T> +extends TypeSafeMatcher<T[]>+
| Constructor and Description | +
|---|
IsArray(Matcher<? super T>[] elementMatchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> IsArray<T> |
+array(Matcher<? super T>... elementMatchers)
+Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+ |
+
void |
+describeMismatchSafely(T[] actual,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected java.lang.String |
+descriptionEnd()
+Returns the string that ends the description.
+ |
+
protected java.lang.String |
+descriptionSeparator()
+Returns the string that separates the elements in the description.
+ |
+
protected java.lang.String |
+descriptionStart()
+Returns the string that starts the description.
+ |
+
boolean |
+matchesSafely(T[] array)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(T[] array)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<T[]>public void describeMismatchSafely(T[] actual, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<T[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.protected java.lang.String descriptionStart()+
protected java.lang.String descriptionSeparator()+
protected java.lang.String descriptionEnd()+
public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)+
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))elementMatchers - the matchers that the elements of examined arrays should satisfypublic class IsArrayContaining<T> +extends TypeSafeMatcher<T[]>+
| Constructor and Description | +
|---|
IsArrayContaining(Matcher<? super T> elementMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(T[] item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T[]> |
+hasItemInArray(Matcher<? super T> elementMatcher)
+Creates a matcher for arrays that matches when the examined array contains at least one item
+ that is matched by the specified
+elementMatcher. |
+
static <T> Matcher<T[]> |
+hasItemInArray(T element)
+A shortcut to the frequently used
+hasItemInArray(equalTo(x)). |
+
boolean |
+matchesSafely(T[] array)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(T[] array)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<T[]>public void describeMismatchSafely(T[] item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<T[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)+
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")))elementMatcher - the matcher to apply to elements in examined arrayspublic static <T> Matcher<T[]> hasItemInArray(T element)+
hasItemInArray(equalTo(x)).
+ For example:
+ assertThat(hasItemInArray(x))+ instead of: +
assertThat(hasItemInArray(equalTo(x)))
element - the element that should be present in examined arrayspublic class IsArrayContainingInAnyOrder<E> +extends TypeSafeMatcher<E[]>+
| Constructor and Description | +
|---|
IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified collection of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(E... items)
+Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array is logically equal to one item anywhere in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified matchers.
+ |
+
void |
+describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(E[] item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(E[] item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<E[]>public void describeMismatchSafely(E[] item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<E[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.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")))itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined arraypublic static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. + For a positive match, the examined array must be of the same length as the specified collection + of matchers. +
++ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined array. +
++ For example: +
+assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined arraypublic 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"))items - the items that must equal the entries of an examined array, in any orderpublic class IsArrayContainingInOrder<E> +extends TypeSafeMatcher<E[]>+
| Constructor and Description | +
|---|
IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<E[]> |
+arrayContaining(E... items)
+Creates a matcher for arrays that matches when each item in the examined array is
+ logically equal to the corresponding item in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified list of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(Matcher<? super E>... itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified matchers.
+ |
+
void |
+describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(E[] item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(E[] item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<E[]>public void describeMismatchSafely(E[] item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<E[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<E[]> arrayContaining(E... items)+
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))items - the items that must equal the items within an examined arraypublic static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)+
assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))itemMatchers - the matchers that must be satisfied by the items in the examined arraypublic static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)+
assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined arraypublic class IsArrayWithSize<E> +extends FeatureMatcher<E[],java.lang.Integer>+
| Constructor and Description | +
|---|
IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<E[]> |
+arrayWithSize(int size)
+Creates a matcher for arrays that matches when the
+length of the array
+ equals the specified size. |
+
static <E> Matcher<E[]> |
+arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for arrays that matches when the
+length of the array
+ satisfies the specified matcher. |
+
static <E> Matcher<E[]> |
+emptyArray()
+Creates a matcher for arrays that matches when the
+length of the array
+ is zero. |
+
protected java.lang.Integer |
+featureValueOf(E[] actual)
+Implement this to extract the interesting feature.
+ |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(E[] actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<E[],java.lang.Integer>actual - the target objectpublic static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
length of the array
+ satisfies the specified matcher.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))sizeMatcher - a matcher for the length of an examined arraypublic static <E> Matcher<E[]> arrayWithSize(int size)+
length of the array
+ equals the specified size.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))size - the length that an examined array must have for a positive matchpublic static <E> Matcher<E[]> emptyArray()+
length of the array
+ is zero.
+ For example:
+ assertThat(new String[0], emptyArray())
public class IsCollectionWithSize<E> +extends FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>+
| Constructor and Description | +
|---|
IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+featureValueOf(java.util.Collection<? extends E> actual)
+Implement this to extract the interesting feature.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(int size)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value equal to the specified size. |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>actual - the target objectpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the size of an examined Collectionpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)+
Collections that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(Arrays.asList("foo", "bar"), hasSize(2))size - the expected size of an examined Collectionpublic class IsEmptyCollection<E> +extends TypeSafeMatcher<java.util.Collection<? extends E>>+
| Constructor and Description | +
|---|
IsEmptyCollection() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.util.Collection<? extends E> item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+empty()
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
static <E> Matcher<java.util.Collection<E>> |
+emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
boolean |
+matchesSafely(java.util.Collection<? extends E> item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.util.Collection<? extends E> item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>public void describeMismatchSafely(java.util.Collection<? extends E> item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<java.util.Collection<? extends E>> empty()+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(empty()))
public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
unusedToForceReturnType - the type of the collection's contentpublic class IsEmptyIterable<E> +extends TypeSafeMatcher<java.lang.Iterable<? extends E>>+
| Constructor and Description | +
|---|
IsEmptyIterable() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.Iterable<? extends E> iter,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+emptyIterable()
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.Iterable<? extends E> iterable)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>public void describeMismatchSafely(java.lang.Iterable<? extends E> iter, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterable()))
public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
unusedToForceReturnType - the type of the iterable's contentpublic class IsIn<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
IsIn(java.util.Collection<T> collection) |
+
IsIn(T[] elements) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description buffer)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+in(java.util.Collection<T> collection)
+Creates a matcher that matches when the examined object is found within the
+ specified collection.
+ |
+
static <T> Matcher<T> |
+in(T[] elements)
+Creates a matcher that matches when the examined object is found within the
+ specified array.
+ |
+
static <T> Matcher<T> |
+isIn(java.util.Collection<T> collection)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isIn(T[] elements)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isOneOf(T... elements)
+Deprecated.
+
+use is(oneOf(...)) instead
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
static <T> Matcher<T> |
+oneOf(T... elements)
+Creates a matcher that matches when the examined object is equal to one of the
+ specified elements.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsIn(java.util.Collection<T> collection)+
public IsIn(T[] elements)+
public boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description buffer)+
SelfDescribingbuffer - The description to be built or appended to.@Deprecated +public static <T> Matcher<T> isIn(java.util.Collection<T> collection)+
assertThat("foo", isIn(Arrays.asList("bar", "foo")))collection - the collection in which matching items must be foundpublic static <T> Matcher<T> in(java.util.Collection<T> collection)+
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))collection - the collection in which matching items must be found@Deprecated +public static <T> Matcher<T> isIn(T[] elements)+
assertThat("foo", isIn(new String[]{"bar", "foo"}))elements - the array in which matching items must be foundpublic static <T> Matcher<T> in(T[] elements)+
assertThat("foo", is(in(new String[]{"bar", "foo"})))elements - the array in which matching items must be found@Deprecated +public static <T> Matcher<T> isOneOf(T... elements)+
assertThat("foo", isOneOf("bar", "foo"))elements - the elements amongst which matching items will be foundpublic static <T> Matcher<T> oneOf(T... elements)+
assertThat("foo", is(oneOf("bar", "foo")))elements - the elements amongst which matching items will be foundpublic class IsIterableContainingInAnyOrder<T> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>+
| Constructor and Description | +
|---|
IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(T... items)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? extends T> items,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? extends T> items, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. For a positive match, the examined iterable must be of the same
+ length as the number of specified matchers.
+
+ N.B. each of the specified matchers will only be used once during a given examination, so be + careful when specifying matchers that may be satisfied by more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterablepublic static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. For a positive match, the examined iterable
+ must be of the same length as the number of specified items.
+
+ N.B. each of the specified items will only be used once during a given examination, so be + careful when specifying items that may be equal to more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))items - the items that must equal the items provided by an examined Iterable in any orderpublic static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. For a positive match, the examined iterable
+ must be of the same length as the specified collection of matchers.
+
+ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined iterable. +
+For example:
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterablepublic class IsIterableContainingInOrder<E> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>+
| Constructor and Description | +
|---|
IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E> itemMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)+
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"))items - the items that must equal the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)+
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")))itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by
+ an examined Iterablepublic class IsIterableContainingInRelativeOrder<E> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>+
| Constructor and Description | +
|---|
IsIterableContainingInRelativeOrder(java.util.List<Matcher<? super E>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items logically equal to the
+ corresponding item in the specified items, in the same relative order
+ For example: |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items satisfying the corresponding
+ matcher in the specified list of matchers, in the same relative order. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that each satisfying the corresponding
+ matcher in the specified matchers, in the same relative order. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)+
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"))items - the items that must be contained within items provided by an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the items provided by
+ an examined Iterable in the same relative orderpublic class IsIterableWithSize<E> +extends FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>+
| Constructor and Description | +
|---|
IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+featureValueOf(java.lang.Iterable<E> actual)
+Implement this to extract the interesting feature.
+ |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(int size)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>actual - the target objectpublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)+
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))size - the number of items that should be yielded by an examined Iterablepublic class IsMapContaining<K,V> +extends TypeSafeMatcher<java.util.Map<? extends K,? extends V>>+
| Constructor and Description | +
|---|
IsMapContaining(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(K key,
+ V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(K key)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that is equal to the specified key. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(Matcher<? super K> keyMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that is equal to the specified value. |
+
boolean |
+matchesSafely(java.util.Map<? extends K,? extends V> map)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.util.Map<? extends K,? extends V> map)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>public void describeMismatchSafely(java.util.Map<? extends K,? extends V> map, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher)+
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")))keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entryvalueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entrypublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key, + V value)+
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"))key - the key that, in combination with the value, must be describe at least one entryvalue - the value that, in combination with the key, must be describe at least one entrypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)+
Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, hasKey(equalTo("bar")))keyMatcher - the matcher that must be satisfied by at least one keypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)+
Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+ For example:
+ assertThat(myMap, hasKey("bar"))key - the key that satisfying maps must containpublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)+
Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+ For example:
+ assertThat(myMap, hasValue(equalTo("foo")))valueMatcher - the matcher that must be satisfied by at least one valuepublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)+
Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+ For example:
+ assertThat(myMap, hasValue("foo"))value - the value that satisfying maps must containpublic final class IsMapWithSize<K,V> +extends FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>+
| Constructor and Description | +
|---|
IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(int size)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value equal to the specified size. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+anEmptyMap()
+Creates a matcher for
+Maps that matches when the size() method returns
+ zero. |
+
protected java.lang.Integer |
+featureValueOf(java.util.Map<? extends K,? extends V> actual)
+Implement this to extract the interesting feature.
+ |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(java.util.Map<? extends K,? extends V> actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>actual - the target objectpublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, is(aMapWithSize(equalTo(2))))
sizeMatcher - a matcher for the size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)+
Maps that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(myMap, is(aMapWithSize(2)))
size - the expected size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()+
Maps that matches when the size() method returns
+ zero.
+ For example:
+ assertThat(myMap, is(anEmptyMap()))
| Class | +Description | +
|---|---|
| IsArray<T> | +
+ Matcher for array whose elements satisfy a sequence of matchers.
+ |
+
| IsArrayContaining<T> | +
+ Matches if an array contains an item satisfying a nested matcher.
+ |
+
| IsArrayContainingInAnyOrder<E> | ++ |
| IsArrayContainingInOrder<E> | ++ |
| IsArrayWithSize<E> | +
+ Matches if array size satisfies a nested matcher.
+ |
+
| IsCollectionWithSize<E> | +
+ Matches if collection size satisfies a nested matcher.
+ |
+
| IsEmptyCollection<E> | +
+ Tests if collection is empty.
+ |
+
| IsEmptyIterable<E> | +
+ Tests if collection is empty.
+ |
+
| IsIn<T> | ++ |
| IsIterableContainingInAnyOrder<T> | ++ |
| IsIterableContainingInOrder<E> | ++ |
| IsIterableContainingInRelativeOrder<E> | ++ |
| IsIterableWithSize<E> | ++ |
| IsMapContaining<K,V> | ++ |
| IsMapWithSize<K,V> | +
+ Matches if map size satisfies a nested matcher.
+ |
+
Matchers of arrays and collections.
public final class ComparatorMatcherBuilder<T>
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static <T> ComparatorMatcherBuilder<T> |
+comparedBy(java.util.Comparator<T> comparator)
+Creates a matcher factory for matchers of
+Comparatorss of T. |
+
Matcher<T> |
+comparesEqualTo(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ equal to the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+greaterThan(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ greater than the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+greaterThanOrEqualTo(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+lessThan(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ less than the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+lessThanOrEqualTo(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ less than or equal to the specified value, as reported by the Comparator used to
+ create this builder. |
+
static <T extends java.lang.Comparable<T>> |
+usingNaturalOrdering()
+Creates a matcher factory for matchers of
+Comparables. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T extends java.lang.Comparable<T>> ComparatorMatcherBuilder<T> usingNaturalOrdering()+
Comparables.
+ For example:
+ assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
public static <T> ComparatorMatcherBuilder<T> comparedBy(java.util.Comparator<T> comparator)+
Comparatorss of T.
+ For example:
+ assertThat(5, comparedBy(new Comparator<Integer>() {
+ public int compare(Integer o1, Integer o2) {
+ return -o1.compareTo(o2);
+ }
+ }).lessThan(4))public Matcher<T> comparesEqualTo(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return zeropublic Matcher<T> greaterThan(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return greater
+ than zeropublic Matcher<T> greaterThanOrEqualTo(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return greater
+ than or equal to zeropublic Matcher<T> lessThan(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return less
+ than zeropublic Matcher<T> lessThanOrEqualTo(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return less
+ than or equal to zero| Class | +Description | +
|---|---|
| ComparatorMatcherBuilder<T> | ++ |
public class AllOf<T> +extends DiagnosingMatcher<T>+
false.| Constructor and Description | +
|---|
AllOf(java.lang.Iterable<Matcher<? super T>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o,
+ Description mismatch) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o, + Description mismatch)+
matches in class DiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public class AnyOf<T> +extends BaseMatcher<T>+
true.| Constructor and Description | +
|---|
AnyOf(java.lang.Iterable<Matcher<? super T>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> AnyOf<T> |
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
void |
+describeTo(Description description,
+ java.lang.String operator) |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
protected boolean |
+matches(java.lang.Object o,
+ boolean shortcut) |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o)+
Matchermatches in interface Matcher<T>o - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescribeTo in interface SelfDescribingdescription - The description to be built or appended to.public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))@SafeVarargs +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))protected boolean matches(java.lang.Object o, + boolean shortcut)+
public void describeTo(Description description, + java.lang.String operator)+
public static final class CombinableMatcher.CombinableBothMatcher<X>
+extends java.lang.Object
+| Constructor and Description | +
|---|
CombinableBothMatcher(Matcher<? super X> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
CombinableMatcher<X> |
+and(Matcher<? super X> other) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final class CombinableMatcher.CombinableEitherMatcher<X>
+extends java.lang.Object
+| Constructor and Description | +
|---|
CombinableEitherMatcher(Matcher<? super X> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
CombinableMatcher<X> |
+or(Matcher<? super X> other) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class CombinableMatcher<T> +extends TypeSafeDiagnosingMatcher<T>+
| Modifier and Type | +Class and Description | +
|---|---|
static class |
+CombinableMatcher.CombinableBothMatcher<X> |
+
static class |
+CombinableMatcher.CombinableEitherMatcher<X> |
+
| Constructor and Description | +
|---|
CombinableMatcher(Matcher<? super T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
CombinableMatcher<T> |
+and(Matcher<? super T> other) |
+
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
+both(Matcher<? super LHS> matcher)
+Creates a matcher that matches when both of the specified matchers match the examined object.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
+either(Matcher<? super LHS> matcher)
+Creates a matcher that matches when either of the specified matchers match the examined object.
+ |
+
protected boolean |
+matchesSafely(T item,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
CombinableMatcher<T> |
+or(Matcher<? super T> other) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(T item, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public CombinableMatcher<T> and(Matcher<? super T> other)+
public CombinableMatcher<T> or(Matcher<? super T> other)+
public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)+
assertThat("fab", both(containsString("a")).and(containsString("b")))public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)+
assertThat("fan", either(containsString("a")).or(containsString("b")))public class DescribedAs<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
DescribedAs(java.lang.String descriptionTemplate,
+ Matcher<T> matcher,
+ java.lang.Object[] values) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+Wraps an existing matcher, overriding its description with that specified.
+ |
+
void |
+describeMismatch(java.lang.Object item,
+ Description description)
+Generate a description of why the matcher has not accepted the item.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.public static <T> Matcher<T> describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values)+
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised descriptionpublic class Every<T> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>+
| Constructor and Description | +
|---|
Every(Matcher<? super T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <U> Matcher<java.lang.Iterable<? extends U>> |
+everyItem(Matcher<U> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+
boolean |
+matchesSafely(java.lang.Iterable<? extends T> collection,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.Iterable<? extends T> collection, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)+
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")))itemMatcher - the matcher to apply to every item provided by the examined Iterablepublic class Is<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
Is(Matcher<T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+is(Matcher<T> matcher)
+Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+ |
+
static <T> Matcher<T> |
+is(T value)
+A shortcut to the frequently used
+is(equalTo(x)). |
+
static <T> Matcher<T> |
+isA(java.lang.Class<T> type)
+A shortcut to the frequently used
+is(instanceOf(SomeClass.class)). |
+
boolean |
+matches(java.lang.Object arg)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object arg)+
Matcherarg - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.public static <T> Matcher<T> is(Matcher<T> matcher)+
assertThat(cheese, is(equalTo(smelly)))+ instead of: +
assertThat(cheese, equalTo(smelly))
public static <T> Matcher<T> is(T value)+
is(equalTo(x)).
+ For example:
+ assertThat(cheese, is(smelly))+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
public static <T> Matcher<T> isA(java.lang.Class<T> type)+
is(instanceOf(SomeClass.class)).
+ For example:
+ assertThat(cheese, isA(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
public class IsAnything<T> +extends BaseMatcher<T>+
true.| Constructor and Description | +
|---|
IsAnything() |
+
IsAnything(java.lang.String message) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.Object> |
+anything()
+Creates a matcher that always matches, regardless of the examined object.
+ |
+
static Matcher<java.lang.Object> |
+anything(java.lang.String description)
+Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified
+String. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsAnything()+
public IsAnything(java.lang.String message)+
public boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Object> anything()+
public static Matcher<java.lang.Object> anything(java.lang.String description)+
String.description - a meaningful String used when describing itselfpublic class IsCollectionContaining<T> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>+
| Constructor and Description | +
|---|
IsCollectionContaining(Matcher<? super T> elementMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(Matcher<? super T> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(T item)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(Matcher<? super T>... itemMatchers)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(T... items)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? super T> collection,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
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")))itemMatcher - the matcher to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
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"))item - the item to compare against the items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
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")))itemMatchers - the matchers to apply to items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
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"))items - the items to compare against the items provided by the examined Iterablepublic class IsEqual<T> +extends BaseMatcher<T>+
Object.equals(java.lang.Object) invokedMethod?| Constructor and Description | +
|---|
IsEqual(T equalArg) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+equalTo(T operand)
+Creates a matcher that matches when the examined object is logically equal to the specified
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+
static Matcher<java.lang.Object> |
+equalToObject(java.lang.Object operand)
+Creates an
+IsEqual matcher that does not enforce the values being
+ compared to be of the same static type. |
+
boolean |
+matches(java.lang.Object actualValue)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object actualValue)+
MatcheractualValue - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> equalTo(T operand)+
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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ public class IsInstanceOf +extends DiagnosingMatcher<java.lang.Object>+
| Constructor and Description | +
|---|
IsInstanceOf(java.lang.Class<?> expectedClass)
+Creates a new instance of IsInstanceOf
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+any(java.lang.Class<T> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+instanceOf(java.lang.Class<?> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
protected boolean |
+matches(java.lang.Object item,
+ Description mismatch) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsInstanceOf(java.lang.Class<?> expectedClass)+
expectedClass - The predicate evaluates to true for instances of this class
+ or one of its subclasses.protected boolean matches(java.lang.Object item, + Description mismatch)+
matches in class DiagnosingMatcher<java.lang.Object>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)+
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));
public static <T> Matcher<T> any(java.lang.Class<T> type)+
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))
assertThat(new Canoe(), instanceOf(Canoe.class));
public class IsNot<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
IsNot(Matcher<T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object arg)
+Evaluates the matcher for argument item.
+ |
+
static <T> Matcher<T> |
+not(Matcher<T> matcher)
+Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+ |
+
static <T> Matcher<T> |
+not(T value)
+A shortcut to the frequently used
+not(equalTo(x)). |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object arg)+
Matcherarg - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> not(Matcher<T> matcher)+
assertThat(cheese, is(not(equalTo(smelly))))
matcher - the matcher whose sense should be invertedpublic static <T> Matcher<T> not(T value)+
not(equalTo(x)).
+ For example:
+ assertThat(cheese, is(not(smelly)))+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
value - the value that any examined object should not equalpublic class IsNull<T> +extends BaseMatcher<T>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
static Matcher<java.lang.Object> |
+notNullValue()
+A shortcut to the frequently used
+not(nullValue()). |
+
static <T> Matcher<T> |
+notNullValue(java.lang.Class<T> type)
+A shortcut to the frequently used
+not(nullValue(X.class)). |
+
static Matcher<java.lang.Object> |
+nullValue()
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+nullValue(java.lang.Class<T> type)
+Creates a matcher that matches if examined object is
+null. |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Object> nullValue()+
null.
+ For example:
+ assertThat(cheese, is(nullValue())
public static Matcher<java.lang.Object> notNullValue()+
not(nullValue()).
+ For example:
+ assertThat(cheese, is(notNullValue()))+ instead of: +
assertThat(cheese, is(not(nullValue())))
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)+
null. Accepts a
+ single dummy argument to facilitate type inference.
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
type - dummy parameter used to infer the generic type of the returned matcherpublic static <T> Matcher<T> notNullValue(java.lang.Class<T> type)+
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 - dummy parameter used to infer the generic type of the returned matcherpublic class IsSame<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
IsSame(T object) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object arg)
+Evaluates the matcher for argument item.
+ |
+
static <T> Matcher<T> |
+sameInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static <T> Matcher<T> |
+theInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object arg)+
Matcherarg - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> sameInstance(T target)+
target - the target instance against which others should be assessedpublic static <T> Matcher<T> theInstance(T target)+
target - the target instance against which others should be assessedpublic class StringContains +extends SubstringMatcher+
substring| Constructor and Description | +
|---|
StringContains(boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.String> |
+containsString(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere. |
+
static Matcher<java.lang.String> |
+containsStringIgnoringCase(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere, ignoring case. |
+
protected boolean |
+evalSubstringOf(java.lang.String s) |
+
converted, describeMismatchSafely, describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringContains(boolean ignoringCase, + java.lang.String substring)+
protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcherpublic static Matcher<java.lang.String> containsString(java.lang.String substring)+
String contains the specified
+ String anywhere.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)+
String contains the specified
+ String anywhere, ignoring case.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic class StringEndsWith +extends SubstringMatcher+
substring| Constructor and Description | +
|---|
StringEndsWith(boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.String> |
+endsWith(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String. |
+
static Matcher<java.lang.String> |
+endsWithIgnoringCase(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String, ignoring case. |
+
protected boolean |
+evalSubstringOf(java.lang.String s) |
+
converted, describeMismatchSafely, describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringEndsWith(boolean ignoringCase, + java.lang.String substring)+
protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcherpublic static Matcher<java.lang.String> endsWith(java.lang.String suffix)+
String ends with the specified
+ String.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)+
String ends with the specified
+ String, ignoring case.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic class StringStartsWith +extends SubstringMatcher+
substring| Constructor and Description | +
|---|
StringStartsWith(boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected boolean |
+evalSubstringOf(java.lang.String s) |
+
static Matcher<java.lang.String> |
+startsWith(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String. |
+
static Matcher<java.lang.String> |
+startsWithIgnoringCase(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String, ignoring case |
+
converted, describeMismatchSafely, describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringStartsWith(boolean ignoringCase, + java.lang.String substring)+
protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcherpublic static Matcher<java.lang.String> startsWith(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String, ignoring case
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic abstract class SubstringMatcher +extends TypeSafeMatcher<java.lang.String>+
| Modifier and Type | +Field and Description | +
|---|---|
protected java.lang.String |
+substring |
+
| Modifier | +Constructor and Description | +
|---|---|
protected |
+SubstringMatcher(java.lang.String relationship,
+ boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.String |
+converted(java.lang.String arg) |
+
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected abstract boolean |
+evalSubstringOf(java.lang.String string) |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected SubstringMatcher(java.lang.String relationship, + boolean ignoringCase, + java.lang.String substring)+
public boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.protected java.lang.String converted(java.lang.String arg)+
protected abstract boolean evalSubstringOf(java.lang.String string)+
See: Description
+| Class | +Description | +
|---|---|
| AllOf<T> | +
+ Calculates the logical conjunction of multiple matchers.
+ |
+
| AnyOf<T> | +
+ Calculates the logical disjunction of multiple matchers.
+ |
+
| CombinableMatcher<T> | ++ |
| CombinableMatcher.CombinableBothMatcher<X> | ++ |
| CombinableMatcher.CombinableEitherMatcher<X> | ++ |
| DescribedAs<T> | +
+ Provides a custom description to another matcher.
+ |
+
| Every<T> | ++ |
| Is<T> | +
+ Decorates another Matcher, retaining the behaviour but allowing tests
+ to be slightly more expressive.
+ |
+
| IsAnything<T> | +
+ A matcher that always returns
+true. |
+
| IsCollectionContaining<T> | ++ |
| IsEqual<T> | +
+ Is the value equal to another value, as tested by the
+
+Object.equals(java.lang.Object) invokedMethod? |
+
| IsInstanceOf | +
+ Tests whether the value is an instance of a class.
+ |
+
| IsNot<T> | +
+ Calculates the logical negation of a matcher.
+ |
+
| IsNull<T> | +
+ Is the value null?
+ |
+
| IsSame<T> | +
+ Is the value the same object as another value?
+ |
+
| StringContains | +
+ Tests if the argument is a string that contains a substring.
+ |
+
| StringEndsWith | +
+ Tests if the argument is a string that contains a substring.
+ |
+
| StringStartsWith | +
+ Tests if the argument is a string that contains a substring.
+ |
+
| SubstringMatcher | ++ |
Fundamental matchers of objects and values, and composite matchers.
public class ArrayIterator
+extends java.lang.Object
+implements java.util.Iterator<java.lang.Object>
+| Constructor and Description | +
|---|
ArrayIterator(java.lang.Object array) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+hasNext() |
+
java.lang.Object |
+next() |
+
void |
+remove() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic ArrayIterator(java.lang.Object array)+
public boolean hasNext()+
hasNext in interface java.util.Iterator<java.lang.Object>public java.lang.Object next()+
next in interface java.util.Iterator<java.lang.Object>public void remove()+
remove in interface java.util.Iterator<java.lang.Object>public class NullSafety
+extends java.lang.Object
+| Constructor and Description | +
|---|
NullSafety() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> java.util.List<Matcher<? super E>> |
+nullSafe(Matcher<? super E>[] itemMatchers) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class ReflectiveTypeFinder
+extends java.lang.Object
+| Constructor and Description | +
|---|
ReflectiveTypeFinder(java.lang.String methodName,
+ int expectedNumberOfParameters,
+ int typedParameter) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected boolean |
+canObtainExpectedTypeFrom(java.lang.reflect.Method method) |
+
protected java.lang.Class<?> |
+expectedTypeFrom(java.lang.reflect.Method method) |
+
java.lang.Class<?> |
+findExpectedType(java.lang.Class<?> fromClass) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic ReflectiveTypeFinder(java.lang.String methodName, + int expectedNumberOfParameters, + int typedParameter)+
public java.lang.Class<?> findExpectedType(java.lang.Class<?> fromClass)+
protected boolean canObtainExpectedTypeFrom(java.lang.reflect.Method method)+
method - The method to examine.protected java.lang.Class<?> expectedTypeFrom(java.lang.reflect.Method method)+
method - The method from which to extractpublic class SelfDescribingValue<T> +extends java.lang.Object +implements SelfDescribing+
| Constructor and Description | +
|---|
SelfDescribingValue(T value) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic SelfDescribingValue(T value)+
public void describeTo(Description description)+
SelfDescribingdescribeTo in interface SelfDescribingdescription - The description to be built or appended to.public class SelfDescribingValueIterator<T> +extends java.lang.Object +implements java.util.Iterator<SelfDescribing>+
| Constructor and Description | +
|---|
SelfDescribingValueIterator(java.util.Iterator<T> values) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+hasNext() |
+
SelfDescribing |
+next() |
+
void |
+remove() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic SelfDescribingValueIterator(java.util.Iterator<T> values)+
public boolean hasNext()+
hasNext in interface java.util.Iterator<SelfDescribing>public SelfDescribing next()+
next in interface java.util.Iterator<SelfDescribing>public void remove()+
remove in interface java.util.Iterator<SelfDescribing>| Class | +Description | +
|---|---|
| ArrayIterator | ++ |
| NullSafety | ++ |
| ReflectiveTypeFinder | ++ |
| SelfDescribingValue<T> | ++ |
| SelfDescribingValueIterator<T> | ++ |
public static interface FileMatchers.FileStatus
+| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+check(java.io.File actual) |
+
public final class FileMatchers
+extends java.lang.Object
+| Modifier and Type | +Class and Description | +
|---|---|
static interface |
+FileMatchers.FileStatus |
+
| Modifier and Type | +Field and Description | +
|---|---|
static FileMatchers.FileStatus |
+CAN_READ |
+
static FileMatchers.FileStatus |
+CAN_WRITE |
+
static FileMatchers.FileStatus |
+EXISTS |
+
static FileMatchers.FileStatus |
+IS_DIRECTORY |
+
static FileMatchers.FileStatus |
+IS_FILE |
+
| Constructor and Description | +
|---|
FileMatchers() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.io.File> |
+aFileNamed(Matcher<java.lang.String> expected) |
+
static Matcher<java.io.File> |
+aFileWithAbsolutePath(Matcher<java.lang.String> expected) |
+
static Matcher<java.io.File> |
+aFileWithCanonicalPath(Matcher<java.lang.String> expected) |
+
static Matcher<java.io.File> |
+aFileWithSize(long size) |
+
static Matcher<java.io.File> |
+aFileWithSize(Matcher<java.lang.Long> expected) |
+
static Matcher<java.io.File> |
+anExistingDirectory() |
+
static Matcher<java.io.File> |
+anExistingFile() |
+
static Matcher<java.io.File> |
+anExistingFileOrDirectory() |
+
static Matcher<java.io.File> |
+aReadableFile() |
+
static Matcher<java.io.File> |
+aWritableFile() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final FileMatchers.FileStatus CAN_WRITE+
public static final FileMatchers.FileStatus CAN_READ+
public static final FileMatchers.FileStatus IS_FILE+
public static final FileMatchers.FileStatus IS_DIRECTORY+
public static final FileMatchers.FileStatus EXISTS+
public static Matcher<java.io.File> anExistingDirectory()+
public static Matcher<java.io.File> anExistingFileOrDirectory()+
public static Matcher<java.io.File> anExistingFile()+
public static Matcher<java.io.File> aReadableFile()+
public static Matcher<java.io.File> aWritableFile()+
public static Matcher<java.io.File> aFileWithSize(long size)+
public static Matcher<java.io.File> aFileWithSize(Matcher<java.lang.Long> expected)+
public static Matcher<java.io.File> aFileNamed(Matcher<java.lang.String> expected)+
public static Matcher<java.io.File> aFileWithCanonicalPath(Matcher<java.lang.String> expected)+
| Interface | +Description | +
|---|---|
| FileMatchers.FileStatus | ++ |
| Class | +Description | +
|---|---|
| FileMatchers | ++ |
public class BigDecimalCloseTo +extends TypeSafeMatcher<java.math.BigDecimal>+
| Constructor and Description | +
|---|
BigDecimalCloseTo(java.math.BigDecimal value,
+ java.math.BigDecimal error) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.math.BigDecimal> |
+closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+Creates a matcher of
+BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+
void |
+describeMismatchSafely(java.math.BigDecimal item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.math.BigDecimal item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic BigDecimalCloseTo(java.math.BigDecimal value, + java.math.BigDecimal error)+
public boolean matchesSafely(java.math.BigDecimal item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.math.BigDecimal>public void describeMismatchSafely(java.math.BigDecimal item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.math.BigDecimal>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error)+
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"))))operand - the expected value of matching BigDecimalserror - the delta (+/-) within which matches will be allowedpublic class IsCloseTo +extends TypeSafeMatcher<java.lang.Double>+
| Constructor and Description | +
|---|
IsCloseTo(double value,
+ double error) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.Double> |
+closeTo(double operand,
+ double error)
+Creates a matcher of
+Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+
void |
+describeMismatchSafely(java.lang.Double item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.Double item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsCloseTo(double value, + double error)+
public boolean matchesSafely(java.lang.Double item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Double>public void describeMismatchSafely(java.lang.Double item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Double>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Double> closeTo(double operand, + double error)+
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)))
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowedpublic final class IsNaN +extends TypeSafeMatcher<java.lang.Double>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.Double item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.Double item)
+Subclasses should implement this.
+ |
+
static Matcher<java.lang.Double> |
+notANumber()
+Creates a matcher of
+Doubles that matches when an examined double is not a number. |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.Double item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Double>public void describeMismatchSafely(java.lang.Double item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Double>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Double> notANumber()+
Doubles that matches when an examined double is not a number.
+ For example:
+ assertThat(Double.NaN, is(notANumber()))
public class OrderingComparison
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static <T extends java.lang.Comparable<T>> |
+comparesEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThanOrEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+
static <T extends java.lang.Comparable<T>> |
+lessThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+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. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than or equal to zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than or equal to zero| Class | +Description | +
|---|---|
| BigDecimalCloseTo | ++ |
| IsCloseTo | +
+ Is the value a number equal to a value within some range of
+ acceptable error?
+ |
+
| IsNaN | +
+ Is the value a number actually not a number (NaN)?
+ |
+
| OrderingComparison | ++ |
Matchers that perform numeric comparisons.
public class HasToString<T> +extends FeatureMatcher<T,java.lang.String>+
| Constructor and Description | +
|---|
HasToString(Matcher<? super java.lang.String> toStringMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.String |
+featureValueOf(T actual)
+Implement this to extract the interesting feature.
+ |
+
static <T> Matcher<T> |
+hasToString(Matcher<? super java.lang.String> toStringMatcher)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value that satisfies the specified matcher. |
+
static <T> Matcher<T> |
+hasToString(java.lang.String expectedToString)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value equalTo the specified string. |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HasToString(Matcher<? super java.lang.String> toStringMatcher)+
protected java.lang.String featureValueOf(T actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<T,java.lang.String>actual - the target objectpublic static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)+
toString method
+ returns a value that satisfies the specified matcher.
+ For example:
+ assertThat(true, hasToString(equalTo("TRUE")))toStringMatcher - the matcher used to verify the toString resultpublic static <T> Matcher<T> hasToString(java.lang.String expectedToString)+
toString method
+ returns a value equalTo the specified string.
+ For example:
+ assertThat(true, hasToString("TRUE"))expectedToString - the expected toString resultpublic class IsCompatibleType<T> +extends TypeSafeMatcher<java.lang.Class<?>>+
| Constructor and Description | +
|---|
IsCompatibleType(java.lang.Class<T> type) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.Class<?> cls,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.Class<?> cls)
+Subclasses should implement this.
+ |
+
static <T> Matcher<java.lang.Class<?>> |
+typeCompatibleWith(java.lang.Class<T> baseType)
+Creates a matcher of
+Class that matches when the specified baseType is
+ assignable from the examined class. |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsCompatibleType(java.lang.Class<T> type)+
public boolean matchesSafely(java.lang.Class<?> cls)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Class<?>>public void describeMismatchSafely(java.lang.Class<?> cls, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Class<?>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)+
Class that matches when the specified baseType is
+ assignable from the examined class.
+ For example:
+ assertThat(Integer.class, typeCompatibleWith(Number.class))
baseType - the base class to examine classes againstpublic class IsEventFrom +extends TypeSafeDiagnosingMatcher<java.util.EventObject>+
| Constructor and Description | +
|---|
IsEventFrom(java.lang.Class<?> eventClass,
+ java.lang.Object source) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+Creates a matcher of
+EventObject that matches any object
+ derived from eventClass announced by source. |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Object source)
+Creates a matcher of
+EventObject that matches any EventObject
+ announced by source. |
+
boolean |
+matchesSafely(java.util.EventObject item,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsEventFrom(java.lang.Class<?> eventClass, + java.lang.Object source)+
public boolean matchesSafely(java.util.EventObject item, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.util.EventObject>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source)+
EventObject that matches any object
+ derived from eventClass announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
eventClass - the class of the event to match onsource - the source of the eventpublic static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)+
EventObject that matches any EventObject
+ announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(myBean)))
source - the source of the event| Class | +Description | +
|---|---|
| HasToString<T> | ++ |
| IsCompatibleType<T> | ++ |
| IsEventFrom | +
+ Tests if the value is an event announced by a specific object.
+ |
+
Matchers that inspect objects and classes.
| Interface | +Description | +
|---|---|
| Condition.Step<I,O> | ++ |
| Description | +
+ A description of a Matcher.
+ |
+
| Matcher<T> | +
+
+ A matcher over acceptable values.
+ |
+
| SelfDescribing | +
+ The ability of an object to describe itself.
+ |
+
| Class | +Description | +
|---|---|
| BaseDescription | +
+ A
+Description that is stored as a string. |
+
| BaseMatcher<T> | +
+ BaseClass for all Matcher implementations.
+ |
+
| Condition<T> | +
+ A Condition implements part of a multi-step match.
+ |
+
| CoreMatchers | ++ |
| CustomMatcher<T> | +
+ Utility class for writing one off matchers.
+ |
+
| CustomTypeSafeMatcher<T> | +
+ Utility class for writing one off matchers.
+ |
+
| Description.NullDescription | ++ |
| DiagnosingMatcher<T> | +
+ TODO(ngd): Document.
+ |
+
| FeatureMatcher<T,U> | +
+ Supporting class for matching a feature of an object.
+ |
+
| MatcherAssert | ++ |
| Matchers | ++ |
| StringDescription | +
+ A
+Description that is stored as a string. |
+
| TypeSafeDiagnosingMatcher<T> | +
+ Convenient base class for Matchers that require a non-null value of a specific type
+ and that will report why the received value has been rejected.
+ |
+
| TypeSafeMatcher<T> | +
+ Convenient base class for Matchers that require a non-null value of a specific type.
+ |
+
public final class IsBlankString +extends TypeSafeMatcher<java.lang.String>+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.String> |
+blankOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else. |
+
static Matcher<java.lang.String> |
+blankString()
+Creates a matcher of
+String that matches when the examined string contains
+ zero or more whitespace characters and nothing else. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, describeMismatchSafely, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> blankString()+
String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(" ", is(blankString()))public static Matcher<java.lang.String> blankOrNullString()+
String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(((String)null), is(blankOrNullString()))
public final class IsEmptyString +extends TypeSafeMatcher<java.lang.String>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+emptyOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ has zero length. |
+
static Matcher<java.lang.String> |
+emptyString()
+Creates a matcher of
+String that matches when the examined string has zero length. |
+
static Matcher<java.lang.String> |
+isEmptyOrNullString()
+Deprecated.
+
+use is(emptyOrNullString()) instead
+ |
+
static Matcher<java.lang.String> |
+isEmptyString()
+Deprecated.
+
+use is(emptyString()) instead
+ |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, describeMismatchSafely, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.@Deprecated +public static Matcher<java.lang.String> isEmptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", isEmptyString())public static Matcher<java.lang.String> emptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", is(emptyString()))@Deprecated +public static Matcher<java.lang.String> isEmptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), isEmptyOrNullString())
public static Matcher<java.lang.String> emptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), is(emptyOrNullString()))
public class IsEqualIgnoringCase +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
IsEqualIgnoringCase(java.lang.String string) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+equalToIgnoringCase(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsEqualIgnoringCase(java.lang.String string)+
public boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)+
String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+ For example:
+ assertThat("Foo", equalToIgnoringCase("FOO"))expectedString - the expected value of matched stringspublic class IsEqualIgnoringWhiteSpace +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
IsEqualIgnoringWhiteSpace(java.lang.String string) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+equalToIgnoringWhiteSpace(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
java.lang.String |
+stripSpace(java.lang.String toBeStripped) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsEqualIgnoringWhiteSpace(java.lang.String string)+
public boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public java.lang.String stripSpace(java.lang.String toBeStripped)+
public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)+
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:
+ assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))expectedString - the expected value of matched stringspublic class MatchesPattern +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
MatchesPattern(java.util.regex.Pattern pattern) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+matchesPattern(java.util.regex.Pattern pattern)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given Pattern. |
+
static Matcher<java.lang.String> |
+matchesPattern(java.lang.String regex)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern. |
+
protected boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, describeMismatchSafely, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MatchesPattern(java.util.regex.Pattern pattern)+
protected boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)+
String that matches when the examined string
+ exactly matches the given Pattern.public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)+
String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.public class StringContainsInOrder +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.String s)
+Subclasses should implement this.
+ |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.String... substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
public boolean matchesSafely(java.lang.String s)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
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"substrings - the substrings that must be contained within matching stringspublic static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)+
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"substrings - the substrings that must be contained within matching strings| Class | +Description | +
|---|---|
| IsBlankString | +
+ Matches blank Strings (and null).
+ |
+
| IsEmptyString | +
+ Matches empty Strings (and null).
+ |
+
| IsEqualIgnoringCase | +
+ Tests if a string is equal to another string, regardless of the case.
+ |
+
| IsEqualIgnoringWhiteSpace | +
+ Tests if a string is equal to another string, ignoring any changes in whitespace.
+ |
+
| MatchesPattern | ++ |
| StringContainsInOrder | ++ |
Matchers that perform text comparisons.
public class HasXPath +extends TypeSafeDiagnosingMatcher<org.w3c.dom.Node>+
| Modifier and Type | +Field and Description | +
|---|---|
static javax.xml.namespace.NamespaceContext |
+NO_NAMESPACE_CONTEXT |
+
| Constructor and Description | +
|---|
HasXPath(java.lang.String xPathExpression,
+ Matcher<java.lang.String> valueMatcher) |
+
HasXPath(java.lang.String xPathExpression,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
boolean |
+matchesSafely(org.w3c.dom.Node item,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic static final javax.xml.namespace.NamespaceContext NO_NAMESPACE_CONTEXT+
public HasXPath(java.lang.String xPathExpression, + Matcher<java.lang.String> valueMatcher)+
xPathExpression - XPath expression.valueMatcher - Matcher to use at given XPath.
+ May be null to specify that the XPath must exist but the value is irrelevant.public HasXPath(java.lang.String xPathExpression, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
xPathExpression - XPath expression.namespaceContext - Resolves XML namespace prefixes in the XPath expressionvalueMatcher - Matcher to use at given XPath.
+ May be null to specify that the XPath must exist but the value is irrelevant.public boolean matchesSafely(org.w3c.dom.Node item, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<org.w3c.dom.Node>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathnamespaceContext - the namespace for matching nodesvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)+
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"))xPath - the target xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext)+
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))xPath - the target xpathnamespaceContext - the namespace for matching nodes| Class | +Description | +
|---|---|
| HasXPath | +
+ Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+ |
+
Matchers of XML documents.
+ + diff --git a/docs/javadoc/2.0.0.0/overview-summary.html b/docs/javadoc/2.0.0.0/overview-summary.html new file mode 100644 index 00000000..c7a7ccb8 --- /dev/null +++ b/docs/javadoc/2.0.0.0/overview-summary.html @@ -0,0 +1,190 @@ + + + + + +
| Package | +Description | +
|---|---|
| org.hamcrest | ++ |
| org.hamcrest.beans | +
+ Matchers of Java Bean properties and their values.
+ |
+
| org.hamcrest.collection | +
+ Matchers of arrays and collections.
+ |
+
| org.hamcrest.comparator | ++ |
| org.hamcrest.core | +
+ Fundamental matchers of objects and values, and composite matchers.
+ |
+
| org.hamcrest.internal | ++ |
| org.hamcrest.io | ++ |
| org.hamcrest.number | +
+ Matchers that perform numeric comparisons.
+ |
+
| org.hamcrest.object | +
+ Matchers that inspect objects and classes.
+ |
+
| org.hamcrest.text | +
+ Matchers that perform text comparisons.
+ |
+
| org.hamcrest.xml | +
+ Matchers of XML documents.
+ |
+
| Class and Description | +
|---|
| org.hamcrest.collection.IsArrayContainingInAnyOrder
+ As of release 2.1, replaced by
+ArrayMatching. |
+
| org.hamcrest.collection.IsArrayContainingInOrder
+ As of release 2.1, replaced by
+ArrayMatching. |
+
| org.hamcrest.core.IsCollectionContaining
+ As of release 2.1, replaced by
+IsIterableContaining. |
+
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.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.Maps that matches when the size() method returns
+ a value equal to the specified size.Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.Maps that matches when the size() method returns
+ a value equal to the specified size.Maps that matches when the size() method returns
+ zero.Maps that matches when the size() method returns
+ zero.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.String.String.String.SelfDescribing value to this description.SelfDescribing objects
+ to the description.ArrayMatching.arrayContaining(Object[]).ArrayMatching.arrayContaining(Matcher[]).ArrayMatching.arrayContaining(List).ArrayMatching.arrayContainingInAnyOrder(Matcher[]).ArrayMatching.arrayContainingInAnyOrder(Collection).ArrayMatching.arrayContainingInAnyOrder(Object[]).length of the array
+ satisfies the specified matcher.length of the array
+ equals the specified size.length of the array
+ satisfies the specified matcher.length of the array
+ equals the specified size.StringDescription.toString(SelfDescribing).Description that is stored as a string.String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error.BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error.BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error.Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error.Comparatorss of T.T object that matches when the examined object is
+ equal to the specified value, as reported by the Comparator used to
+ create this builder.Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object.Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object.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.Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.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.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.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.Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher.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.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.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.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.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.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.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.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.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: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.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.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: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.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.String contains the specified
+ String anywhere.String contains the specified
+ String anywhere.String contains the specified
+ String anywhere.String contains the specified
+ String anywhere, ignoring case.String contains the specified
+ String anywhere, ignoring case.String contains the specified
+ String anywhere, ignoring case.Collections matching examined collections whose isEmpty
+ method returns true.Collections matching examined collections whose isEmpty
+ method returns true.length of the array
+ is zero.length of the array
+ is zero.Collections matching examined collections whose isEmpty
+ method returns true.Collections matching examined collections whose isEmpty
+ method returns true.Iterables matching examined iterables that yield no items.Iterables matching examined iterables that yield no items.Iterables matching examined iterables that yield no items.Iterables matching examined iterables that yield no items.String that matches when the examined string is null, or
+ has zero length.String that matches when the examined string is null, or
+ has zero length.String that matches when the examined string has zero length.String that matches when the examined string has zero length.String ends with the specified
+ String.String ends with the specified
+ String.String ends with the specified
+ String.String ends with the specified
+ String, ignoring case.String ends with the specified
+ String, ignoring case.String ends with the specified
+ String, ignoring case.operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object.String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored.String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored.String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.EventObject that matches any object
+ derived from eventClass announced by source.EventObject that matches any EventObject
+ announced by source.EventObject that matches any object
+ derived from eventClass announced by source.EventObject that matches any EventObject
+ announced by source.Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher.T object that matches when the examined object is
+ greater than the specified value, as reported by the Comparator used to
+ create this builder.Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object.Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object.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.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.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.Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value.Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value.IsIterableContaining.hasItem(Matcher).IsIterableContaining.hasItem(Object).Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher.Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item.elementMatcher.hasItemInArray(equalTo(x)).elementMatcher.hasItemInArray(equalTo(x)).IsIterableContaining.hasItems(Matcher[])}.IsIterableContaining.hasItems(Object[])}.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.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.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.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.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.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.Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.CharSequence that matches when a char sequence has the length
+ of the specified argument.CharSequence that matches when a char sequence has the given length
+ For example:CharSequence that matches when a char sequence has the given length
+ For example:Collections that matches when the size() method returns
+ a value that satisfies the specified matcher.Collections that matches when the size() method returns
+ a value equal to the specified size.Collections that matches when the size() method returns
+ a value that satisfies the specified matcher.Collections that matches when the size() method returns
+ a value equal to the specified size.toString method
+ returns a value that satisfies the specified matcher.toString method
+ returns a value equalTo the specified string.toString method
+ returns a value that satisfies the specified matcher.toString method
+ returns a value equalTo the specified string.Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher.Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher.Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content.Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content.Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher.Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher.Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content.Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object.is(equalTo(x)).is(equalTo(x)).is(equalTo(x)).is(instanceOf(SomeClass.class)).is(instanceOf(SomeClass.class)).is(instanceOf(SomeClass.class)).true.ArrayMatching.ArrayMatching.IsIterableContaining.Object.equals(java.lang.Object) invokedMethod?Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher.Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument.Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher.Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument.T object that matches when the examined object is
+ less than the specified value, as reported by the Comparator used to
+ create this builder.Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object.Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object.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.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.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.String that matches when the examined string
+ exactly matches the given Pattern.String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.String that matches when the examined string
+ exactly matches the given Pattern.String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.Pattern.Pattern.not(equalTo(x)).not(equalTo(x)).not(equalTo(x)).Doubles that matches when an examined double is not a number.Doubles that matches when an examined double is not a number.not(nullValue()).not(nullValue(X.class)).not(nullValue()).not(nullValue(X.class)).not(nullValue()).not(nullValue(X.class)).null.null.null.null.null.null.String starts with the specified
+ String.String starts with the specified
+ String.String starts with the specified
+ String.String starts with the specified
+ String, ignoring caseString starts with the specified
+ String, ignoring caseString starts with the specified
+ String, ignoring caseString that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance.Description that is stored as a string.SelfDescribing object as a String.Class that matches when the specified baseType is
+ assignable from the examined class.Class that matches when the specified baseType is
+ assignable from the examined class.matchesSafely
+ is not the class that binds <T> to a type.matchesSafely
+ is not the class that binds <T> to a type.matchesSafely
+ is not the class that binds <T> to a type.matchesSafely
+ is not the class that binds <T> to a type.Comparables.This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version.
+public abstract class BaseDescription +extends java.lang.Object +implements Description+
Description that is stored as a string.Description.NullDescriptionNONE| Constructor and Description | +
|---|
BaseDescription() |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected abstract void |
+append(char c)
+Append the char c to the description.
+ |
+
protected void |
+append(java.lang.String str)
+Append the String str to the description.
+ |
+
Description |
+appendDescriptionOf(SelfDescribing value)
+Appends the description of a
+SelfDescribing value to this description. |
+
Description |
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+Appends a list of
+SelfDescribing objects
+ to the description. |
+
Description |
+appendText(java.lang.String text)
+Appends some plain text to the description.
+ |
+
Description |
+appendValue(java.lang.Object value)
+Appends an arbitrary value to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+Appends a list of values to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+Appends a list of values to the description.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Description appendText(java.lang.String text)+
DescriptionappendText in interface Descriptionpublic Description appendDescriptionOf(SelfDescribing value)+
DescriptionSelfDescribing value to this description.appendDescriptionOf in interface Descriptionpublic Description appendValue(java.lang.Object value)+
DescriptionappendValue in interface Description@SafeVarargs +public final <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values)+
DescriptionappendValueList in interface Descriptionpublic <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values)+
DescriptionappendValueList in interface Descriptionpublic Description appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values)+
DescriptionSelfDescribing objects
+ to the description.appendList in interface Descriptionprotected void append(java.lang.String str)+
append(char).
+ Override in subclasses to provide an efficient implementation.protected abstract void append(char c)+
public abstract class BaseMatcher<T> +extends java.lang.Object +implements Matcher<T>+
Matcher| Constructor and Description | +
|---|
BaseMatcher() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+_dont_implement_Matcher___instead_extend_BaseMatcher_()
+Deprecated.
+ |
+
void |
+describeMismatch(java.lang.Object item,
+ Description description)
+Generate a description of why the matcher has not accepted the item.
+ |
+
protected static boolean |
+isNotNull(java.lang.Object actual,
+ Description mismatch)
+Useful null-check method.
+ |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeTo@Deprecated +public final void _dont_implement_Matcher___instead_extend_BaseMatcher_()+
Matcher_dont_implement_Matcher___instead_extend_BaseMatcher_ in interface Matcher<T>Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_()public void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.public java.lang.String toString()+
toString in class java.lang.Objectprotected static boolean isNotNull(java.lang.Object actual, + Description mismatch)+
actual - the object to checkmismatch - where to write the mismatch description, if any| Modifier and Type | +Method and Description | +
|---|---|
Condition<O> |
+apply(I value,
+ Description mismatch) |
+
public abstract class Condition<T>
+extends java.lang.Object
+| Modifier and Type | +Class and Description | +
|---|---|
static interface |
+Condition.Step<I,O> |
+
| Modifier and Type | +Field and Description | +
|---|---|
static org.hamcrest.Condition.NotMatched<java.lang.Object> |
+NOT_MATCHED |
+
| Modifier and Type | +Method and Description | +
|---|---|
abstract <U> Condition<U> |
+and(Condition.Step<? super T,U> mapping) |
+
static <T> Condition<T> |
+matched(T theValue,
+ Description mismatch) |
+
boolean |
+matching(Matcher<T> match) |
+
abstract boolean |
+matching(Matcher<T> match,
+ java.lang.String message) |
+
static <T> Condition<T> |
+notMatched() |
+
<U> Condition<U> |
+then(Condition.Step<? super T,U> mapping) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final org.hamcrest.Condition.NotMatched<java.lang.Object> NOT_MATCHED+
public abstract <U> Condition<U> and(Condition.Step<? super T,U> mapping)+
public final <U> Condition<U> then(Condition.Step<? super T,U> mapping)+
public static <T> Condition<T> notMatched()+
public static <T> Condition<T> matched(T theValue, + Description mismatch)+
public class CoreMatchers
+extends java.lang.Object
+| Constructor and Description | +
|---|
CoreMatchers() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+any(java.lang.Class<T> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> AnyOf<T> |
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static Matcher<java.lang.Object> |
+anything()
+Creates a matcher that always matches, regardless of the examined object.
+ |
+
static Matcher<java.lang.Object> |
+anything(java.lang.String description)
+Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified
+String. |
+
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
+both(Matcher<? super LHS> matcher)
+Creates a matcher that matches when both of the specified matchers match the examined object.
+ |
+
static Matcher<java.lang.String> |
+containsString(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere. |
+
static Matcher<java.lang.String> |
+containsStringIgnoringCase(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere, ignoring case. |
+
static <T> Matcher<T> |
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+Wraps an existing matcher, overriding its description with that specified.
+ |
+
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
+either(Matcher<? super LHS> matcher)
+Creates a matcher that matches when either of the specified matchers match the examined object.
+ |
+
static Matcher<java.lang.String> |
+endsWith(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String. |
+
static Matcher<java.lang.String> |
+endsWithIgnoringCase(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String, ignoring case. |
+
static <T> Matcher<T> |
+equalTo(T operand)
+Creates a matcher that matches when the examined object is logically equal to the specified
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+
static Matcher<java.lang.Object> |
+equalToObject(java.lang.Object operand)
+Creates an
+IsEqual matcher that does not enforce the values being
+ compared to be of the same static type. |
+
static <U> Matcher<java.lang.Iterable<? extends U>> |
+everyItem(Matcher<U> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(Matcher<? super T> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(T item)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(Matcher<? super T>... itemMatchers)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(T... items)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+
static <T> Matcher<T> |
+instanceOf(java.lang.Class<?> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> Matcher<T> |
+is(Matcher<T> matcher)
+Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+ |
+
static <T> Matcher<T> |
+is(T value)
+A shortcut to the frequently used
+is(equalTo(x)). |
+
static <T> Matcher<T> |
+isA(java.lang.Class<T> type)
+A shortcut to the frequently used
+is(instanceOf(SomeClass.class)). |
+
static <T> Matcher<T> |
+not(Matcher<T> matcher)
+Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+ |
+
static <T> Matcher<T> |
+not(T value)
+A shortcut to the frequently used
+not(equalTo(x)). |
+
static Matcher<java.lang.Object> |
+notNullValue()
+A shortcut to the frequently used
+not(nullValue()). |
+
static <T> Matcher<T> |
+notNullValue(java.lang.Class<T> type)
+A shortcut to the frequently used
+not(nullValue(X.class)). |
+
static Matcher<java.lang.Object> |
+nullValue()
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+nullValue(java.lang.Class<T> type)
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+sameInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static Matcher<java.lang.String> |
+startsWith(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String. |
+
static Matcher<java.lang.String> |
+startsWithIgnoringCase(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String, ignoring case |
+
static <T> Matcher<T> |
+theInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))@SafeVarargs +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))@SafeVarargs +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)+
assertThat("fab", both(containsString("a")).and(containsString("b")))public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)+
assertThat("fan", either(containsString("a")).or(containsString("b")))public static <T> Matcher<T> describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values)+
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised descriptionpublic static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)+
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")))itemMatcher - the matcher to apply to every item provided by the examined Iterablepublic static <T> Matcher<T> is(Matcher<T> matcher)+
assertThat(cheese, is(equalTo(smelly)))+ instead of: +
assertThat(cheese, equalTo(smelly))
public static <T> Matcher<T> is(T value)+
is(equalTo(x)).
+ For example:
+ assertThat(cheese, is(smelly))+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
public static <T> Matcher<T> isA(java.lang.Class<T> type)+
is(instanceOf(SomeClass.class)).
+ For example:
+ assertThat(cheese, isA(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
public static Matcher<java.lang.Object> anything()+
public static Matcher<java.lang.Object> anything(java.lang.String description)+
String.description - a meaningful String used when describing itselfpublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
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")))itemMatcher - the matcher to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
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"))item - the item to compare against the items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
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")))itemMatchers - the matchers to apply to items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
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"))items - the items to compare against the items provided by the examined Iterablepublic static <T> Matcher<T> equalTo(T operand)+
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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)+
IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.public static <T> Matcher<T> any(java.lang.Class<T> type)+
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))
assertThat(new Canoe(), instanceOf(Canoe.class));
public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)+
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));
public static <T> Matcher<T> not(Matcher<T> matcher)+
assertThat(cheese, is(not(equalTo(smelly))))
matcher - the matcher whose sense should be invertedpublic static <T> Matcher<T> not(T value)+
not(equalTo(x)).
+ For example:
+ assertThat(cheese, is(not(smelly)))+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
value - the value that any examined object should not equalpublic static Matcher<java.lang.Object> notNullValue()+
not(nullValue()).
+ For example:
+ assertThat(cheese, is(notNullValue()))+ instead of: +
assertThat(cheese, is(not(nullValue())))
public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)+
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 - dummy parameter used to infer the generic type of the returned matcherpublic static Matcher<java.lang.Object> nullValue()+
null.
+ For example:
+ assertThat(cheese, is(nullValue())
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)+
null. Accepts a
+ single dummy argument to facilitate type inference.
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
type - dummy parameter used to infer the generic type of the returned matcherpublic static <T> Matcher<T> sameInstance(T target)+
target - the target instance against which others should be assessedpublic static <T> Matcher<T> theInstance(T target)+
target - the target instance against which others should be assessedpublic static Matcher<java.lang.String> containsString(java.lang.String substring)+
String contains the specified
+ String anywhere.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)+
String contains the specified
+ String anywhere, ignoring case.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> startsWith(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String, ignoring case
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> endsWith(java.lang.String suffix)+
String ends with the specified
+ String.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)+
String ends with the specified
+ String, ignoring case.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringT - The type of object being matched.public abstract class CustomMatcher<T> +extends BaseMatcher<T>+
+ 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.
| Constructor and Description | +
|---|
CustomMatcher(java.lang.String description) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic CustomMatcher(java.lang.String description)+
public final void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.T - The type of object being matchedpublic abstract class CustomTypeSafeMatcher<T> +extends TypeSafeMatcher<T>+
+ Matcher<String> aNonEmptyString = new CustomTypeSafeMatcher<String>("a non empty string") {
+ public boolean matchesSafely(String string) {
+ return !string.isEmpty();
+ }
+ public void describeMismatchSafely(String string, Description mismatchDescription) {
+ mismatchDescription.appendText("was empty");
+ }
+ };
+
+ This is a variant of CustomMatcher that first type checks
+ the argument being matched. By the time TypeSafeMatcher.matchesSafely(T) is
+ is called the argument is guaranteed to be non-null and of the correct
+ type.| Constructor and Description | +
|---|
CustomTypeSafeMatcher(java.lang.String description) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
describeMismatch, describeMismatchSafely, matches, matchesSafely_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic CustomTypeSafeMatcher(java.lang.String description)+
public final void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static final class Description.NullDescription +extends java.lang.Object +implements Description+
Description.NullDescriptionNONE| Constructor and Description | +
|---|
NullDescription() |
+
| Modifier and Type | +Method and Description | +
|---|---|
Description |
+appendDescriptionOf(SelfDescribing value)
+Appends the description of a
+SelfDescribing value to this description. |
+
Description |
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+Appends a list of
+SelfDescribing objects
+ to the description. |
+
Description |
+appendText(java.lang.String text)
+Appends some plain text to the description.
+ |
+
Description |
+appendValue(java.lang.Object value)
+Appends an arbitrary value to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+Appends a list of values to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+Appends a list of values to the description.
+ |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic Description appendDescriptionOf(SelfDescribing value)+
DescriptionSelfDescribing value to this description.appendDescriptionOf in interface Descriptionpublic Description appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values)+
DescriptionSelfDescribing objects
+ to the description.appendList in interface Descriptionpublic Description appendText(java.lang.String text)+
DescriptionappendText in interface Descriptionpublic Description appendValue(java.lang.Object value)+
DescriptionappendValue in interface Descriptionpublic <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values)+
DescriptionappendValueList in interface Descriptionpublic <T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values)+
DescriptionappendValueList in interface Descriptionpublic java.lang.String toString()+
toString in class java.lang.Objectpublic interface Description
+SelfDescribing.describeTo(Description)| Modifier and Type | +Interface and Description | +
|---|---|
static class |
+Description.NullDescription |
+
| Modifier and Type | +Field and Description | +
|---|---|
static Description |
+NONE
+A description that consumes input but does nothing.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
Description |
+appendDescriptionOf(SelfDescribing value)
+Appends the description of a
+SelfDescribing value to this description. |
+
Description |
+appendList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<? extends SelfDescribing> values)
+Appends a list of
+SelfDescribing objects
+ to the description. |
+
Description |
+appendText(java.lang.String text)
+Appends some plain text to the description.
+ |
+
Description |
+appendValue(java.lang.Object value)
+Appends an arbitrary value to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ java.lang.Iterable<T> values)
+Appends a list of values to the description.
+ |
+
<T> Description |
+appendValueList(java.lang.String start,
+ java.lang.String separator,
+ java.lang.String end,
+ T... values)
+Appends a list of values to the description.
+ |
+
static final Description NONE+
Description appendText(java.lang.String text)+
Description appendDescriptionOf(SelfDescribing value)+
SelfDescribing value to this description.Description appendValue(java.lang.Object value)+
<T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + T... values)+
<T> Description appendValueList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<T> values)+
Description appendList(java.lang.String start, + java.lang.String separator, + java.lang.String end, + java.lang.Iterable<? extends SelfDescribing> values)+
SelfDescribing objects
+ to the description.T - public abstract class DiagnosingMatcher<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
DiagnosingMatcher() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
boolean |
+matches(java.lang.Object item)
+Evaluates the matcher for argument item.
+ |
+
protected abstract boolean |
+matches(java.lang.Object item,
+ Description mismatchDescription) |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeTopublic final boolean matches(java.lang.Object item)+
Matcheritem - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic final void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.protected abstract boolean matches(java.lang.Object item, + Description mismatchDescription)+
T - The type of the object to be matchedU - The type of the feature to be matchedpublic abstract class FeatureMatcher<T,U> +extends TypeSafeDiagnosingMatcher<T>+
featureValueOf()
+ in a subclass to pull out the feature to be matched against.| Constructor and Description | +
|---|
FeatureMatcher(Matcher<? super U> subMatcher,
+ java.lang.String featureDescription,
+ java.lang.String featureName)
+Constructor
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected abstract U |
+featureValueOf(T actual)
+Implement this to extract the interesting feature.
+ |
+
protected boolean |
+matchesSafely(T actual,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic FeatureMatcher(Matcher<? super U> subMatcher, + java.lang.String featureDescription, + java.lang.String featureName)+
subMatcher - The matcher to apply to the featurefeatureDescription - Descriptive text to use in describeTofeatureName - Identifying text for mismatch messageprotected abstract U featureValueOf(T actual)+
actual - the target objectprotected boolean matchesSafely(T actual, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public final void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.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. +
BaseMatcher| Modifier and Type | +Method and Description | +
|---|---|
void |
+_dont_implement_Matcher___instead_extend_BaseMatcher_()
+Deprecated.
+
+to make
+ |
+
void |
+describeMismatch(java.lang.Object actual,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
boolean |
+matches(java.lang.Object actual)
+Evaluates the matcher for argument item.
+ |
+
describeToboolean matches(java.lang.Object actual)+
actual - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatchervoid describeMismatch(java.lang.Object actual, + Description mismatchDescription)+
matches(item) is false, but
+ will not check this.actual - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.@Deprecated +void _dont_implement_Matcher___instead_extend_BaseMatcher_()+
for reasons why.,
+BaseMatcherpublic class MatcherAssert
+extends java.lang.Object
+| Constructor and Description | +
|---|
MatcherAssert() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static void |
+assertThat(java.lang.String reason,
+ boolean assertion) |
+
static <T> void |
+assertThat(java.lang.String reason,
+ T actual,
+ Matcher<? super T> matcher) |
+
static <T> void |
+assertThat(T actual,
+ Matcher<? super T> matcher) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T> void assertThat(T actual, + Matcher<? super T> matcher)+
public static <T> void assertThat(java.lang.String reason, + T actual, + Matcher<? super T> matcher)+
public static void assertThat(java.lang.String reason, + boolean assertion)+
public class Matchers
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(int size)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value equal to the specified size. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+anEmptyMap()
+Creates a matcher for
+Maps that matches when the size() method returns
+ zero. |
+
static <T> Matcher<T> |
+any(java.lang.Class<T> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> AnyOf<T> |
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<T> first,
+ Matcher<? super T> second,
+ Matcher<? super T> third,
+ Matcher<? super T> fourth,
+ Matcher<? super T> fifth,
+ Matcher<? super T> sixth)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static Matcher<java.lang.Object> |
+anything()
+Creates a matcher that always matches, regardless of the examined object.
+ |
+
static Matcher<java.lang.Object> |
+anything(java.lang.String description)
+Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified
+String. |
+
static <T> IsArray<T> |
+array(Matcher<? super T>... elementMatchers)
+Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(E... items)
+Creates a matcher for arrays that matches when each item in the examined array is
+ logically equal to the corresponding item in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified list of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(Matcher<? super E>... itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified collection of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(E... items)
+Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array is logically equal to one item anywhere in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayWithSize(int size)
+Creates a matcher for arrays that matches when the
+length of the array
+ equals the specified size. |
+
static <E> Matcher<E[]> |
+arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for arrays that matches when the
+length of the array
+ satisfies the specified matcher. |
+
static Matcher<java.lang.String> |
+blankOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else. |
+
static Matcher<java.lang.String> |
+blankString()
+Creates a matcher of
+String that matches when the examined string contains
+ zero or more whitespace characters and nothing else. |
+
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
+both(Matcher<? super LHS> matcher)
+Creates a matcher that matches when both of the specified matchers match the examined object.
+ |
+
static Matcher<java.math.BigDecimal> |
+closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+Creates a matcher of
+BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+
static Matcher<java.lang.Double> |
+closeTo(double operand,
+ double error)
+Creates a matcher of
+Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+
static <T extends java.lang.Comparable<T>> |
+comparesEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E> itemMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(T... items)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items logically equal to the
+ corresponding item in the specified items, in the same relative order
+ For example: |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items satisfying the corresponding
+ matcher in the specified list of matchers, in the same relative order. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that each satisfying the corresponding
+ matcher in the specified matchers, in the same relative order. |
+
static Matcher<java.lang.String> |
+containsString(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere. |
+
static Matcher<java.lang.String> |
+containsStringIgnoringCase(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere, ignoring case. |
+
static <T> Matcher<T> |
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+Wraps an existing matcher, overriding its description with that specified.
+ |
+
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
+either(Matcher<? super LHS> matcher)
+Creates a matcher that matches when either of the specified matchers match the examined object.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+empty()
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
static <E> Matcher<E[]> |
+emptyArray()
+Creates a matcher for arrays that matches when the
+length of the array
+ is zero. |
+
static <E> Matcher<java.util.Collection<E>> |
+emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+emptyIterable()
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
static Matcher<java.lang.String> |
+emptyOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ has zero length. |
+
static Matcher<java.lang.String> |
+emptyString()
+Creates a matcher of
+String that matches when the examined string has zero length. |
+
static Matcher<java.lang.String> |
+endsWith(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String. |
+
static Matcher<java.lang.String> |
+endsWithIgnoringCase(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String, ignoring case. |
+
static <T> Matcher<T> |
+equalTo(T operand)
+Creates a matcher that matches when the examined object is logically equal to the specified
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+
static Matcher<java.lang.String> |
+equalToCompressingWhiteSpace(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+
static Matcher<java.lang.String> |
+equalToIgnoringCase(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+
static Matcher<java.lang.String> |
+equalToIgnoringWhiteSpace(java.lang.String expectedString)
+Deprecated.
+
+
+ |
+
static Matcher<java.lang.Object> |
+equalToObject(java.lang.Object operand)
+Creates an
+IsEqual matcher that does not enforce the values being
+ compared to be of the same static type. |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+Creates a matcher of
+EventObject that matches any object
+ derived from eventClass announced by source. |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Object source)
+Creates a matcher of
+EventObject that matches any EventObject
+ announced by source. |
+
static <U> Matcher<java.lang.Iterable<? extends U>> |
+everyItem(Matcher<U> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThanOrEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(K key,
+ V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(Matcher<? super T> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(T item)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+
static <T> Matcher<T[]> |
+hasItemInArray(Matcher<? super T> elementMatcher)
+Creates a matcher for arrays that matches when the examined array contains at least one item
+ that is matched by the specified
+elementMatcher. |
+
static <T> Matcher<T[]> |
+hasItemInArray(T element)
+A shortcut to the frequently used
+hasItemInArray(equalTo(x)). |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(Matcher<? super T>... itemMatchers)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(T... items)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(K key)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that is equal to the specified key. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(Matcher<? super K> keyMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+
static Matcher<java.lang.CharSequence> |
+hasLength(int length)
+Creates a matcher of
+CharSequence that matches when a char sequence has the length
+ of the specified argument. |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name.
+ |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name whose value satisfies the specified matcher.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(int size)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value equal to the specified size. |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
static <T> Matcher<T> |
+hasToString(Matcher<? super java.lang.String> toStringMatcher)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value that satisfies the specified matcher. |
+
static <T> Matcher<T> |
+hasToString(java.lang.String expectedToString)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value equalTo the specified string. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that is equal to the specified value. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
static <T> Matcher<T> |
+in(java.util.Collection<T> collection)
+Creates a matcher that matches when the examined object is found within the
+ specified collection.
+ |
+
static <T> Matcher<T> |
+in(T[] elements)
+Creates a matcher that matches when the examined object is found within the
+ specified array.
+ |
+
static <T> Matcher<T> |
+instanceOf(java.lang.Class<?> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
static <T> Matcher<T> |
+is(Matcher<T> matcher)
+Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+ |
+
static <T> Matcher<T> |
+is(T value)
+A shortcut to the frequently used
+is(equalTo(x)). |
+
static <T> Matcher<T> |
+isA(java.lang.Class<?> type)
+A shortcut to the frequently used
+is(instanceOf(SomeClass.class)). |
+
static Matcher<java.lang.String> |
+isEmptyOrNullString()
+Deprecated.
+
+use is(emptyOrNullString()) instead
+ |
+
static Matcher<java.lang.String> |
+isEmptyString()
+Deprecated.
+
+use is(emptyString()) instead
+ |
+
static <T> Matcher<T> |
+isIn(java.util.Collection<T> collection)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isIn(T[] elements)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isOneOf(T... elements)
+Deprecated.
+
+use is(oneOf(...)) instead
+ |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(int size)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+
static <T extends java.lang.Comparable<T>> |
+lessThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+lessThanOrEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ less than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+
static Matcher<java.lang.String> |
+matchesPattern(java.util.regex.Pattern pattern)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given Pattern. |
+
static Matcher<java.lang.String> |
+matchesPattern(java.lang.String regex)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern. |
+
static Matcher<java.lang.String> |
+matchesRegex(java.util.regex.Pattern pattern)
+Validate a string with a
+Pattern. |
+
static Matcher<java.lang.String> |
+matchesRegex(java.lang.String regex)
+Validate a string with a regex.
+ |
+
static <T> Matcher<T> |
+not(Matcher<T> matcher)
+Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+ |
+
static <T> Matcher<T> |
+not(T value)
+A shortcut to the frequently used
+not(equalTo(x)). |
+
static Matcher<java.lang.Double> |
+notANumber()
+Creates a matcher of
+Doubles that matches when an examined double is not a number. |
+
static Matcher<java.lang.Object> |
+notNullValue()
+A shortcut to the frequently used
+not(nullValue()). |
+
static <T> Matcher<T> |
+notNullValue(java.lang.Class<T> type)
+A shortcut to the frequently used
+not(nullValue(X.class)). |
+
static Matcher<java.lang.Object> |
+nullValue()
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+nullValue(java.lang.Class<T> type)
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+oneOf(T... elements)
+Creates a matcher that matches when the examined object is equal to one of the
+ specified elements.
+ |
+
static <T> Matcher<T> |
+sameInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static <B> Matcher<B> |
+samePropertyValuesAs(B expectedBean,
+ java.lang.String... ignoredProperties)
+Creates a matcher that matches when the examined object has values for all of
+ its JavaBean properties that are equal to the corresponding values of the
+ specified bean.
+ |
+
static Matcher<java.lang.String> |
+startsWith(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String. |
+
static Matcher<java.lang.String> |
+startsWithIgnoringCase(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String, ignoring case |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.String... substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
static <T> Matcher<T> |
+theInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static <T> Matcher<java.lang.Class<?>> |
+typeCompatibleWith(java.lang.Class<T> baseType)
+Creates a matcher of
+Class that matches when the specified baseType is
+ assignable from the examined class. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))@SafeVarargs +public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> Matcher<T> allOf(Matcher<? super T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))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)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))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)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))@SafeVarargs +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <T> AnyOf<T> anyOf(Matcher<T> first, + Matcher<? super T> second, + Matcher<? super T> third, + Matcher<? super T> fourth, + Matcher<? super T> fifth, + Matcher<? super T> sixth)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)+
assertThat("fab", both(containsString("a")).and(containsString("b")))public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)+
assertThat("fan", either(containsString("a")).or(containsString("b")))public static <T> Matcher<T> describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values)+
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenized descriptionpublic static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)+
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")))itemMatcher - the matcher to apply to every item provided by the examined Iterablepublic static <T> Matcher<T> is(Matcher<T> matcher)+
assertThat(cheese, is(equalTo(smelly)))+ instead of: +
assertThat(cheese, equalTo(smelly))
public static <T> Matcher<T> is(T value)+
is(equalTo(x)).
+ For example:
+ assertThat(cheese, is(smelly))+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
public static <T> Matcher<T> isA(java.lang.Class<?> type)+
is(instanceOf(SomeClass.class)).
+ For example:
+ assertThat(cheese, isA(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
public static Matcher<java.lang.Object> anything()+
public static Matcher<java.lang.Object> anything(java.lang.String description)+
String.description - a meaningful String used when describing itselfpublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
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")))itemMatcher - the matcher to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
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"))item - the item to compare against the items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
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")))itemMatchers - the matchers to apply to items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
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"))items - the items to compare against the items provided by the examined Iterablepublic static <T> Matcher<T> equalTo(T operand)+
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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ public static Matcher<java.lang.Object> equalToObject(java.lang.Object operand)+
IsEqual matcher that does not enforce the values being
+ compared to be of the same static type.public static <T> Matcher<T> any(java.lang.Class<T> type)+
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))
assertThat(new Canoe(), instanceOf(Canoe.class));
public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)+
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));
public static <T> Matcher<T> not(Matcher<T> matcher)+
assertThat(cheese, is(not(equalTo(smelly))))
matcher - the matcher whose sense should be invertedpublic static <T> Matcher<T> not(T value)+
not(equalTo(x)).
+ For example:
+ assertThat(cheese, is(not(smelly)))+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
value - the value that any examined object should not equalpublic static Matcher<java.lang.Object> notNullValue()+
not(nullValue()).
+ For example:
+ assertThat(cheese, is(notNullValue()))+ instead of: +
assertThat(cheese, is(not(nullValue())))
public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)+
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 - dummy parameter used to infer the generic type of the returned matcherpublic static Matcher<java.lang.Object> nullValue()+
null.
+ For example:
+ assertThat(cheese, is(nullValue())
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)+
null. Accepts a
+ single dummy argument to facilitate type inference.
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
type - dummy parameter used to infer the generic type of the returned matcherpublic static <T> Matcher<T> sameInstance(T target)+
target - the target instance against which others should be assessedpublic static <T> Matcher<T> theInstance(T target)+
target - the target instance against which others should be assessedpublic static Matcher<java.lang.String> containsString(java.lang.String substring)+
String contains the specified
+ String anywhere.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)+
String contains the specified
+ String anywhere, ignoring case.
+ For example:
+ assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> startsWith(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String, ignoring case
+
assertThat("myStringOfNote", startsWithIgnoringCase("My"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> endsWith(java.lang.String suffix)+
String ends with the specified
+ String.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)+
String ends with the specified
+ String, ignoring case.
+ For example:
+ assertThat("myStringOfNote", endsWithIgnoringCase("note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static Matcher<java.lang.String> matchesRegex(java.util.regex.Pattern pattern)+
Pattern.
+
+
+ assertThat("abc", matchesRegex(Pattern.compile("ˆ[a-z]$"));
+ pattern - the pattern to be used.public static Matcher<java.lang.String> matchesRegex(java.lang.String regex)+
+ assertThat("abc", matchesRegex("ˆ[a-z]+$"));
+ regex - The regex to be used for the validation.@SafeVarargs +public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)+
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))elementMatchers - the matchers that the elements of examined arrays should satisfypublic static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)+
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")))elementMatcher - the matcher to apply to elements in examined arrayspublic static <T> Matcher<T[]> hasItemInArray(T element)+
hasItemInArray(equalTo(x)).
+ For example:
+ assertThat(hasItemInArray(x))+ instead of: +
assertThat(hasItemInArray(equalTo(x)))
element - the element that should be present in examined arrays@SafeVarargs +public static <E> Matcher<E[]> arrayContaining(E... items)+
assertThat(new String[]{"foo", "bar"}, arrayContaining("foo", "bar"))items - the items that must equal the items within an examined array@SafeVarargs +public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)+
assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))itemMatchers - the matchers that must be satisfied by the items in the examined arraypublic static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)+
assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined array@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")))itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined arraypublic static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. + For a positive match, the examined array must be of the same length as the specified collection + of matchers. +
++ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined array. +
++ For example: +
+assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array@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"))items - the items that must equal the entries of an examined array, in any orderpublic static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
length of the array
+ satisfies the specified matcher.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))sizeMatcher - a matcher for the length of an examined arraypublic static <E> Matcher<E[]> arrayWithSize(int size)+
length of the array
+ equals the specified size.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))size - the length that an examined array must have for a positive matchpublic static <E> Matcher<E[]> emptyArray()+
length of the array
+ is zero.
+ For example:
+ assertThat(new String[0], emptyArray())
public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, is(aMapWithSize(equalTo(2))))
sizeMatcher - a matcher for the size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)+
Maps that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(myMap, is(aMapWithSize(2)))
size - the expected size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()+
Maps that matches when the size() method returns
+ zero.
+ For example:
+ assertThat(myMap, is(anEmptyMap()))
public static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the size of an examined Collectionpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)+
Collections that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(Arrays.asList("foo", "bar"), hasSize(2))size - the expected size of an examined Collectionpublic static <E> Matcher<java.util.Collection<? extends E>> empty()+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(empty()))
public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
unusedToForceReturnType - the type of the collection's contentpublic static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterable()))
public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
unusedToForceReturnType - the type of the iterable's content@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)+
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"))items - the items that must equal the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)+
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")))itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterable@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by
+ an examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. For a positive match, the examined iterable must be of the same
+ length as the number of specified matchers.
+
+ N.B. each of the specified matchers will only be used once during a given examination, so be + careful when specifying matchers that may be satisfied by more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. For a positive match, the examined iterable
+ must be of the same length as the number of specified items.
+
+ N.B. each of the specified items will only be used once during a given examination, so be + careful when specifying items that may be equal to more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))items - the items that must equal the items provided by an examined Iterable in any orderpublic static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. For a positive match, the examined iterable
+ must be of the same length as the specified collection of matchers.
+
+ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined iterable. +
+For example:
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)+
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"))items - the items that must be contained within items provided by an examined Iterable in the same relative order@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the items provided by
+ an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)+
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))size - the number of items that should be yielded by an examined Iterablepublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher)+
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")))keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entryvalueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entrypublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key, + V value)+
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"))key - the key that, in combination with the value, must be describe at least one entryvalue - the value that, in combination with the key, must be describe at least one entrypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)+
Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, hasKey(equalTo("bar")))keyMatcher - the matcher that must be satisfied by at least one keypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)+
Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+ For example:
+ assertThat(myMap, hasKey("bar"))key - the key that satisfying maps must containpublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)+
Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+ For example:
+ assertThat(myMap, hasValue(equalTo("foo")))valueMatcher - the matcher that must be satisfied by at least one valuepublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)+
Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+ For example:
+ assertThat(myMap, hasValue("foo"))value - the value that satisfying maps must containpublic static <T> Matcher<T> in(java.util.Collection<T> collection)+
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))collection - the collection in which matching items must be foundpublic static <T> Matcher<T> in(T[] elements)+
assertThat("foo", is(in(new String[]{"bar", "foo"})))elements - the array in which matching items must be foundpublic static <T> Matcher<T> isIn(java.util.Collection<T> collection)+
assertThat("foo", isIn(Arrays.asList("bar", "foo")))collection - the collection in which matching items must be foundpublic static <T> Matcher<T> isIn(T[] elements)+
assertThat("foo", isIn(new String[]{"bar", "foo"}))elements - the array in which matching items must be found@SafeVarargs +public static <T> Matcher<T> isOneOf(T... elements)+
assertThat("foo", isOneOf("bar", "foo"))elements - the elements amongst which matching items will be found@SafeVarargs +public static <T> Matcher<T> oneOf(T... elements)+
assertThat("foo", is(oneOf("bar", "foo")))elements - the elements amongst which matching items will be foundpublic static Matcher<java.lang.Double> closeTo(double operand, + double error)+
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)))
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowedpublic static Matcher<java.lang.Double> notANumber()+
Doubles that matches when an examined double is not a number.
+ For example:
+ assertThat(Double.NaN, is(notANumber()))
public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error)+
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"))))operand - the expected value of matching BigDecimalserror - the delta (+/-) within which matches will be allowedpublic static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than or equal to zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than or equal to zeropublic static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)+
String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+ For example:
+ assertThat("Foo", equalToIgnoringCase("FOO"))expectedString - the expected value of matched stringspublic static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)+
equalToCompressingWhiteSpace(String)expectedString - the expected value of matched stringspublic static Matcher<java.lang.String> equalToCompressingWhiteSpace(java.lang.String expectedString)+
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:
+ assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))expectedString - the expected value of matched stringspublic static Matcher<java.lang.String> emptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), is(emptyOrNullString()))
public static Matcher<java.lang.String> emptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", is(emptyString()))public static Matcher<java.lang.String> isEmptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), isEmptyOrNullString())
public static Matcher<java.lang.String> isEmptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", isEmptyString())public static Matcher<java.lang.String> blankOrNullString()+
String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(((String)null), is(blankOrNullString()))
public static Matcher<java.lang.String> blankString()+
String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(" ", is(blankString()))public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)+
String that matches when the examined string
+ exactly matches the given Pattern.public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)+
String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
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"substrings - the substrings that must be contained within matching stringspublic static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)+
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"substrings - the substrings that must be contained within matching stringspublic static Matcher<java.lang.CharSequence> hasLength(int length)+
CharSequence that matches when a char sequence has the length
+ of the specified argument.
+ For example:
+
+
+ assertThat("text", length(4))
+ length - the expected length of the stringpublic static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)+
toString method
+ returns a value that satisfies the specified matcher.
+ For example:
+ assertThat(true, hasToString(equalTo("TRUE")))toStringMatcher - the matcher used to verify the toString resultpublic static <T> Matcher<T> hasToString(java.lang.String expectedToString)+
toString method
+ returns a value equalTo the specified string.
+ For example:
+ assertThat(true, hasToString("TRUE"))expectedToString - the expected toString resultpublic static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)+
Class that matches when the specified baseType is
+ assignable from the examined class.
+ For example:
+ assertThat(Integer.class, typeCompatibleWith(Number.class))
baseType - the base class to examine classes againstpublic static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source)+
EventObject that matches any object
+ derived from eventClass announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
eventClass - the class of the event to match onsource - the source of the eventpublic static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)+
EventObject that matches any EventObject
+ announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(myBean)))
source - the source of the eventpublic static <T> Matcher<T> hasProperty(java.lang.String propertyName)+
assertThat(myBean, hasProperty("foo"))propertyName - the name of the JavaBean property that examined beans should possesspublic static <T> Matcher<T> hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher)+
assertThat(myBean, hasProperty("foo", equalTo("bar"))propertyName - the name of the JavaBean property that examined beans should possessvalueMatcher - a matcher for the value of the specified property of the examined beanpublic static <B> Matcher<B> samePropertyValuesAs(B expectedBean, + java.lang.String... ignoredProperties)+
agerather than method names such as
getAge. + For example: +
assertThat(myBean, samePropertyValuesAs(myExpectedBean))+
assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
expectedBean - the bean against which examined beans are comparedignoredProperties - do not check any of these named properties.public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathnamespaceContext - the namespace for matching nodesvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)+
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"))xPath - the target xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext)+
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))xPath - the target xpathnamespaceContext - the namespace for matching nodespublic interface SelfDescribing
+| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
void describeTo(Description description)+
description - The description to be built or appended to.public class StringDescription +extends BaseDescription+
Description that is stored as a string.Description.NullDescriptionNONE| Constructor and Description | +
|---|
StringDescription() |
+
StringDescription(java.lang.Appendable out) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected void |
+append(char c)
+Append the char c to the description.
+ |
+
protected void |
+append(java.lang.String str)
+Append the String str to the description.
+ |
+
static java.lang.String |
+asString(SelfDescribing selfDescribing)
+Alias for
+toString(SelfDescribing). |
+
java.lang.String |
+toString()
+Returns the description as a string.
+ |
+
static java.lang.String |
+toString(SelfDescribing selfDescribing)
+Return the description of a
+SelfDescribing object as a String. |
+
appendDescriptionOf, appendList, appendText, appendValue, appendValueList, appendValueListclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringDescription()+
public StringDescription(java.lang.Appendable out)+
public static java.lang.String toString(SelfDescribing selfDescribing)+
SelfDescribing object as a String.selfDescribing - The object to be described.public static java.lang.String asString(SelfDescribing selfDescribing)+
toString(SelfDescribing).protected void append(java.lang.String str)+
BaseDescriptionBaseDescription.append(char).
+ Override in subclasses to provide an efficient implementation.append in class BaseDescriptionprotected void append(char c)+
BaseDescriptionappend in class BaseDescriptionpublic java.lang.String toString()+
toString in class java.lang.ObjectT - public abstract class TypeSafeDiagnosingMatcher<T> +extends BaseMatcher<T>+
matchesSafely().
| Modifier | +Constructor and Description | +
|---|---|
protected |
+TypeSafeDiagnosingMatcher()
+The default constructor for simple sub types
+ |
+
protected |
+TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
protected |
+TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
boolean |
+matches(java.lang.Object item)
+Evaluates the matcher for argument item.
+ |
+
protected abstract boolean |
+matchesSafely(T item,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeToprotected TypeSafeDiagnosingMatcher(java.lang.Class<?> expectedType)+
matchesSafely
+ is not the class that binds <T> to a type.expectedType - The expectedType of the actual value.protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder)+
matchesSafely
+ is not the class that binds <T> to a type.typeFinder - A type finder to extract the typeprotected TypeSafeDiagnosingMatcher()+
protected abstract boolean matchesSafely(T item, + Description mismatchDescription)+
public final boolean matches(java.lang.Object item)+
Matcheritem - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic final void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.public abstract class TypeSafeMatcher<T> +extends BaseMatcher<T>+
| Modifier | +Constructor and Description | +
|---|---|
protected |
+TypeSafeMatcher()
+The default constructor for simple sub types
+ |
+
protected |
+TypeSafeMatcher(java.lang.Class<?> expectedType)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
protected |
+TypeSafeMatcher(ReflectiveTypeFinder typeFinder)
+Use this constructor if the subclass that implements
+matchesSafely
+ is not the class that binds <T> to a type. |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description description)
+Generate a description of why the matcher has not accepted the item.
+ |
+
protected void |
+describeMismatchSafely(T item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
boolean |
+matches(java.lang.Object item)
+Methods made final to prevent accidental override.
+ |
+
protected abstract boolean |
+matchesSafely(T item)
+Subclasses should implement this.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdescribeToprotected TypeSafeMatcher()+
protected TypeSafeMatcher(java.lang.Class<?> expectedType)+
matchesSafely
+ is not the class that binds <T> to a type.expectedType - The expectedType of the actual value.protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder)+
matchesSafely
+ is not the class that binds <T> to a type.typeFinder - A type finder to extract the typeprotected abstract boolean matchesSafely(T item)+
protected void describeMismatchSafely(T item, + Description mismatchDescription)+
public final boolean matches(java.lang.Object item)+
BaseMatcher.item - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic final void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.public class HasProperty<T> +extends TypeSafeMatcher<T>+
| Constructor and Description | +
|---|
HasProperty(java.lang.String propertyName) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(T item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name.
+ |
+
boolean |
+matchesSafely(T obj)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HasProperty(java.lang.String propertyName)+
public boolean matchesSafely(T obj)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<T>public void describeMismatchSafely(T item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> hasProperty(java.lang.String propertyName)+
assertThat(myBean, hasProperty("foo"))propertyName - the name of the JavaBean property that examined beans should possesspublic class HasPropertyWithValue<T> +extends TypeSafeDiagnosingMatcher<T>+
Matcher that asserts that a JavaBean property on an argument passed to the + mock object meets the provided matcher. This is useful for when objects + are created within code under test and passed to a mock object, and you wish + to assert that the created object has certain properties. +
+ +
+ public class Person {
+ private String name;
+ public Person(String person) {
+ this.person = person;
+ }
+ public String getName() {
+ return name;
+ }
+ }
+
+ And that these person objects are generated within a piece of code under test
+ (a class named PersonGenerator). This object is sent to one of our mock objects
+ which overrides the PersonGenerationListener interface:
+
+ public interface PersonGenerationListener {
+ public void personGenerated(Person person);
+ }
+
+ In order to check that the code under test generates a person with name
+ "Iain" we would do the following:
+
+ Mock personGenListenerMock = mock(PersonGenerationListener.class);
+ personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain")));
+ PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy();
+
+ If an exception is thrown by the getter method for a property, the property + does not exist, is not readable, or a reflection related exception is thrown + when trying to invoke it then this is treated as an evaluation failure and + the matches method will return false. +
+This matcher class will also work with JavaBean objects that have explicit + bean descriptions via an associated BeanInfo description class. See the + JavaBeans specification for more information: + http://java.sun.com/products/javabeans/docs/index.html +
| Constructor and Description | +
|---|
HasPropertyWithValue(java.lang.String propertyName,
+ Matcher<?> valueMatcher) |
+
HasPropertyWithValue(java.lang.String propertyName,
+ Matcher<?> valueMatcher,
+ java.lang.String messageFormat) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+hasProperty(java.lang.String propertyName,
+ Matcher<?> valueMatcher)
+Creates a matcher that matches when the examined object has a JavaBean property
+ with the specified name whose value satisfies the specified matcher.
+ |
+
static <T> Matcher<T> |
+hasPropertyAtPath(java.lang.String path,
+ Matcher<T> valueMatcher)
+Creates a matcher that matches when the examined object is a graph of
+ JavaBean objects that can be navigated along the declared dot-separated path
+ and the final element of that path is a JavaBean property whose value satisfies the
+ specified matcher.
+ |
+
boolean |
+matchesSafely(T bean,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HasPropertyWithValue(java.lang.String propertyName, + Matcher<?> valueMatcher)+
public HasPropertyWithValue(java.lang.String propertyName, + Matcher<?> valueMatcher, + java.lang.String messageFormat)+
public boolean matchesSafely(T bean, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> hasProperty(java.lang.String propertyName, + Matcher<?> valueMatcher)+
assertThat(myBean, hasProperty("foo", equalTo("bar"))propertyName - the name of the JavaBean property that examined beans should possessvalueMatcher - a matcher for the value of the specified property of the examined beanpublic static <T> Matcher<T> hasPropertyAtPath(java.lang.String path, + Matcher<T> valueMatcher)+
assertThat(myBean, hasProperty("foo.bar.baz", equalTo("a property value"))path - the dot-separated path from the examined object to the JavaBean propertyvalueMatcher - a matcher for the value of the specified property of the examined beanpublic class PropertyUtil
+extends java.lang.Object
+| Modifier and Type | +Field and Description | +
|---|---|
static java.lang.Object[] |
+NO_ARGUMENTS |
+
| Constructor and Description | +
|---|
PropertyUtil() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static java.beans.PropertyDescriptor |
+getPropertyDescriptor(java.lang.String propertyName,
+ java.lang.Object fromObj)
+Returns the description of the property with the provided
+ name on the provided object's interface.
+ |
+
static java.beans.PropertyDescriptor[] |
+propertyDescriptorsFor(java.lang.Object fromObj,
+ java.lang.Class<java.lang.Object> stopClass)
+Returns all the property descriptors for the class associated with the given object
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final java.lang.Object[] NO_ARGUMENTS+
public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName, + java.lang.Object fromObj) + throws java.lang.IllegalArgumentException+
java.lang.IllegalArgumentException - if there's a introspection failurepublic static java.beans.PropertyDescriptor[] propertyDescriptorsFor(java.lang.Object fromObj, + java.lang.Class<java.lang.Object> stopClass) + throws java.lang.IllegalArgumentException+
fromObj - Use the class of this objectstopClass - Don't include any properties from this ancestor class upwards.java.lang.IllegalArgumentException - if there's a introspection failurepublic class SamePropertyValuesAs<T> +extends DiagnosingMatcher<T>+
| Constructor and Description | +
|---|
SamePropertyValuesAs(T expectedBean,
+ java.util.List<java.lang.String> ignoredProperties) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matches(java.lang.Object actual,
+ Description mismatch) |
+
static <B> Matcher<B> |
+samePropertyValuesAs(B expectedBean,
+ java.lang.String... ignoredProperties)
+Creates a matcher that matches when the examined object has values for all of
+ its JavaBean properties that are equal to the corresponding values of the
+ specified bean.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic SamePropertyValuesAs(T expectedBean, + java.util.List<java.lang.String> ignoredProperties)+
protected boolean matches(java.lang.Object actual, + Description mismatch)+
matches in class DiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <B> Matcher<B> samePropertyValuesAs(B expectedBean, + java.lang.String... ignoredProperties)+
agerather than method names such as
getAge. + For example: +
assertThat(myBean, samePropertyValuesAs(myExpectedBean))+
assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
expectedBean - the bean against which examined beans are comparedignoredProperties - do not check any of these named properties.See: Description
+| Class | +Description | +
|---|---|
| HasProperty<T> | +
+ A Matcher that checks that an object has a JavaBean property
+ with the specified name.
+ |
+
| HasPropertyWithValue<T> | +
+ Matcher that asserts that a JavaBean property on an argument passed to the
+ mock object meets the provided matcher.
+ |
+
| PropertyUtil | +
+ Utility class for accessing properties on JavaBean objects.
+ |
+
| SamePropertyValuesAs<T> | ++ |
Matchers of Java Bean properties and their values.
public class ArrayAsIterableMatcher<E> +extends TypeSafeMatcher<E[]>+
| Modifier and Type | +Field and Description | +
|---|---|
protected TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>> |
+iterableMatcher |
+
protected java.util.Collection<Matcher<? super E>> |
+matchers |
+
| Constructor and Description | +
|---|
ArrayAsIterableMatcher(TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>> iterableMatcher,
+ java.util.Collection<Matcher<? super E>> matchers,
+ java.lang.String message) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(E[] item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected final TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>> iterableMatcher+
public ArrayAsIterableMatcher(TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>> iterableMatcher, + java.util.Collection<Matcher<? super E>> matchers, + java.lang.String message)+
public boolean matchesSafely(E[] item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<E[]>public void describeMismatchSafely(E[] item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<E[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public class ArrayMatching
+extends java.lang.Object
+| Constructor and Description | +
|---|
ArrayMatching() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<E[]> |
+arrayContaining(E... items)
+Creates a matcher for arrays that matches when each item in the examined array is
+ logically equal to the corresponding item in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified list of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContaining(Matcher<? super E>... itemMatchers)
+Creates a matcher for arrays that matches when each item in the examined array satisfies the
+ corresponding matcher in the specified matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified collection of matchers.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(E... items)
+Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array is logically equal to one item anywhere in the specified items.
+ |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+
+ Creates an order agnostic matcher for arrays that matches when each item in the
+ examined array satisfies one matcher anywhere in the specified matchers.
+ |
+
static <E> java.util.List<Matcher<? super E>> |
+asEqualMatchers(E[] items) |
+
static <T> Matcher<T[]> |
+hasItemInArray(Matcher<? super T> elementMatcher)
+Creates a matcher for arrays that matches when the examined array contains at least one item
+ that is matched by the specified
+elementMatcher. |
+
static <T> Matcher<T[]> |
+hasItemInArray(T element)
+A shortcut to the frequently used
+hasItemInArray(equalTo(x)). |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)+
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")))elementMatcher - the matcher to apply to elements in examined arrayspublic static <T> Matcher<T[]> hasItemInArray(T element)+
hasItemInArray(equalTo(x)).
+ For example:
+ assertThat(hasItemInArray(x))+ instead of: +
assertThat(hasItemInArray(equalTo(x)))
element - the element that should be present in examined arrays@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")))itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined arraypublic static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)+
+ Creates an order agnostic matcher for arrays that matches when each item in the + examined array satisfies one matcher anywhere in the specified collection of matchers. + For a positive match, the examined array must be of the same length as the specified collection + of matchers. +
++ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined array. +
++ For example: +
+assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined array@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"))items - the items that must equal the entries of an examined array, in any order@SafeVarargs +public static <E> Matcher<E[]> arrayContaining(E... items)+
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))items - the items that must equal the items within an examined array@SafeVarargs +public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)+
assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))itemMatchers - the matchers that must be satisfied by the items in the examined arraypublic static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)+
assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined arraypublic static <E> java.util.List<Matcher<? super E>> asEqualMatchers(E[] items)+
public class HasItemInArray<T> +extends TypeSafeMatcher<T[]>+
| Constructor and Description | +
|---|
HasItemInArray(Matcher<? super T> elementMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(T[] actual,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(T[] actual)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(T[] actual)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<T[]>public void describeMismatchSafely(T[] actual, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<T[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public class IsArray<T> +extends TypeSafeMatcher<T[]>+
| Constructor and Description | +
|---|
IsArray(Matcher<? super T>[] elementMatchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> IsArray<T> |
+array(Matcher<? super T>... elementMatchers)
+Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
+ |
+
void |
+describeMismatchSafely(T[] actual,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected java.lang.String |
+descriptionEnd()
+Returns the string that ends the description.
+ |
+
protected java.lang.String |
+descriptionSeparator()
+Returns the string that separates the elements in the description.
+ |
+
protected java.lang.String |
+descriptionStart()
+Returns the string that starts the description.
+ |
+
boolean |
+matchesSafely(T[] array)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(T[] array)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<T[]>public void describeMismatchSafely(T[] actual, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<T[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.protected java.lang.String descriptionStart()+
protected java.lang.String descriptionSeparator()+
protected java.lang.String descriptionEnd()+
public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers)+
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))elementMatchers - the matchers that the elements of examined arrays should satisfyArrayMatching.@Deprecated +public class IsArrayContainingInAnyOrder<E> +extends TypeSafeMatcher<E[]>+
| Constructor and Description | +
|---|
IsArrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)
+Deprecated.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)
+Deprecated.
+
+As of version 2.1, use
+ArrayMatching.arrayContainingInAnyOrder(Collection). |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(E... items)
+Deprecated.
+
+As of version 2.1, use
+ArrayMatching.arrayContainingInAnyOrder(Object[]). |
+
static <E> Matcher<E[]> |
+arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
+Deprecated.
+
+As of version 2.1, use
+ArrayMatching.arrayContainingInAnyOrder(Matcher[]). |
+
void |
+describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+Deprecated.
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Deprecated.
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(E[] item)
+Deprecated.
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(E[] item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<E[]>public void describeMismatchSafely(E[] item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<E[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)+
ArrayMatching.arrayContainingInAnyOrder(Matcher[]).+ 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")))itemMatchers - a list of matchers, each of which must be satisfied by an entry in an examined arraypublic static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> itemMatchers)+
ArrayMatching.arrayContainingInAnyOrder(Collection).+ 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"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined arraypublic static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items)+
ArrayMatching.arrayContainingInAnyOrder(Object[]).+ 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"))items - the items that must equal the entries of an examined array, in any orderArrayMatching.public class IsArrayContainingInOrder<E> +extends TypeSafeMatcher<E[]>+
| Constructor and Description | +
|---|
IsArrayContainingInOrder(java.util.List<Matcher<? super E>> matchers)
+Deprecated.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<E[]> |
+arrayContaining(E... items)
+Deprecated.
+
+As of version 2.1, use
+ArrayMatching.arrayContaining(Object[]). |
+
static <E> Matcher<E[]> |
+arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)
+Deprecated.
+
+As of version 2.1, use
+ArrayMatching.arrayContaining(List). |
+
static <E> Matcher<E[]> |
+arrayContaining(Matcher<? super E>... itemMatchers)
+Deprecated.
+
+As of version 2.1, use
+ArrayMatching.arrayContaining(Matcher[]). |
+
void |
+describeMismatchSafely(E[] item,
+ Description mismatchDescription)
+Deprecated.
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Deprecated.
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(E[] item)
+Deprecated.
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(E[] item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<E[]>public void describeMismatchSafely(E[] item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<E[]>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<E[]> arrayContaining(E... items)+
ArrayMatching.arrayContaining(Object[]).+ For example: +
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))items - the items that must equal the items within an examined arraypublic static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers)+
ArrayMatching.arrayContaining(Matcher[]).+ For example: +
assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))itemMatchers - the matchers that must be satisfied by the items in the examined arraypublic static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> itemMatchers)+
ArrayMatching.arrayContaining(List).+ For example: +
assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item in an examined arraypublic class IsArrayWithSize<E> +extends FeatureMatcher<E[],java.lang.Integer>+
| Constructor and Description | +
|---|
IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<E[]> |
+arrayWithSize(int size)
+Creates a matcher for arrays that matches when the
+length of the array
+ equals the specified size. |
+
static <E> Matcher<E[]> |
+arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for arrays that matches when the
+length of the array
+ satisfies the specified matcher. |
+
static <E> Matcher<E[]> |
+emptyArray()
+Creates a matcher for arrays that matches when the
+length of the array
+ is zero. |
+
protected java.lang.Integer |
+featureValueOf(E[] actual)
+Implement this to extract the interesting feature.
+ |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(E[] actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<E[],java.lang.Integer>actual - the target objectpublic static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
length of the array
+ satisfies the specified matcher.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))sizeMatcher - a matcher for the length of an examined arraypublic static <E> Matcher<E[]> arrayWithSize(int size)+
length of the array
+ equals the specified size.
+ For example:
+ assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))size - the length that an examined array must have for a positive matchpublic static <E> Matcher<E[]> emptyArray()+
length of the array
+ is zero.
+ For example:
+ assertThat(new String[0], emptyArray())
public class IsCollectionWithSize<E> +extends FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>+
| Constructor and Description | +
|---|
IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+featureValueOf(java.util.Collection<? extends E> actual)
+Implement this to extract the interesting feature.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(int size)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value equal to the specified size. |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Collections that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>actual - the target objectpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the size of an examined Collectionpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)+
Collections that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(Arrays.asList("foo", "bar"), hasSize(2))size - the expected size of an examined Collectionpublic class IsEmptyCollection<E> +extends TypeSafeMatcher<java.util.Collection<? extends E>>+
| Constructor and Description | +
|---|
IsEmptyCollection() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.util.Collection<? extends E> item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <E> Matcher<java.util.Collection<? extends E>> |
+empty()
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
static <E> Matcher<java.util.Collection<E>> |
+emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Collections matching examined collections whose isEmpty
+ method returns true. |
+
boolean |
+matchesSafely(java.util.Collection<? extends E> item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.util.Collection<? extends E> item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>public void describeMismatchSafely(java.util.Collection<? extends E> item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.util.Collection<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<java.util.Collection<? extends E>> empty()+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(empty()))
public static <E> Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> unusedToForceReturnType)+
Collections matching examined collections whose isEmpty
+ method returns true.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
unusedToForceReturnType - the type of the collection's contentpublic class IsEmptyIterable<E> +extends TypeSafeMatcher<java.lang.Iterable<? extends E>>+
| Constructor and Description | +
|---|
IsEmptyIterable() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.Iterable<? extends E> iter,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+emptyIterable()
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)
+Creates a matcher for
+Iterables matching examined iterables that yield no items. |
+
boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.Iterable<? extends E> iterable)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>public void describeMismatchSafely(java.lang.Iterable<? extends E> iter, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Iterable<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <E> Matcher<java.lang.Iterable<? extends E>> emptyIterable()+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterable()))
public static <E> Matcher<java.lang.Iterable<E>> emptyIterableOf(java.lang.Class<E> unusedToForceReturnType)+
Iterables matching examined iterables that yield no items.
+ For example:
+ assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
unusedToForceReturnType - the type of the iterable's contentpublic class IsIn<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
IsIn(java.util.Collection<T> collection) |
+
IsIn(T[] elements) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description buffer)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+in(java.util.Collection<T> collection)
+Creates a matcher that matches when the examined object is found within the
+ specified collection.
+ |
+
static <T> Matcher<T> |
+in(T[] elements)
+Creates a matcher that matches when the examined object is found within the
+ specified array.
+ |
+
static <T> Matcher<T> |
+isIn(java.util.Collection<T> collection)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isIn(T[] elements)
+Deprecated.
+
+use is(in(...)) instead
+ |
+
static <T> Matcher<T> |
+isOneOf(T... elements)
+Deprecated.
+
+use is(oneOf(...)) instead
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
static <T> Matcher<T> |
+oneOf(T... elements)
+Creates a matcher that matches when the examined object is equal to one of the
+ specified elements.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsIn(java.util.Collection<T> collection)+
public IsIn(T[] elements)+
public boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description buffer)+
SelfDescribingbuffer - The description to be built or appended to.@Deprecated +public static <T> Matcher<T> isIn(java.util.Collection<T> collection)+
assertThat("foo", isIn(Arrays.asList("bar", "foo")))collection - the collection in which matching items must be foundpublic static <T> Matcher<T> in(java.util.Collection<T> collection)+
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))collection - the collection in which matching items must be found@Deprecated +public static <T> Matcher<T> isIn(T[] elements)+
assertThat("foo", isIn(new String[]{"bar", "foo"}))elements - the array in which matching items must be foundpublic static <T> Matcher<T> in(T[] elements)+
assertThat("foo", is(in(new String[]{"bar", "foo"})))elements - the array in which matching items must be found@SafeVarargs + @Deprecated +public static <T> Matcher<T> isOneOf(T... elements)+
assertThat("foo", isOneOf("bar", "foo"))elements - the elements amongst which matching items will be found@SafeVarargs +public static <T> Matcher<T> oneOf(T... elements)+
assertThat("foo", is(oneOf("bar", "foo")))elements - the elements amongst which matching items will be foundpublic class IsIterableContainingInAnyOrder<T> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>+
| Constructor and Description | +
|---|
IsIterableContainingInAnyOrder(java.util.Collection<Matcher<? super T>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(Matcher<? super T>... itemMatchers)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. |
+
static <T> Matcher<java.lang.Iterable<? extends T>> |
+containsInAnyOrder(T... items)
+
+ Creates an order agnostic matcher for
+Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? extends T> items,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? extends T> items, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.@SafeVarargs +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified matchers. For a positive match, the examined iterable must be of the same
+ length as the number of specified matchers.
+
+ N.B. each of the specified matchers will only be used once during a given examination, so be + careful when specifying matchers that may be satisfied by more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each logically equal to one item
+ anywhere in the specified items. For a positive match, the examined iterable
+ must be of the same length as the number of specified items.
+
+ N.B. each of the specified items will only be used once during a given examination, so be + careful when specifying items that may be equal to more than one entry in an examined + iterable. +
++ For example: +
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))items - the items that must equal the items provided by an examined Iterable in any orderpublic static <T> Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> itemMatchers)+
+ Creates an order agnostic matcher for Iterables that matches when a single pass over
+ the examined Iterable yields a series of items, each satisfying one matcher anywhere
+ in the specified collection of matchers. For a positive match, the examined iterable
+ must be of the same length as the specified collection of matchers.
+
+ N.B. each matcher in the specified collection will only be used once during a given + examination, so be careful when specifying matchers that may be satisfied by more than + one entry in an examined iterable. +
+For example:
+assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))itemMatchers - a list of matchers, each of which must be satisfied by an item provided by an examined Iterablepublic class IsIterableContainingInOrder<E> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>+
| Constructor and Description | +
|---|
IsIterableContainingInOrder(java.util.List<Matcher<? super E>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each logically equal to the
+ corresponding item in the specified items. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified list of matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, each satisfying the corresponding
+ matcher in the specified matchers. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+contains(Matcher<? super E> itemMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a single item that satisfies the specified matcher. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(E... items)+
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"))items - the items that must equal the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E> itemMatcher)+
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")))itemMatcher - the matcher that must be satisfied by the single item provided by an
+ examined Iterable@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<? extends E>> contains(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by
+ an examined Iterablepublic class IsIterableContainingInRelativeOrder<E> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>+
| Constructor and Description | +
|---|
IsIterableContainingInRelativeOrder(java.util.List<Matcher<? super E>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(E... items)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items logically equal to the
+ corresponding item in the specified items, in the same relative order
+ For example: |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that contains items satisfying the corresponding
+ matcher in the specified list of matchers, in the same relative order. |
+
static <E> Matcher<java.lang.Iterable<? extends E>> |
+containsInRelativeOrder(Matcher<? super E>... itemMatchers)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields a series of items, that each satisfying the corresponding
+ matcher in the specified matchers, in the same relative order. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? extends E> iterable,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? extends E> iterable, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items)+
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"))items - the items that must be contained within items provided by an examined Iterable in the same relative order@SafeVarargs +public static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)+
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")))itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable in the same relative orderpublic static <E> Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(java.util.List<Matcher<? super E>> itemMatchers)+
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"))))itemMatchers - a list of matchers, each of which must be satisfied by the items provided by
+ an examined Iterable in the same relative orderpublic class IsIterableWithSize<E> +extends FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>+
| Constructor and Description | +
|---|
IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+featureValueOf(java.lang.Iterable<E> actual)
+Implement this to extract the interesting feature.
+ |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(int size)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that is equal to the specified
+ size argument. |
+
static <E> Matcher<java.lang.Iterable<E>> |
+iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Iterables that matches when a single pass over the
+ examined Iterable yields an item count that satisfies the specified
+ matcher. |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>actual - the target objectpublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
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)))sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)+
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))size - the number of items that should be yielded by an examined Iterablepublic class IsMapContaining<K,V> +extends TypeSafeMatcher<java.util.Map<? extends K,? extends V>>+
| Constructor and Description | +
|---|
IsMapContaining(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(K key,
+ V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key equals the specified key and whose value equals the
+ specified value. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+hasEntry(Matcher<? super K> keyMatcher,
+ Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one entry whose key satisfies the specified keyMatcher and whose
+ value satisfies the specified valueMatcher. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(K key)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that is equal to the specified key. |
+
static <K> Matcher<java.util.Map<? extends K,?>> |
+hasKey(Matcher<? super K> keyMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(Matcher<? super V> valueMatcher)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher. |
+
static <V> Matcher<java.util.Map<?,? extends V>> |
+hasValue(V value)
+Creates a matcher for
+Maps matching when the examined Map contains
+ at least one value that is equal to the specified value. |
+
boolean |
+matchesSafely(java.util.Map<? extends K,? extends V> map)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.util.Map<? extends K,? extends V> map)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>public void describeMismatchSafely(java.util.Map<? extends K,? extends V> map, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher, + Matcher<? super V> valueMatcher)+
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")))keyMatcher - the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entryvalueMatcher - the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entrypublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key, + V value)+
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"))key - the key that, in combination with the value, must be describe at least one entryvalue - the value that, in combination with the key, must be describe at least one entrypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)+
Maps matching when the examined Map contains
+ at least one key that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, hasKey(equalTo("bar")))keyMatcher - the matcher that must be satisfied by at least one keypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)+
Maps matching when the examined Map contains
+ at least one key that is equal to the specified key.
+ For example:
+ assertThat(myMap, hasKey("bar"))key - the key that satisfying maps must containpublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)+
Maps matching when the examined Map contains
+ at least one value that satisfies the specified valueMatcher.
+ For example:
+ assertThat(myMap, hasValue(equalTo("foo")))valueMatcher - the matcher that must be satisfied by at least one valuepublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)+
Maps matching when the examined Map contains
+ at least one value that is equal to the specified value.
+ For example:
+ assertThat(myMap, hasValue("foo"))value - the value that satisfying maps must containpublic final class IsMapWithSize<K,V> +extends FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>+
| Constructor and Description | +
|---|
IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(int size)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value equal to the specified size. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
+Creates a matcher for
+Maps that matches when the size() method returns
+ a value that satisfies the specified matcher. |
+
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
+anEmptyMap()
+Creates a matcher for
+Maps that matches when the size() method returns
+ zero. |
+
protected java.lang.Integer |
+featureValueOf(java.util.Map<? extends K,? extends V> actual)
+Implement this to extract the interesting feature.
+ |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
protected java.lang.Integer featureValueOf(java.util.Map<? extends K,? extends V> actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>actual - the target objectpublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)+
Maps that matches when the size() method returns
+ a value that satisfies the specified matcher.
+ For example:
+ assertThat(myMap, is(aMapWithSize(equalTo(2))))
sizeMatcher - a matcher for the size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)+
Maps that matches when the size() method returns
+ a value equal to the specified size.
+ For example:
+ assertThat(myMap, is(aMapWithSize(2)))
size - the expected size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()+
Maps that matches when the size() method returns
+ zero.
+ For example:
+ assertThat(myMap, is(anEmptyMap()))
| Class | +Description | +
|---|---|
| ArrayAsIterableMatcher<E> | ++ |
| ArrayMatching | ++ |
| HasItemInArray<T> | +
+ Matches if an array contains an item satisfying a nested matcher.
+ |
+
| IsArray<T> | +
+ Matcher for array whose elements satisfy a sequence of matchers.
+ |
+
| IsArrayContainingInAnyOrder<E> | +Deprecated
+ As of release 2.1, replaced by
+ArrayMatching. |
+
| IsArrayContainingInOrder<E> | +Deprecated
+ As of release 2.1, replaced by
+ArrayMatching. |
+
| IsArrayWithSize<E> | +
+ Matches if array size satisfies a nested matcher.
+ |
+
| IsCollectionWithSize<E> | +
+ Matches if collection size satisfies a nested matcher.
+ |
+
| IsEmptyCollection<E> | +
+ Tests if collection is empty.
+ |
+
| IsEmptyIterable<E> | +
+ Tests if collection is empty.
+ |
+
| IsIn<T> | ++ |
| IsIterableContainingInAnyOrder<T> | ++ |
| IsIterableContainingInOrder<E> | ++ |
| IsIterableContainingInRelativeOrder<E> | ++ |
| IsIterableWithSize<E> | ++ |
| IsMapContaining<K,V> | ++ |
| IsMapWithSize<K,V> | +
+ Matches if map size satisfies a nested matcher.
+ |
+
Matchers of arrays and collections.
public final class ComparatorMatcherBuilder<T>
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static <T> ComparatorMatcherBuilder<T> |
+comparedBy(java.util.Comparator<T> comparator)
+Creates a matcher factory for matchers of
+Comparatorss of T. |
+
Matcher<T> |
+comparesEqualTo(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ equal to the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+greaterThan(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ greater than the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+greaterThanOrEqualTo(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+lessThan(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ less than the specified value, as reported by the Comparator used to
+ create this builder. |
+
Matcher<T> |
+lessThanOrEqualTo(T value)
+Creates a matcher of
+T object that matches when the examined object is
+ less than or equal to the specified value, as reported by the Comparator used to
+ create this builder. |
+
static <T extends java.lang.Comparable<T>> |
+usingNaturalOrdering()
+Creates a matcher factory for matchers of
+Comparables. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T extends java.lang.Comparable<T>> ComparatorMatcherBuilder<T> usingNaturalOrdering()+
Comparables.
+ For example:
+ assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
public static <T> ComparatorMatcherBuilder<T> comparedBy(java.util.Comparator<T> comparator)+
Comparatorss of T.
+ For example:
+ assertThat(5, comparedBy(new Comparator<Integer>() {
+ public int compare(Integer o1, Integer o2) {
+ return -o1.compareTo(o2);
+ }
+ }).lessThan(4))public Matcher<T> comparesEqualTo(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return zeropublic Matcher<T> greaterThan(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return greater
+ than zeropublic Matcher<T> greaterThanOrEqualTo(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return greater
+ than or equal to zeropublic Matcher<T> lessThan(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return less
+ than zeropublic Matcher<T> lessThanOrEqualTo(T value)+
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))
value - the value which, when passed to the Comparator supplied to this builder, should return less
+ than or equal to zero| Class | +Description | +
|---|---|
| ComparatorMatcherBuilder<T> | ++ |
public class AllOf<T> +extends DiagnosingMatcher<T>+
false.| Constructor and Description | +
|---|
AllOf(java.lang.Iterable<Matcher<? super T>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+allOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
static <T> Matcher<T> |
+allOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ALL of the specified matchers.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o,
+ Description mismatch) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o, + Description mismatch)+
matches in class DiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))public class AnyOf<T> +extends BaseMatcher<T>+
true.| Constructor and Description | +
|---|
AnyOf(java.lang.Iterable<Matcher<? super T>> matchers) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> AnyOf<T> |
+anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
static <T> AnyOf<T> |
+anyOf(Matcher<? super T>... matchers)
+Creates a matcher that matches if the examined object matches ANY of the specified matchers.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
void |
+describeTo(Description description,
+ java.lang.String operator) |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
protected boolean |
+matches(java.lang.Object o,
+ boolean shortcut) |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o)+
Matchermatches in interface Matcher<T>o - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescribeTo in interface SelfDescribingdescription - The description to be built or appended to.public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))@SafeVarargs +public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)+
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))protected boolean matches(java.lang.Object o, + boolean shortcut)+
public void describeTo(Description description, + java.lang.String operator)+
public static final class CombinableMatcher.CombinableBothMatcher<X>
+extends java.lang.Object
+| Constructor and Description | +
|---|
CombinableBothMatcher(Matcher<? super X> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
CombinableMatcher<X> |
+and(Matcher<? super X> other) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final class CombinableMatcher.CombinableEitherMatcher<X>
+extends java.lang.Object
+| Constructor and Description | +
|---|
CombinableEitherMatcher(Matcher<? super X> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
CombinableMatcher<X> |
+or(Matcher<? super X> other) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class CombinableMatcher<T> +extends TypeSafeDiagnosingMatcher<T>+
| Modifier and Type | +Class and Description | +
|---|---|
static class |
+CombinableMatcher.CombinableBothMatcher<X> |
+
static class |
+CombinableMatcher.CombinableEitherMatcher<X> |
+
| Constructor and Description | +
|---|
CombinableMatcher(Matcher<? super T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
CombinableMatcher<T> |
+and(Matcher<? super T> other) |
+
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
+both(Matcher<? super LHS> matcher)
+Creates a matcher that matches when both of the specified matchers match the examined object.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
+either(Matcher<? super LHS> matcher)
+Creates a matcher that matches when either of the specified matchers match the examined object.
+ |
+
protected boolean |
+matchesSafely(T item,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
CombinableMatcher<T> |
+or(Matcher<? super T> other) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(T item, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public CombinableMatcher<T> and(Matcher<? super T> other)+
public CombinableMatcher<T> or(Matcher<? super T> other)+
public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)+
assertThat("fab", both(containsString("a")).and(containsString("b")))public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)+
assertThat("fan", either(containsString("a")).or(containsString("b")))public class DescribedAs<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
DescribedAs(java.lang.String descriptionTemplate,
+ Matcher<T> matcher,
+ java.lang.Object[] values) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+describedAs(java.lang.String description,
+ Matcher<T> matcher,
+ java.lang.Object... values)
+Wraps an existing matcher, overriding its description with that specified.
+ |
+
void |
+describeMismatch(java.lang.Object item,
+ Description description)
+Generate a description of why the matcher has not accepted the item.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public void describeMismatch(java.lang.Object item, + Description description)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.description - The description to be built or appended to.public static <T> Matcher<T> describedAs(java.lang.String description, + Matcher<T> matcher, + java.lang.Object... values)+
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())description - the new description for the wrapped matchermatcher - the matcher to wrapvalues - optional values to insert into the tokenised descriptionpublic class Every<T> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>+
| Constructor and Description | +
|---|
Every(Matcher<? super T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <U> Matcher<java.lang.Iterable<? extends U>> |
+everyItem(Matcher<U> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields items that are all matched by the specified
+ itemMatcher. |
+
boolean |
+matchesSafely(java.lang.Iterable<? extends T> collection,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.Iterable<? extends T> collection, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends T>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <U> Matcher<java.lang.Iterable<? extends U>> everyItem(Matcher<U> itemMatcher)+
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")))itemMatcher - the matcher to apply to every item provided by the examined Iterablepublic class Is<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
Is(Matcher<T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatch(java.lang.Object item,
+ Description mismatchDescription)
+Generate a description of why the matcher has not accepted the item.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+is(Matcher<T> matcher)
+Decorates another Matcher, retaining its behaviour, but allowing tests
+ to be slightly more expressive.
+ |
+
static <T> Matcher<T> |
+is(T value)
+A shortcut to the frequently used
+is(equalTo(x)). |
+
static <T> Matcher<T> |
+isA(java.lang.Class<?> type)
+A shortcut to the frequently used
+is(instanceOf(SomeClass.class)). |
+
boolean |
+matches(java.lang.Object arg)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object arg)+
Matcherarg - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public void describeMismatch(java.lang.Object item, + Description mismatchDescription)+
Matchermatches(item) is false, but
+ will not check this.describeMismatch in interface Matcher<T>describeMismatch in class BaseMatcher<T>item - The item that the Matcher has rejected.mismatchDescription - The description to be built or appended to.public static <T> Matcher<T> is(Matcher<T> matcher)+
assertThat(cheese, is(equalTo(smelly)))+ instead of: +
assertThat(cheese, equalTo(smelly))
public static <T> Matcher<T> is(T value)+
is(equalTo(x)).
+ For example:
+ assertThat(cheese, is(smelly))+ instead of: +
assertThat(cheese, is(equalTo(smelly)))
public static <T> Matcher<T> isA(java.lang.Class<?> type)+
is(instanceOf(SomeClass.class)).
+ For example:
+ assertThat(cheese, isA(Cheddar.class))+ instead of: +
assertThat(cheese, is(instanceOf(Cheddar.class)))
public class IsAnything<T> +extends BaseMatcher<T>+
true.| Constructor and Description | +
|---|
IsAnything() |
+
IsAnything(java.lang.String message) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.Object> |
+anything()
+Creates a matcher that always matches, regardless of the examined object.
+ |
+
static Matcher<java.lang.Object> |
+anything(java.lang.String description)
+Creates a matcher that always matches, regardless of the examined object, but describes
+ itself with the specified
+String. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsAnything()+
public IsAnything(java.lang.String message)+
public boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Object> anything()+
public static Matcher<java.lang.Object> anything(java.lang.String description)+
String.description - a meaningful String used when describing itselfIsIterableContaining.@Deprecated +public class IsCollectionContaining<T> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>+
| Constructor and Description | +
|---|
IsCollectionContaining(Matcher<? super T> elementMatcher)
+Deprecated.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Deprecated.
+Generates a description of the object.
+ |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(Matcher<? super T> itemMatcher)
+Deprecated.
+
+As of version 2.1, use
+IsIterableContaining.hasItem(Matcher). |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(T item)
+Deprecated.
+
+As of version 2.1, use
+IsIterableContaining.hasItem(Object). |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(Matcher<? super T>... itemMatchers)
+Deprecated.
+
+As of version 2.1, use
+IsIterableContaining.hasItems(Matcher[])}. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(T... items)
+Deprecated.
+
+As of version 2.1, use
+IsIterableContaining.hasItems(Object[])}. |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? super T> collection,
+ Description mismatchDescription)
+Deprecated.
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
IsIterableContaining.hasItem(Matcher).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")))itemMatcher - the matcher to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
IsIterableContaining.hasItem(Object).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"))item - the item to compare against the items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
IsIterableContaining.hasItems(Matcher[])}.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")))itemMatchers - the matchers to apply to items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
IsIterableContaining.hasItems(Object[])}.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"))items - the items to compare against the items provided by the examined Iterablepublic class IsEqual<T> +extends BaseMatcher<T>+
Object.equals(java.lang.Object) invokedMethod?| Constructor and Description | +
|---|
IsEqual(T equalArg) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+equalTo(T operand)
+Creates a matcher that matches when the examined object is logically equal to the specified
+
+operand, as determined by calling the Object.equals(java.lang.Object) method on
+ the examined object. |
+
static Matcher<java.lang.Object> |
+equalToObject(java.lang.Object operand)
+Creates an
+IsEqual matcher that does not enforce the values being
+ compared to be of the same static type. |
+
boolean |
+matches(java.lang.Object actualValue)
+Evaluates the matcher for argument item.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object actualValue)+
MatcheractualValue - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> equalTo(T operand)+
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.
+ assertThat("foo", equalTo("foo"));
+ assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
+ public class IsInstanceOf +extends DiagnosingMatcher<java.lang.Object>+
| Constructor and Description | +
|---|
IsInstanceOf(java.lang.Class<?> expectedClass)
+Creates a new instance of IsInstanceOf
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <T> Matcher<T> |
+any(java.lang.Class<T> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<T> |
+instanceOf(java.lang.Class<?> type)
+Creates a matcher that matches when the examined object is an instance of the specified
+type,
+ as determined by calling the Class.isInstance(Object) method on that type, passing the
+ the examined object. |
+
protected boolean |
+matches(java.lang.Object item,
+ Description mismatch) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsInstanceOf(java.lang.Class<?> expectedClass)+
expectedClass - The predicate evaluates to true for instances of this class
+ or one of its subclasses.protected boolean matches(java.lang.Object item, + Description mismatch)+
matches in class DiagnosingMatcher<java.lang.Object>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)+
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));
public static <T> Matcher<T> any(java.lang.Class<T> type)+
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))
assertThat(new Canoe(), instanceOf(Canoe.class));
public class IsIterableContaining<T> +extends TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>+
| Constructor and Description | +
|---|
IsIterableContaining(Matcher<? super T> elementMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(Matcher<? super T> itemMatcher)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is matched by the specified
+ itemMatcher. |
+
static <T> Matcher<java.lang.Iterable<? super T>> |
+hasItem(T item)
+Creates a matcher for
+Iterables that only matches when a single pass over the
+ examined Iterable yields at least one item that is equal to the specified
+ item. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(Matcher<? super T>... itemMatchers)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is matched by the corresponding
+ matcher from the specified itemMatchers. |
+
static <T> Matcher<java.lang.Iterable<T>> |
+hasItems(T... items)
+Creates a matcher for
+Iterables that matches when consecutive passes over the
+ examined Iterable yield at least one item that is equal to the corresponding
+ item from the specified items. |
+
protected boolean |
+matchesSafely(java.lang.Iterable<? super T> collection,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected boolean matchesSafely(java.lang.Iterable<? super T> collection, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? super T>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> itemMatcher)+
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")))itemMatcher - the matcher to apply to items provided by the examined Iterablepublic static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item)+
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"))item - the item to compare against the items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... itemMatchers)+
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")))itemMatchers - the matchers to apply to items provided by the examined Iterable@SafeVarargs +public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... items)+
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"))items - the items to compare against the items provided by the examined Iterablepublic class IsNot<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
IsNot(Matcher<T> matcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object arg)
+Evaluates the matcher for argument item.
+ |
+
static <T> Matcher<T> |
+not(Matcher<T> matcher)
+Creates a matcher that wraps an existing matcher, but inverts the logic by which
+ it will match.
+ |
+
static <T> Matcher<T> |
+not(T value)
+A shortcut to the frequently used
+not(equalTo(x)). |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object arg)+
Matcherarg - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> not(Matcher<T> matcher)+
assertThat(cheese, is(not(equalTo(smelly))))
matcher - the matcher whose sense should be invertedpublic static <T> Matcher<T> not(T value)+
not(equalTo(x)).
+ For example:
+ assertThat(cheese, is(not(smelly)))+ instead of: +
assertThat(cheese, is(not(equalTo(smelly))))
value - the value that any examined object should not equalpublic class IsNull<T> +extends BaseMatcher<T>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object o)
+Evaluates the matcher for argument item.
+ |
+
static Matcher<java.lang.Object> |
+notNullValue()
+A shortcut to the frequently used
+not(nullValue()). |
+
static <T> Matcher<T> |
+notNullValue(java.lang.Class<T> type)
+A shortcut to the frequently used
+not(nullValue(X.class)). |
+
static Matcher<java.lang.Object> |
+nullValue()
+Creates a matcher that matches if examined object is
+null. |
+
static <T> Matcher<T> |
+nullValue(java.lang.Class<T> type)
+Creates a matcher that matches if examined object is
+null. |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object o)+
Matchero - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Object> nullValue()+
null.
+ For example:
+ assertThat(cheese, is(nullValue())
public static Matcher<java.lang.Object> notNullValue()+
not(nullValue()).
+ For example:
+ assertThat(cheese, is(notNullValue()))+ instead of: +
assertThat(cheese, is(not(nullValue())))
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)+
null. Accepts a
+ single dummy argument to facilitate type inference.
+ For example:
+ assertThat(cheese, is(nullValue(Cheese.class))
type - dummy parameter used to infer the generic type of the returned matcherpublic static <T> Matcher<T> notNullValue(java.lang.Class<T> type)+
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 - dummy parameter used to infer the generic type of the returned matcherpublic class IsSame<T> +extends BaseMatcher<T>+
| Constructor and Description | +
|---|
IsSame(T object) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matches(java.lang.Object arg)
+Evaluates the matcher for argument item.
+ |
+
static <T> Matcher<T> |
+sameInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
static <T> Matcher<T> |
+theInstance(T target)
+Creates a matcher that matches only when the examined object is the same instance as
+ the specified target object.
+ |
+
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matches(java.lang.Object arg)+
Matcherarg - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherpublic void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<T> sameInstance(T target)+
target - the target instance against which others should be assessedpublic static <T> Matcher<T> theInstance(T target)+
target - the target instance against which others should be assessedpublic class StringContains +extends SubstringMatcher+
substring| Constructor and Description | +
|---|
StringContains(boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.String> |
+containsString(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere. |
+
static Matcher<java.lang.String> |
+containsStringIgnoringCase(java.lang.String substring)
+Creates a matcher that matches if the examined
+String contains the specified
+ String anywhere, ignoring case. |
+
protected boolean |
+evalSubstringOf(java.lang.String s) |
+
converted, describeMismatchSafely, describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringContains(boolean ignoringCase, + java.lang.String substring)+
protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcherpublic static Matcher<java.lang.String> containsString(java.lang.String substring)+
String contains the specified
+ String anywhere.
+ For example:
+ assertThat("myStringOfNote", containsString("ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic static Matcher<java.lang.String> containsStringIgnoringCase(java.lang.String substring)+
String contains the specified
+ String anywhere, ignoring case.
+ For example:
+ assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))substring - the substring that the returned matcher will expect to find within any examined stringpublic class StringEndsWith +extends SubstringMatcher+
substring| Constructor and Description | +
|---|
StringEndsWith(boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.String> |
+endsWith(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String. |
+
static Matcher<java.lang.String> |
+endsWithIgnoringCase(java.lang.String suffix)
+Creates a matcher that matches if the examined
+String ends with the specified
+ String, ignoring case. |
+
protected boolean |
+evalSubstringOf(java.lang.String s) |
+
converted, describeMismatchSafely, describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringEndsWith(boolean ignoringCase, + java.lang.String substring)+
protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcherpublic static Matcher<java.lang.String> endsWith(java.lang.String suffix)+
String ends with the specified
+ String.
+ For example:
+ assertThat("myStringOfNote", endsWith("Note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic static Matcher<java.lang.String> endsWithIgnoringCase(java.lang.String suffix)+
String ends with the specified
+ String, ignoring case.
+ For example:
+ assertThat("myStringOfNote", endsWithIgnoringCase("note"))suffix - the substring that the returned matcher will expect at the end of any examined stringpublic class StringRegularExpression +extends TypeSafeDiagnosingMatcher<java.lang.String>+
| Modifier | +Constructor and Description | +
|---|---|
protected |
+StringRegularExpression(java.util.regex.Pattern pattern) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+matchesRegex(java.util.regex.Pattern pattern)
+Creates a matcher that checks if the examined string matches a specified
+Pattern. |
+
static Matcher<java.lang.String> |
+matchesRegex(java.lang.String regex)
+Creates a matcher that checks if the examined string matches a specified regex.
+ |
+
protected boolean |
+matchesSafely(java.lang.String actual,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected StringRegularExpression(java.util.regex.Pattern pattern)+
public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.protected boolean matchesSafely(java.lang.String actual, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.lang.String>public static Matcher<java.lang.String> matchesRegex(java.util.regex.Pattern pattern)+
Pattern.
+
+
+ assertThat("abc", matchesRegex(Pattern.compile("ˆ[a-z]$"));
+ pattern - the pattern to be used.public static Matcher<java.lang.String> matchesRegex(java.lang.String regex)+
+ assertThat("abc", matchesRegex("ˆ[a-z]+$"));
+ regex - The regex to be used for the validation.public class StringStartsWith +extends SubstringMatcher+
substring| Constructor and Description | +
|---|
StringStartsWith(boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected boolean |
+evalSubstringOf(java.lang.String s) |
+
static Matcher<java.lang.String> |
+startsWith(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String. |
+
static Matcher<java.lang.String> |
+startsWithIgnoringCase(java.lang.String prefix)
+
+ Creates a matcher that matches if the examined
+String starts with the specified
+ String, ignoring case |
+
converted, describeMismatchSafely, describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringStartsWith(boolean ignoringCase, + java.lang.String substring)+
protected boolean evalSubstringOf(java.lang.String s)+
evalSubstringOf in class SubstringMatcherpublic static Matcher<java.lang.String> startsWith(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String.
+
assertThat("myStringOfNote", startsWith("my"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic static Matcher<java.lang.String> startsWithIgnoringCase(java.lang.String prefix)+
+ Creates a matcher that matches if the examined String starts with the specified
+ String, ignoring case
+
assertThat("myStringOfNote", startsWithIgnoringCase("My"))prefix - the substring that the returned matcher will expect at the start of any examined stringpublic abstract class SubstringMatcher +extends TypeSafeMatcher<java.lang.String>+
| Modifier and Type | +Field and Description | +
|---|---|
protected java.lang.String |
+substring |
+
| Modifier | +Constructor and Description | +
|---|---|
protected |
+SubstringMatcher(java.lang.String relationship,
+ boolean ignoringCase,
+ java.lang.String substring) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.String |
+converted(java.lang.String arg) |
+
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected abstract boolean |
+evalSubstringOf(java.lang.String string) |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected SubstringMatcher(java.lang.String relationship, + boolean ignoringCase, + java.lang.String substring)+
public boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.protected java.lang.String converted(java.lang.String arg)+
protected abstract boolean evalSubstringOf(java.lang.String string)+
See: Description
+| Class | +Description | +
|---|---|
| AllOf<T> | +
+ Calculates the logical conjunction of multiple matchers.
+ |
+
| AnyOf<T> | +
+ Calculates the logical disjunction of multiple matchers.
+ |
+
| CombinableMatcher<T> | ++ |
| CombinableMatcher.CombinableBothMatcher<X> | ++ |
| CombinableMatcher.CombinableEitherMatcher<X> | ++ |
| DescribedAs<T> | +
+ Provides a custom description to another matcher.
+ |
+
| Every<T> | ++ |
| Is<T> | +
+ Decorates another Matcher, retaining the behaviour but allowing tests
+ to be slightly more expressive.
+ |
+
| IsAnything<T> | +
+ A matcher that always returns
+true. |
+
| IsCollectionContaining<T> | +Deprecated
+ As of release 2.1, replaced by
+IsIterableContaining. |
+
| IsEqual<T> | +
+ Is the value equal to another value, as tested by the
+
+Object.equals(java.lang.Object) invokedMethod? |
+
| IsInstanceOf | +
+ Tests whether the value is an instance of a class.
+ |
+
| IsIterableContaining<T> | ++ |
| IsNot<T> | +
+ Calculates the logical negation of a matcher.
+ |
+
| IsNull<T> | +
+ Is the value null?
+ |
+
| IsSame<T> | +
+ Is the value the same object as another value?
+ |
+
| StringContains | +
+ Tests if the argument is a string that contains a specific substring.
+ |
+
| StringEndsWith | +
+ Tests if the argument is a string that ends with a specific substring.
+ |
+
| StringRegularExpression | ++ |
| StringStartsWith | +
+ Tests if the argument is a string that starts with a specific substring.
+ |
+
| SubstringMatcher | ++ |
Fundamental matchers of objects and values, and composite matchers.
public class ArrayIterator
+extends java.lang.Object
+implements java.util.Iterator<java.lang.Object>
+| Constructor and Description | +
|---|
ArrayIterator(java.lang.Object array) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+hasNext() |
+
java.lang.Object |
+next() |
+
void |
+remove() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic ArrayIterator(java.lang.Object array)+
public boolean hasNext()+
hasNext in interface java.util.Iterator<java.lang.Object>public java.lang.Object next()+
next in interface java.util.Iterator<java.lang.Object>public void remove()+
remove in interface java.util.Iterator<java.lang.Object>public class NullSafety
+extends java.lang.Object
+| Constructor and Description | +
|---|
NullSafety() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static <E> java.util.List<Matcher<? super E>> |
+nullSafe(Matcher<? super E>[] itemMatchers) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class ReflectiveTypeFinder
+extends java.lang.Object
+| Constructor and Description | +
|---|
ReflectiveTypeFinder(java.lang.String methodName,
+ int expectedNumberOfParameters,
+ int typedParameter) |
+
| Modifier and Type | +Method and Description | +
|---|---|
java.lang.Class<?> |
+findExpectedType(java.lang.Class<?> fromClass) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class SelfDescribingValue<T> +extends java.lang.Object +implements SelfDescribing+
| Constructor and Description | +
|---|
SelfDescribingValue(T value) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic SelfDescribingValue(T value)+
public void describeTo(Description description)+
SelfDescribingdescribeTo in interface SelfDescribingdescription - The description to be built or appended to.public class SelfDescribingValueIterator<T> +extends java.lang.Object +implements java.util.Iterator<SelfDescribing>+
| Constructor and Description | +
|---|
SelfDescribingValueIterator(java.util.Iterator<T> values) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+hasNext() |
+
SelfDescribing |
+next() |
+
void |
+remove() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic SelfDescribingValueIterator(java.util.Iterator<T> values)+
public boolean hasNext()+
hasNext in interface java.util.Iterator<SelfDescribing>public SelfDescribing next()+
next in interface java.util.Iterator<SelfDescribing>public void remove()+
remove in interface java.util.Iterator<SelfDescribing>| Class | +Description | +
|---|---|
| ArrayIterator | ++ |
| NullSafety | ++ |
| ReflectiveTypeFinder | ++ |
| SelfDescribingValue<T> | ++ |
| SelfDescribingValueIterator<T> | ++ |
public static interface FileMatchers.FileStatus
+| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+check(java.io.File actual) |
+
public final class FileMatchers
+extends java.lang.Object
+| Modifier and Type | +Class and Description | +
|---|---|
static interface |
+FileMatchers.FileStatus |
+
| Modifier and Type | +Field and Description | +
|---|---|
static FileMatchers.FileStatus |
+CAN_READ |
+
static FileMatchers.FileStatus |
+CAN_WRITE |
+
static FileMatchers.FileStatus |
+EXISTS |
+
static FileMatchers.FileStatus |
+IS_DIRECTORY |
+
static FileMatchers.FileStatus |
+IS_FILE |
+
| Constructor and Description | +
|---|
FileMatchers() |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.io.File> |
+aFileNamed(Matcher<java.lang.String> expected) |
+
static Matcher<java.io.File> |
+aFileWithAbsolutePath(Matcher<java.lang.String> expected) |
+
static Matcher<java.io.File> |
+aFileWithCanonicalPath(Matcher<java.lang.String> expected) |
+
static Matcher<java.io.File> |
+aFileWithSize(long size) |
+
static Matcher<java.io.File> |
+aFileWithSize(Matcher<java.lang.Long> expected) |
+
static Matcher<java.io.File> |
+anExistingDirectory() |
+
static Matcher<java.io.File> |
+anExistingFile() |
+
static Matcher<java.io.File> |
+anExistingFileOrDirectory() |
+
static Matcher<java.io.File> |
+aReadableFile() |
+
static Matcher<java.io.File> |
+aWritableFile() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final FileMatchers.FileStatus CAN_WRITE+
public static final FileMatchers.FileStatus CAN_READ+
public static final FileMatchers.FileStatus IS_FILE+
public static final FileMatchers.FileStatus IS_DIRECTORY+
public static final FileMatchers.FileStatus EXISTS+
public static Matcher<java.io.File> anExistingDirectory()+
public static Matcher<java.io.File> anExistingFileOrDirectory()+
public static Matcher<java.io.File> anExistingFile()+
public static Matcher<java.io.File> aReadableFile()+
public static Matcher<java.io.File> aWritableFile()+
public static Matcher<java.io.File> aFileWithSize(long size)+
public static Matcher<java.io.File> aFileWithSize(Matcher<java.lang.Long> expected)+
public static Matcher<java.io.File> aFileNamed(Matcher<java.lang.String> expected)+
public static Matcher<java.io.File> aFileWithCanonicalPath(Matcher<java.lang.String> expected)+
| Interface | +Description | +
|---|---|
| FileMatchers.FileStatus | ++ |
| Class | +Description | +
|---|---|
| FileMatchers | ++ |
public class BigDecimalCloseTo +extends TypeSafeMatcher<java.math.BigDecimal>+
| Constructor and Description | +
|---|
BigDecimalCloseTo(java.math.BigDecimal value,
+ java.math.BigDecimal error) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.math.BigDecimal> |
+closeTo(java.math.BigDecimal operand,
+ java.math.BigDecimal error)
+Creates a matcher of
+BigDecimals that matches when an examined BigDecimal is equal
+ to the specified operand, within a range of +/- error. |
+
void |
+describeMismatchSafely(java.math.BigDecimal item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.math.BigDecimal item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic BigDecimalCloseTo(java.math.BigDecimal value, + java.math.BigDecimal error)+
public boolean matchesSafely(java.math.BigDecimal item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.math.BigDecimal>public void describeMismatchSafely(java.math.BigDecimal item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.math.BigDecimal>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.math.BigDecimal> closeTo(java.math.BigDecimal operand, + java.math.BigDecimal error)+
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"))))operand - the expected value of matching BigDecimalserror - the delta (+/-) within which matches will be allowedpublic class IsCloseTo +extends TypeSafeMatcher<java.lang.Double>+
| Constructor and Description | +
|---|
IsCloseTo(double value,
+ double error) |
+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.Double> |
+closeTo(double operand,
+ double error)
+Creates a matcher of
+Doubles that matches when an examined double is equal
+ to the specified operand, within a range of +/- error. |
+
void |
+describeMismatchSafely(java.lang.Double item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.Double item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsCloseTo(double value, + double error)+
public boolean matchesSafely(java.lang.Double item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Double>public void describeMismatchSafely(java.lang.Double item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Double>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Double> closeTo(double operand, + double error)+
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)))
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowedpublic final class IsNaN +extends TypeSafeMatcher<java.lang.Double>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.Double item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.Double item)
+Subclasses should implement this.
+ |
+
static Matcher<java.lang.Double> |
+notANumber()
+Creates a matcher of
+Doubles that matches when an examined double is not a number. |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.Double item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Double>public void describeMismatchSafely(java.lang.Double item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Double>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Double> notANumber()+
Doubles that matches when an examined double is not a number.
+ For example:
+ assertThat(Double.NaN, is(notANumber()))
public class OrderingComparison
+extends java.lang.Object
+| Modifier and Type | +Method and Description | +
|---|---|
static <T extends java.lang.Comparable<T>> |
+comparesEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ equal to the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+greaterThanOrEqualTo(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ greater than or equal to the specified value, as reported by the compareTo method
+ of the examined object. |
+
static <T extends java.lang.Comparable<T>> |
+lessThan(T value)
+Creates a matcher of
+Comparable object that matches when the examined object is
+ less than the specified value, as reported by the compareTo method of the
+ examined object. |
+
static <T extends java.lang.Comparable<T>> |
+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. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static <T extends java.lang.Comparable<T>> Matcher<T> comparesEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return greater
+ than or equal to zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than zeropublic static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)+
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))
value - the value which, when passed to the compareTo method of the examined object, should return less
+ than or equal to zero| Class | +Description | +
|---|---|
| BigDecimalCloseTo | ++ |
| IsCloseTo | +
+ Is the value a number equal to a value within some range of
+ acceptable error?
+ |
+
| IsNaN | +
+ Is the value a number actually not a number (NaN)?
+ |
+
| OrderingComparison | ++ |
Matchers that perform numeric comparisons.
public class HasEqualValues<T> +extends TypeSafeDiagnosingMatcher<T>+
| Constructor and Description | +
|---|
HasEqualValues(T expectedObject) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
protected boolean |
+matchesSafely(T item,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HasEqualValues(T expectedObject)+
protected boolean matchesSafely(T item, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<T>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public class HasToString<T> +extends FeatureMatcher<T,java.lang.String>+
| Constructor and Description | +
|---|
HasToString(Matcher<? super java.lang.String> toStringMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.String |
+featureValueOf(T actual)
+Implement this to extract the interesting feature.
+ |
+
static <T> Matcher<T> |
+hasToString(Matcher<? super java.lang.String> toStringMatcher)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value that satisfies the specified matcher. |
+
static <T> Matcher<T> |
+hasToString(java.lang.String expectedToString)
+Creates a matcher that matches any examined object whose
+toString method
+ returns a value equalTo the specified string. |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HasToString(Matcher<? super java.lang.String> toStringMatcher)+
protected java.lang.String featureValueOf(T actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<T,java.lang.String>actual - the target objectpublic static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)+
toString method
+ returns a value that satisfies the specified matcher.
+ For example:
+ assertThat(true, hasToString(equalTo("TRUE")))toStringMatcher - the matcher used to verify the toString resultpublic static <T> Matcher<T> hasToString(java.lang.String expectedToString)+
toString method
+ returns a value equalTo the specified string.
+ For example:
+ assertThat(true, hasToString("TRUE"))expectedToString - the expected toString resultpublic class IsCompatibleType<T> +extends TypeSafeMatcher<java.lang.Class<?>>+
| Constructor and Description | +
|---|
IsCompatibleType(java.lang.Class<T> type) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.Class<?> cls,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.Class<?> cls)
+Subclasses should implement this.
+ |
+
static <T> Matcher<java.lang.Class<?>> |
+typeCompatibleWith(java.lang.Class<T> baseType)
+Creates a matcher of
+Class that matches when the specified baseType is
+ assignable from the examined class. |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsCompatibleType(java.lang.Class<T> type)+
public boolean matchesSafely(java.lang.Class<?> cls)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Class<?>>public void describeMismatchSafely(java.lang.Class<?> cls, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Class<?>>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)+
Class that matches when the specified baseType is
+ assignable from the examined class.
+ For example:
+ assertThat(Integer.class, typeCompatibleWith(Number.class))
baseType - the base class to examine classes againstpublic class IsEventFrom +extends TypeSafeDiagnosingMatcher<java.util.EventObject>+
| Constructor and Description | +
|---|
IsEventFrom(java.lang.Class<?> eventClass,
+ java.lang.Object source) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
+ java.lang.Object source)
+Creates a matcher of
+EventObject that matches any object
+ derived from eventClass announced by source. |
+
static Matcher<java.util.EventObject> |
+eventFrom(java.lang.Object source)
+Creates a matcher of
+EventObject that matches any EventObject
+ announced by source. |
+
boolean |
+matchesSafely(java.util.EventObject item,
+ Description mismatchDescription)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsEventFrom(java.lang.Class<?> eventClass, + java.lang.Object source)+
public boolean matchesSafely(java.util.EventObject item, + Description mismatchDescription)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<java.util.EventObject>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, + java.lang.Object source)+
EventObject that matches any object
+ derived from eventClass announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
eventClass - the class of the event to match onsource - the source of the eventpublic static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)+
EventObject that matches any EventObject
+ announced by source.
+ For example:
+ assertThat(myEvent, is(eventFrom(myBean)))
source - the source of the event| Class | +Description | +
|---|---|
| HasEqualValues<T> | ++ |
| HasToString<T> | ++ |
| IsCompatibleType<T> | ++ |
| IsEventFrom | +
+ Tests if the value is an event announced by a specific object.
+ |
+
Matchers that inspect objects and classes.
| Interface | +Description | +
|---|---|
| Condition.Step<I,O> | ++ |
| Description | +
+ A description of a Matcher.
+ |
+
| Matcher<T> | +
+
+ A matcher over acceptable values.
+ |
+
| SelfDescribing | +
+ The ability of an object to describe itself.
+ |
+
| Class | +Description | +
|---|---|
| BaseDescription | +
+ A
+Description that is stored as a string. |
+
| BaseMatcher<T> | +
+ BaseClass for all Matcher implementations.
+ |
+
| Condition<T> | +
+ A Condition implements part of a multi-step match.
+ |
+
| CoreMatchers | ++ |
| CustomMatcher<T> | +
+ Utility class for writing one off matchers.
+ |
+
| CustomTypeSafeMatcher<T> | +
+ Utility class for writing one off matchers.
+ |
+
| Description.NullDescription | ++ |
| DiagnosingMatcher<T> | +
+ TODO(ngd): Document.
+ |
+
| FeatureMatcher<T,U> | +
+ Supporting class for matching a feature of an object.
+ |
+
| MatcherAssert | ++ |
| Matchers | ++ |
| StringDescription | +
+ A
+Description that is stored as a string. |
+
| TypeSafeDiagnosingMatcher<T> | +
+ Convenient base class for Matchers that require a non-null value of a specific type
+ and that will report why the received value has been rejected.
+ |
+
| TypeSafeMatcher<T> | +
+ Convenient base class for Matchers that require a non-null value of a specific type.
+ |
+
public class CharSequenceLength +extends FeatureMatcher<java.lang.CharSequence,java.lang.Integer>+
| Constructor and Description | +
|---|
CharSequenceLength(Matcher<? super java.lang.Integer> lengthMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
protected java.lang.Integer |
+featureValueOf(java.lang.CharSequence actual)
+Implement this to extract the interesting feature.
+ |
+
static Matcher<java.lang.CharSequence> |
+hasLength(int length)
+Creates a matcher of
+CharSequence that matches when a char sequence has the given length
+ For example: |
+
static Matcher<java.lang.CharSequence> |
+hasLength(Matcher<? super java.lang.Integer> lengthMatcher)
+Creates a matcher of
+CharSequence that matches when a char sequence has the given length
+ For example: |
+
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic CharSequenceLength(Matcher<? super java.lang.Integer> lengthMatcher)+
lengthMatcher - The matcher to apply to the featureprotected java.lang.Integer featureValueOf(java.lang.CharSequence actual)+
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.lang.CharSequence,java.lang.Integer>actual - the target objectpublic static Matcher<java.lang.CharSequence> hasLength(int length)+
CharSequence that matches when a char sequence has the given length
+ For example:
+
+
+ assertThat("text", hasLength(4))
+ length - the expected length of the stringpublic static Matcher<java.lang.CharSequence> hasLength(Matcher<? super java.lang.Integer> lengthMatcher)+
CharSequence that matches when a char sequence has the given length
+ For example:
+
+
+ assertThat("text", hasLength(lessThan(4)))
+ lengthMatcher - the expected length of the stringpublic final class IsBlankString +extends TypeSafeMatcher<java.lang.String>+
| Modifier and Type | +Method and Description | +
|---|---|
static Matcher<java.lang.String> |
+blankOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else. |
+
static Matcher<java.lang.String> |
+blankString()
+Creates a matcher of
+String that matches when the examined string contains
+ zero or more whitespace characters and nothing else. |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, describeMismatchSafely, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> blankString()+
String that matches when the examined string contains
+ zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(" ", is(blankString()))public static Matcher<java.lang.String> blankOrNullString()+
String that matches when the examined string is null, or
+ contains zero or more whitespace characters and nothing else.
+ For example:
+ assertThat(((String)null), is(blankOrNullString()))
public final class IsEmptyString +extends TypeSafeMatcher<java.lang.String>+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+emptyOrNullString()
+Creates a matcher of
+String that matches when the examined string is null, or
+ has zero length. |
+
static Matcher<java.lang.String> |
+emptyString()
+Creates a matcher of
+String that matches when the examined string has zero length. |
+
static Matcher<java.lang.String> |
+isEmptyOrNullString()
+Deprecated.
+
+use is(emptyOrNullString()) instead
+ |
+
static Matcher<java.lang.String> |
+isEmptyString()
+Deprecated.
+
+use is(emptyString()) instead
+ |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, describeMismatchSafely, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.@Deprecated +public static Matcher<java.lang.String> isEmptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", isEmptyString())public static Matcher<java.lang.String> emptyString()+
String that matches when the examined string has zero length.
+ For example:
+ assertThat("", is(emptyString()))@Deprecated +public static Matcher<java.lang.String> isEmptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), isEmptyOrNullString())
public static Matcher<java.lang.String> emptyOrNullString()+
String that matches when the examined string is null, or
+ has zero length.
+ For example:
+ assertThat(((String)null), is(emptyOrNullString()))
public class IsEqualCompressingWhiteSpace +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
IsEqualCompressingWhiteSpace(java.lang.String string) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+equalToCompressingWhiteSpace(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, when whitespace differences are (mostly) ignored. |
+
static Matcher<java.lang.String> |
+equalToIgnoringWhiteSpace(java.lang.String expectedString)
+Deprecated.
+
+
+ |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
java.lang.String |
+stripSpaces(java.lang.String toBeStripped) |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsEqualCompressingWhiteSpace(java.lang.String string)+
public boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public java.lang.String stripSpaces(java.lang.String toBeStripped)+
public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)+
equalToCompressingWhiteSpace(String)expectedString - the expected value of matched stringspublic static Matcher<java.lang.String> equalToCompressingWhiteSpace(java.lang.String expectedString)+
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:
+ assertThat(" my\tfoo bar ", equalToCompressingWhiteSpace(" my foo bar"))expectedString - the expected value of matched stringspublic class IsEqualIgnoringCase +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
IsEqualIgnoringCase(java.lang.String string) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+equalToIgnoringCase(java.lang.String expectedString)
+Creates a matcher of
+String that matches when the examined string is equal to
+ the specified expectedString, ignoring case. |
+
boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic IsEqualIgnoringCase(java.lang.String string)+
public boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString)+
String that matches when the examined string is equal to
+ the specified expectedString, ignoring case.
+ For example:
+ assertThat("Foo", equalToIgnoringCase("FOO"))expectedString - the expected value of matched stringspublic class MatchesPattern +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
MatchesPattern(java.util.regex.Pattern pattern) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<java.lang.String> |
+matchesPattern(java.util.regex.Pattern pattern)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given Pattern. |
+
static Matcher<java.lang.String> |
+matchesPattern(java.lang.String regex)
+Creates a matcher of
+String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern. |
+
protected boolean |
+matchesSafely(java.lang.String item)
+Subclasses should implement this.
+ |
+
describeMismatch, describeMismatchSafely, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MatchesPattern(java.util.regex.Pattern pattern)+
protected boolean matchesSafely(java.lang.String item)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> matchesPattern(java.util.regex.Pattern pattern)+
String that matches when the examined string
+ exactly matches the given Pattern.public static Matcher<java.lang.String> matchesPattern(java.lang.String regex)+
String that matches when the examined string
+ exactly matches the given regular expression, treated as a Pattern.public class StringContainsInOrder +extends TypeSafeMatcher<java.lang.String>+
| Constructor and Description | +
|---|
StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeMismatchSafely(java.lang.String item,
+ Description mismatchDescription)
+Subclasses should override this.
+ |
+
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
boolean |
+matchesSafely(java.lang.String s)
+Subclasses should implement this.
+ |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
static Matcher<java.lang.String> |
+stringContainsInOrder(java.lang.String... substrings)
+Creates a matcher of
+String that matches when the examined string contains all of
+ the specified substrings, considering the order of their appearance. |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
public boolean matchesSafely(java.lang.String s)+
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.String>public void describeMismatchSafely(java.lang.String item, + Description mismatchDescription)+
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.String>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)+
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"substrings - the substrings that must be contained within matching stringspublic static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings)+
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"substrings - the substrings that must be contained within matching strings| Class | +Description | +
|---|---|
| CharSequenceLength | ++ |
| IsBlankString | +
+ Matches blank Strings (and null).
+ |
+
| IsEmptyString | +
+ Matches empty Strings (and null).
+ |
+
| IsEqualCompressingWhiteSpace | +
+ Tests if a string is equal to another string, compressing any changes in whitespace.
+ |
+
| IsEqualIgnoringCase | +
+ Tests if a string is equal to another string, regardless of the case.
+ |
+
| MatchesPattern | ++ |
| StringContainsInOrder | ++ |
Matchers that perform text comparisons.
public class HasXPath +extends TypeSafeDiagnosingMatcher<org.w3c.dom.Node>+
| Modifier and Type | +Field and Description | +
|---|---|
static javax.xml.namespace.NamespaceContext |
+NO_NAMESPACE_CONTEXT |
+
| Constructor and Description | +
|---|
HasXPath(java.lang.String xPathExpression,
+ Matcher<java.lang.String> valueMatcher) |
+
HasXPath(java.lang.String xPathExpression,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher) |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+describeTo(Description description)
+Generates a description of the object.
+ |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath that satisfies the specified valueMatcher. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext)
+Creates a matcher of
+Nodes that matches when the examined node contains a node
+ at the specified xPath within the specified namespace context, with any content. |
+
static Matcher<org.w3c.dom.Node> |
+hasXPath(java.lang.String xPath,
+ javax.xml.namespace.NamespaceContext namespaceContext,
+ Matcher<java.lang.String> valueMatcher)
+Creates a matcher of
+Nodes that matches when the examined node has a value at the
+ specified xPath, within the specified namespaceContext, that satisfies
+ the specified valueMatcher. |
+
boolean |
+matchesSafely(org.w3c.dom.Node item,
+ Description mismatch)
+Subclasses should implement this.
+ |
+
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic static final javax.xml.namespace.NamespaceContext NO_NAMESPACE_CONTEXT+
public HasXPath(java.lang.String xPathExpression, + Matcher<java.lang.String> valueMatcher)+
xPathExpression - XPath expression.valueMatcher - Matcher to use at given XPath.
+ May be null to specify that the XPath must exist but the value is irrelevant.public HasXPath(java.lang.String xPathExpression, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
xPathExpression - XPath expression.namespaceContext - Resolves XML namespace prefixes in the XPath expressionvalueMatcher - Matcher to use at given XPath.
+ May be null to specify that the XPath must exist but the value is irrelevant.public boolean matchesSafely(org.w3c.dom.Node item, + Description mismatch)+
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<org.w3c.dom.Node>public void describeTo(Description description)+
SelfDescribingdescription - The description to be built or appended to.public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext, + Matcher<java.lang.String> valueMatcher)+
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")))xPath - the target xpathnamespaceContext - the namespace for matching nodesvalueMatcher - matcher for the value at the specified xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)+
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"))xPath - the target xpathpublic static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, + javax.xml.namespace.NamespaceContext namespaceContext)+
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))xPath - the target xpathnamespaceContext - the namespace for matching nodes| Class | +Description | +
|---|---|
| HasXPath | +
+ Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
+ |
+
Matchers of XML documents.
+ + diff --git a/docs/javadoc/2.1/overview-summary.html b/docs/javadoc/2.1/overview-summary.html new file mode 100644 index 00000000..ce4b1d80 --- /dev/null +++ b/docs/javadoc/2.1/overview-summary.html @@ -0,0 +1,190 @@ + + + + + +
| Package | +Description | +
|---|---|
| org.hamcrest | ++ |
| org.hamcrest.beans | +
+ Matchers of Java Bean properties and their values.
+ |
+
| org.hamcrest.collection | +
+ Matchers of arrays and collections.
+ |
+
| org.hamcrest.comparator | ++ |
| org.hamcrest.core | +
+ Fundamental matchers of objects and values, and composite matchers.
+ |
+
| org.hamcrest.internal | ++ |
| org.hamcrest.io | ++ |
| org.hamcrest.number | +
+ Matchers that perform numeric comparisons.
+ |
+
| org.hamcrest.object | +
+ Matchers that inspect objects and classes.
+ |
+
| org.hamcrest.text | +
+ Matchers that perform text comparisons.
+ |
+
| org.hamcrest.xml | +
+ Matchers of XML documents.
+ |
+
Java Hamcrest
+
+
+
diff --git a/docs/related.md b/docs/related.md
new file mode 100644
index 00000000..c1437801
--- /dev/null
+++ b/docs/related.md
@@ -0,0 +1,30 @@
+---
+title: Hamcrest Related Projects
+layout: default
+---
+[Java Hamcrest Home](index)
+
+# Related Projects
+
+Here are some projects that provide additional features and matchers
+
+* [Awaitility](https://github.com/jayway/awaitility) (a DSL that allows you to express expectations of an asynchronous system in a concise and easy to read manner)
+* [EZ Testing](https://github.com/EZGames/ez-testing) (contains base classes for defining chainable matchers that have a similar style to AssertJ)
+* [Hamcrest 1.3 Utility Matchers](https://github.com/NitorCreations/matchers) (Java matchers like CollectionMatchers, MapMatchers, FieldMatcher, SerializableMatcher etc)
+* [Hamcrest avro](https://github.com/Byhiras/avro-utils)
+* [Hamcrest Composites](https://github.com/Cornutum/hamcrest-composites) (for comparing complex Java objects with better testability)
+* [Hamcrest Date](https://github.com/modularit/hamcrest-date) (for comparing dates)
+* [Hamcrest HAR](https://github.com/roydekleijn/har-assert) (for HTTP archive files)
+* [Hamcrest Java Extras](https://github.com/sf105/hamcrest-java-extras) (currently only a couple of Json matchers)
+* [Hamcrest JSON](https://github.com/hertzsprung/hamcrest-json) (for comparing entire JSON documents)
+* [Hamcrest Path](https://github.com/seinesoftware/hamcrest-path) (for testing path existence and permissions)
+* [Hamcrest Querydsl](https://github.com/beloglazov/hamcrest-querydsl) (for checking query results: hasResultSize, hasColumnRange, hasColumnMax, hasColumnMin, hasColumnContainingAll, hasColumnContainingAny)
+* [Hamcrest Text Patterns](http://code.google.com/p/hamcrest-text-patterns/)
+* [hamcrest-pojo-matcher-generator](https://github.com/yandex-qatools/hamcrest-pojo-matcher-generator) (Annotation processor to generate feature-matchers based on your POJOs)
+* [http-matchers](https://github.com/valid4j/http-matchers) (Matchers to test your web service via the standard Java API for RESTful Services (JAX-RS))
+* [json-path-matchers](https://github.com/jayway/JsonPath/tree/master/json-path-assert) (for evaluating JSON path expressions)
+* [JsonUnit](https://github.com/lukas-krecan/JsonUnit) (for comparing JSON structures jsonEquals, jsonPartEquals)
+* [Proboscis](https://github.com/sf105/proboscis) (a tiny java library for polling for a result, originally intended for tested asynchronous systems)
+* [Shazamcrest](https://github.com/shazam/shazamcrest) (Matchers for beans with custom field matching and nice failure messages)
+* [Spotify's hamcrest matchers](https://github.com/spotify/java-hamcrest) (Matchers for POJOs, JSON, and some of the types introduced in Java 8)
+* [valid4j](https://github.com/valid4j/valid4j) (assertion and validation library, i.e supporting design-by-contract style and/or recoverable input validation)
diff --git a/docs/tutorial.md b/docs/tutorial.md
new file mode 100644
index 00000000..f9e956c9
--- /dev/null
+++ b/docs/tutorial.md
@@ -0,0 +1,175 @@
+---
+title: Hamcrest Tutorial
+layout: default
+---
+[Java Hamcrest Home](index)
+
+# Hamcrest Tutorial
+
+## Introduction
+Hamcrest is a framework for writing matcher objects allowing 'match' rules to be defined declaratively. There are a number of situations where matchers are invaluble, such as UI validation, or data filtering, but it is in the area of writing flexible tests that matchers are most commonly used. This tutorial shows you how to use Hamcrest for unit testing.
+
+When writing tests it is sometimes difficult to get the balance right between overspecifying the test (and making it brittle to changes), and not specifying enough (making the test less valuable since it continues to pass even when the thing being tested is broken). Having a tool that allows you to pick out precisely the aspect under test and describe the values it should have, to a controlled level of precision, helps greatly in writing tests that are "just right". Such tests fail when the behaviour of the aspect under test deviates from the expected behaviour, yet continue to pass when minor, unrelated changes to the behaviour are made.
+
+### My first Hamcrest test
+We'll start by writing a very simple JUnit 5 test, but instead of using JUnit's `assertEquals` methods, we use Hamcrest's `assertThat` construct and the standard set of matchers, both of which we statically import:
+
+```java
+import org.junit.jupiter.api.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+
+public class BiscuitTest {
+ @Test
+ public void testEquals() {
+ Biscuit theBiscuit = new Biscuit("Ginger");
+ Biscuit myBiscuit = new Biscuit("Ginger");
+ assertThat(theBiscuit, equalTo(myBiscuit));
+ }
+}
+```
+
+The `assertThat` method is a stylized sentence for making a test assertion. In this example, the subject of the assertion is the object biscuit that is the first method parameter. The second method parameter is a matcher for Biscuit objects, here a matcher that checks one object is equal to another using the Object equals method. The test passes since the Biscuit class defines an equals method.
+
+If you have more than one assertion in your test you can include an identifier for the tested value in the assertion:
+
+```java
+assertThat("chocolate chips", theBiscuit.getChocolateChipCount(), equalTo(10));
+
+assertThat("hazelnuts", theBiscuit.getHazelnutCount(), equalTo(3));
+```
+
+### Other test frameworks
+Hamcrest has been designed from the outset to integrate with different unit testing frameworks. For example, Hamcrest can be used with JUnit (all versions) and TestNG. (For details have a look at the examples that come with the full Hamcrest distribution.) It is easy enough to migrate to using Hamcrest-style assertions in an existing test suite, since other assertion styles can co-exist with Hamcrest's.
+
+Hamcrest can also be used with mock objects frameworks by using adaptors to bridge from the mock objects framework's concept of a matcher to a Hamcrest matcher. For example, JMock 1's constraints are Hamcrest's matchers. Hamcrest provides a JMock 1 adaptor to allow you to use Hamcrest matchers in your JMock 1 tests. JMock 2 doesn't need such an adaptor layer since it is designed to use Hamcrest as its matching library. Hamcrest also provides adaptors for EasyMock 2. Again, see the Hamcrest examples for more details.
+
+### A tour of common matchers
+Hamcrest comes with a library of useful matchers. Here are some of the most important ones.
+
+#### Core
+`anything` - always matches, useful if you don't care what the object under test is
+
+`describedAs` - decorator to adding custom failure description
+
+`is` - decorator to improve readability - see "Sugar", below
+
+#### Logical
+`allOf` - matches if all matchers match, short circuits (like Java &&)
+
+`anyOf` - matches if any matchers match, short circuits (like Java \|\|)
+
+`not` - matches if the wrapped matcher doesn't match and vice versa
+
+#### Object
+`equalTo` - test object equality using Object.equals
+
+`hasToString` - test Object.toString
+
+`instanceOf`, `isCompatibleType` - test type
+
+`notNullValue`, `nullValue` - test for null
+
+`sameInstance` - test object identity
+
+#### Beans
+`hasProperty` - test JavaBeans properties
+
+#### Collections
+`array` - test an array's elements against an array of matchers
+
+`hasEntry`, `hasKey`, `hasValue` - test a map contains an entry, key or value
+
+`hasItem`, `hasItems` - test a collection contains elements
+
+`hasItemInArray` - test an array contains an element
+
+#### Number
+`closeTo` - test floating point values are close to a given value
+
+`greaterThan`, `greaterThanOrEqualTo`, `lessThan`, `lessThanOrEqualTo` - test ordering
+
+#### Text
+`equalToIgnoringCase` - test string equality ignoring case
+
+`equalToIgnoringWhiteSpace` - test string equality ignoring differences in runs of whitespace
+
+`containsString`, `endsWith`, `startsWith` - test string matching
+
+#### Sugar
+Hamcrest strives to make your tests as readable as possible. For example, the is matcher is a wrapper that doesn't add any extra behavior to the underlying matcher. The following assertions are all equivalent:
+
+```java
+assertThat(theBiscuit, equalTo(myBiscuit));
+assertThat(theBiscuit, is(equalTo(myBiscuit)));
+assertThat(theBiscuit, is(myBiscuit));
+```
+
+The last form is allowed since is(T value) is overloaded to return `is(equalTo(value))`.
+
+### Writing custom matchers
+Hamcrest comes bundled with lots of useful matchers, but you'll probably find that you need to create your own from time to time to fit your testing needs. This commonly occurs when you find a fragment of code that tests the same set of properties over and over again (and in different tests), and you want to bundle the fragment into a single assertion. By writing your own matcher you'll eliminate code duplication and make your tests more readable!
+
+Let's write our own matcher for testing if a double value has the value NaN (not a number). This is the test we want to write:
+
+```java
+@Test
+public void testSquareRootOfMinusOneIsNotANumber() {
+ assertThat(Math.sqrt(-1), is(notANumber()));
+}
+```
+
+And here's the implementation:
+
+```java
+package org.hamcrest.examples.tutorial;
+
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+
+public class IsNotANumber extends TypeSafeMatcher {
+
+ @Override
+ public boolean matchesSafely(Double number) {
+ return number.isNaN();
+ }
+
+ public void describeTo(Description description) {
+ description.appendText("not a number");
+ }
+
+ public static Matcher notANumber() {
+ return new IsNotANumber();
+ }
+
+}
+```
+
+The `assertThat` method is a generic method which takes a Matcher parameterized by the type of the subject of the assertion. We are asserting things about Double values, so we know that we need a `Matcherfalse.
- */
-public class AllOfassertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- */
- @Factory
- public static true.
- */
-public class AnyOfassertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */
- @Factory
- public static assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
- */
- @Factory
- public static assertThat("myStringOfNote", containsString("ring"))
- *
- * @param substring
- * the substring that the returned matcher will expect to find within any examined string
- *
- */
- @Factory
- public static MatcherassertThat("myStringOfNote", endsWith("Note"))
- *
- * @param suffix
- * the substring that the returned matcher will expect at the end of any examined string
- */
- @Factory
- public static MatcherassertThat("myStringOfNote", startsWith("my"))
- *
- * @param prefix
- * the substring that the returned matcher will expect at the start of any examined string
- */
- @Factory
- public static Matcherhamcrest-core.jar have moved to
+ * hamcrest.jar. Please use that dependency instead.
+ */
+@Deprecated
+class HamcrestCoreIsDeprecated {
+}
diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java
new file mode 100644
index 00000000..394ab821
--- /dev/null
+++ b/hamcrest-core/src/main/java/org/hamcrest/core/deprecated/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * All classes in hamcrest-core.jar have been migrated to
+ * hamcrest.jar. Please use that dependency instead.
+ */
+package org.hamcrest.core.deprecated;
\ No newline at end of file
diff --git a/hamcrest-core/src/main/java/org/hamcrest/package.html b/hamcrest-core/src/main/java/org/hamcrest/package.html
deleted file mode 100644
index 143c704d..00000000
--- a/hamcrest-core/src/main/java/org/hamcrest/package.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
- The stable API defining Matcher and its associated interfaces and classes. - Hamcrest sub-projects define their convenience classes in the org.hamcrest package. -
- - diff --git a/hamcrest-core/src/main/resources/hamcrest-core-is-deprecated.txt b/hamcrest-core/src/main/resources/hamcrest-core-is-deprecated.txt new file mode 100644 index 00000000..4c860f0c --- /dev/null +++ b/hamcrest-core/src/main/resources/hamcrest-core-is-deprecated.txt @@ -0,0 +1,5 @@ +Hamcrest Core +============= + +All the classes in hamcrest-core.jar and hamcrest-library.jar has moved +into hamcrest.jar. Please update your dependencies. \ No newline at end of file diff --git a/hamcrest-examples/src/main/hamcrest-examples.iml b/hamcrest-examples/src/main/hamcrest-examples.iml deleted file mode 100644 index 6b02a9d1..00000000 --- a/hamcrest-examples/src/main/hamcrest-examples.iml +++ /dev/null @@ -1,14 +0,0 @@ - -This class uses Strings to represent things instead of java.lang.reflect equivalents,
- * allowing methods to be defined from sources other than reflection of classes in the
- * classpath.
- *
- * @author Joe Walnes
- * @see SugarGenerator
- */
-public class FactoryMethod {
-
- private final String matcherClass;
- private final String factoryMethod;
- private final String returnType;
-
- private String generifiedType;
- private List Implementations of this could include vanilla factory methods for
- * Hamcrest matchers, wrapped factories for other libraries or factories
- * in other languages (jython, jruby, groovy, etc).
- * All methods matching signature '@Factory public static Matcher Caveat: Reflection is hassle-free, but unfortunately cannot expose method parameter names or JavaDoc
- * comments, making the sugar slightly more obscure.
- *
- * @author Joe Walnes
- * @see SugarGenerator
- * @see FactoryMethod
- */
-public class ReflectiveFactoryReader implements Iterable The rules for determining this are:
- * 1. The method must be public static.
- * 2. It must have a return type of org.hamcrest.Matcher (or something that extends this).
- * 3. It must be marked with the org.hamcrest.Factory annotation.
- * To use another set of rules, override this method.
- */
- protected boolean isFactoryMethod(Method javaMethod) {
- return isStatic(javaMethod.getModifiers())
- && isPublic(javaMethod.getModifiers())
- && hasFactoryAnnotation(javaMethod)
- && !Void.TYPE.equals(javaMethod.getReturnType());
- }
-
- @SuppressWarnings("unchecked")
- private boolean hasFactoryAnnotation(Method javaMethod) {
- // We dynamically load the Factory class, to avoid a compile time
- // dependency on org.hamcrest.Factory. This gets around
- // a circular bootstrap issue (because generator is required to
- // compile core).
- try {
- final Class> factoryClass = classLoader.loadClass("org.hamcrest.Factory");
- if (!Annotation.class.isAssignableFrom(factoryClass)) {
- throw new RuntimeException("Not an annotation class: " + factoryClass.getCanonicalName());
- }
- return javaMethod.getAnnotation((Class extends Annotation>)factoryClass) != null;
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Cannot load hamcrest core", e);
- }
- }
-
- private static FactoryMethod buildFactoryMethod(Method javaMethod) {
- FactoryMethod result = new FactoryMethod(
- classToString(javaMethod.getDeclaringClass()),
- javaMethod.getName(),
- classToString(javaMethod.getReturnType()));
-
- for (TypeVariable Generally, Matcher factory methods are defined all over the place, which makes it
- * really hard to remember which methods need to be imported and doesn't allow you
- * to easily browse a list of all of them.
- * This generates one uber matcher factory that delegates to all the respective classes.
- * Additionally, this allows the uber-classes to do things like wrap matchers in adapters
- * (e.g. to make them EasyMock friendly) or even generate wrappers in other languages
- * (such as JRuby or Jython).
- * You need to add at least one writer and at least one factory method for this to be
- * any help.
- * Usage:
- *
- * writer.writeHeader(...);
- *
- * writer.writeMethod(...);
- * writer.writeMethod(...);
- * writer.writeMethod(...);
- * ...
- * writer.writeFooter(...);
- * writer.close();
- *
- *
- * @author Joe Walnes
- * @see FactoryMethod
- * @see SugarGenerator
- * @see HamcrestFactoryWriter
- */
-public interface FactoryWriter extends Closeable, Flushable {
-
- /**
- * Write the code header.
- */
- void writeHeader() throws IOException;
-
- /**
- * Writes code that delegates to a method.
- *
- * @param generatedMethodName
- * @param factoryMethodToDelegateTo
- */
- void writeMethod(String generatedMethodName, FactoryMethod factoryMethodToDelegateTo) throws IOException;
-
- /**
- * Write any necessary code to finish the output.
- */
- void writeFooter() throws IOException;
-
-}
diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/HamcrestFactoryWriter.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/HamcrestFactoryWriter.java
deleted file mode 100644
index 48406766..00000000
--- a/hamcrest-generator/src/main/java/org/hamcrest/generator/HamcrestFactoryWriter.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.hamcrest.generator;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.StringTokenizer;
-
-/**
- * {@link FactoryWriter} that outputs Java code which simply delegates all
- * Hamcrest factory methods to factory methods elsewhere. This is useful for
- * grouping lots of matcher classes into one class, so you only have to look
- * in one place for matchers.
- *
- * @author Joe Walnes
- * @see FactoryWriter
- */
-public class HamcrestFactoryWriter implements FactoryWriter {
-
- private final PrintWriter output;
- private final String javaPackageName;
- private final String javaClassName;
-
- private String indentationString = " ";
- private String newLine = "\n";
-
- private int indentation = 1;
-
- public HamcrestFactoryWriter(String javaPackageName, String javaClassName, Writer output) {
- this.javaPackageName = javaPackageName;
- this.javaClassName = javaClassName;
- this.output = new PrintWriter(output);
- }
-
- @Override
- public void writeHeader() throws IOException {
- output.append("// Generated source.").append(newLine)
- .append("package ").append(javaPackageName).append(';').append(newLine).append(newLine);
- output.append("public class ").append(javaClassName).append(" {").append(newLine).append(newLine);
- }
-
- @Override
- public void writeFooter() throws IOException {
- output.append('}').append(newLine);
- }
-
- @Override
- public void close() throws IOException {
- output.close();
- }
-
- @Override
- public void flush() throws IOException {
- output.flush();
- }
-
- @Override
- public void writeMethod(String generatedMethodName, FactoryMethod factoryMethodToDelegateTo)
- throws IOException {
- writeJavaDoc(factoryMethodToDelegateTo);
- indent();
- output.append("public static ");
- writeGenericTypeParameters(factoryMethodToDelegateTo);
- output.append(factoryMethodToDelegateTo.getReturnType());
- if (factoryMethodToDelegateTo.getGenerifiedType() != null) {
- output.append('<').append(factoryMethodToDelegateTo.getGenerifiedType()).append('>');
- }
- output.append(' ').append(generatedMethodName);
- writeParameters(factoryMethodToDelegateTo);
- writeExceptions(factoryMethodToDelegateTo);
- output.append(" {").append(newLine);
- indentation++;
- writeMethodBody(factoryMethodToDelegateTo);
- indentation--;
- indent();
- output.append('}').append(newLine).append(newLine);
- }
-
- private void writeGenericTypeParameters(FactoryMethod factoryMethod) {
- if (!factoryMethod.getGenericTypeParameters().isEmpty()) {
- output.append('<');
- boolean seenFirst = false;
- for (String type : factoryMethod.getGenericTypeParameters()) {
- if (seenFirst) {
- output.append(", ");
- } else {
- seenFirst = true;
- }
- output.append(type);
- }
- output.append("> ");
- }
- }
-
- private void writeMethodBody(FactoryMethod factoryMethod) {
- indent();
- output.append("return ").append(factoryMethod.getMatcherClass());
- output.append('.');
-
- // lets write the generic types
- if (!factoryMethod.getGenericTypeParameters().isEmpty()) {
- output.append('<');
- boolean seenFirst = false;
- for (String type : factoryMethod.getGenericTypeParameters()) {
- if (seenFirst) {
- output.append(",");
- } else {
- seenFirst = true;
- }
- // lets only print the first word of the type
- // so if its 'T extends Cheese' we just print T
- //output.append(type);
-
- StringTokenizer iter = new StringTokenizer(type);
- iter.hasMoreElements();
- output.append(iter.nextToken());
- }
- output.append(">");
- }
-
- output.append(factoryMethod.getName());
- output.append('(');
- boolean seenFirst = false;
- for (FactoryMethod.Parameter parameter : factoryMethod.getParameters()) {
- if (seenFirst) {
- output.append(", ");
- } else {
- seenFirst = true;
- }
- output.append(parameter.getName());
- }
- output.append(')');
- output.append(';').append(newLine);
- }
-
- private void writeExceptions(FactoryMethod factoryMethod) {
- boolean seenFirst = false;
- for (String exception : factoryMethod.getExceptions()) {
- if (seenFirst) {
- output.append(", ");
- } else {
- output.append(" throws ");
- seenFirst = true;
- }
- output.append(exception);
- }
- }
-
- private void writeParameters(FactoryMethod factoryMethod) {
- output.append('(');
- boolean seenFirst = false;
- for (FactoryMethod.Parameter parameter : factoryMethod.getParameters()) {
- if (seenFirst) {
- output.append(", ");
- } else {
- seenFirst = true;
- }
- output.append(parameter.getType()).append(' ').append(parameter.getName());
- }
- output.append(')');
- }
-
- private void writeJavaDoc(FactoryMethod factoryMethod) {
- if (factoryMethod.getJavaDoc() != null) {
- String[] lines = factoryMethod.getJavaDoc().split("\n");
- if (lines.length > 0) {
- indent();
- output.append("/**").append(newLine);
- for (String line : lines) {
- indent();
- output.append(" * ").append(line).append(newLine);
- }
- indent();
- output.append(" */").append(newLine);
- }
- }
- }
-
- private void indent() {
- for (int i = 0; i < indentation; i++) {
- output.append(indentationString);
- }
- }
-}
diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java
deleted file mode 100644
index c1798f21..00000000
--- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.hamcrest.generator;
-
-import com.thoughtworks.qdox.JavaDocBuilder;
-import com.thoughtworks.qdox.model.JavaClass;
-
-import java.io.File;
-import java.io.Reader;
-
-/**
- * Wraps QDox library. This is because to ease distribution, QDox is bundled into
- * hamcrest-generator.jar and has its package renamed to ensure there is no conflict
- * (using Jar Jar Links). This wrapper class removes all traces of QDox from Hamcrest's
- * public API, so there aren't any compatibility problems.
- *
- * @author Joe Walnes
- */
-public class QDox {
-
- private final JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
-
- public void addSourceTree(File sourceDir) {
- javaDocBuilder.addSourceTree(sourceDir);
- }
-
- public void addSource(Reader reader) {
- javaDocBuilder.addSource(reader);
- }
-
- JavaClass getClassByName(String className) {
- return javaDocBuilder.getClassByName(className);
- }
-}
diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java
deleted file mode 100644
index 7883a6f2..00000000
--- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.hamcrest.generator;
-
-import com.thoughtworks.qdox.model.DocletTag;
-import com.thoughtworks.qdox.model.JavaClass;
-import com.thoughtworks.qdox.model.JavaMethod;
-import com.thoughtworks.qdox.model.JavaParameter;
-import com.thoughtworks.qdox.model.Type;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- * Wraps an existing sequence of FactoryMethods, and attempts to pull in
- * parameter names and JavaDoc (which aren't available using reflection) using
- * QDox.
- *
- * @see QDox
- * @author Joe Walnes
- */
-public class QDoxFactoryReader implements IterableUsage
- *
- * for (FactoryMethod method : new ReflectiveFactoryReader(MyMatchers.class)) {
- * ...
- * }
- *
- * Usage
- *
- * SugarGenerator sugarGenerator = new SugarGenerator();
- * try {
- * // Write out sugar as standard Hamcrest factories.
- * sugarGenerator.addWriter(
- * new HamcrestFactoryWriter("com.some.package", "MyMatcherClass", new FileWriter(...)));
- * // Also write out sugar as EasyMock compatible factories.
- * sugarGenerator.addWriter(
- * new EasyMockFactoryWriter("com.some.package", "MyEasyMatcherClass", new FileWriter(...)));
- * // Add a load of Matcher factories to the generated sugar. The factory methods
- * // are read via reflection.
- * sugarGenerator.addFactoryMethods(new ReflectiveFactoryReader(IsIn.class));
- * sugarGenerator.addFactoryMethods(new ReflectiveFactoryReader(IsSame.class));
- * sugarGenerator.addFactoryMethods(new ReflectiveFactoryReader(IsNot.class));
- * // Generate everything!
- * sugarGenerator.generate();
- * } finally {
- * // Clean up... close all streams.
- * sugarGenerator.close();
- * }
- *
- * @author Joe Walnes
- * @see FactoryWriter
- * @see HamcrestFactoryWriter
- * @see ReflectiveFactoryReader
- */
-public class SugarGenerator implements Closeable, SugarConfiguration {
-
- private final Listassert keyword.
- * Example:
- *
- * assert that("Foo", startsWith("f"));
- *
- *
- * @author Neil Dunn
- */
-public class JavaLangMatcherAssert {
- private JavaLangMatcherAssert() {};
-
- public static assert keyword.
+ * Example:
+ *
+ * assert that("Foo", startsWith("f"));
+ *
+ *
+ * @author Neil Dunn
+ */
+public class JavaLangMatcherAssert {
+ private JavaLangMatcherAssert() {};
+
+ public static elementMatcher. Whilst matching, the traversal
- * of the examined array will stop as soon as a matching element is found.
- *
- * For example:
- * assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
- *
- * @param elementMatcher
- * the matcher to apply to elements in examined arrays
- */
- @Factory
- public static hasItemInArray(equalTo(x)).
- *
- * For example:
- * assertThat(hasItemInArray(x))
- * instead of:
- * assertThat(hasItemInArray(equalTo(x)))
- *
- * @param element
- * the element that should be present in examined arrays
- */
- @Factory
- public static hamcrest-library.jar have moved to
+ * hamcrest.jar. Please use that dependency instead.
+ */
+@Deprecated
+class HamcrestLibraryIsDeprecated {
+}
diff --git a/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java
new file mode 100644
index 00000000..c98f5aff
--- /dev/null
+++ b/hamcrest-library/src/main/java/org/hamcrest/library/deprecated/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * All classes in hamcrest-library.jar have been migrated to
+ * hamcrest.jar. Please use that dependency instead.
+ */
+package org.hamcrest.library.deprecated;
\ No newline at end of file
diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java b/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java
deleted file mode 100644
index 9e7294d3..00000000
--- a/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Copyright (c) 2000-2009 hamcrest.org
- */
-package org.hamcrest.number;
-
-import org.hamcrest.Description;
-import org.hamcrest.Factory;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-
-import static java.lang.Integer.signum;
-
-public class OrderingComparisoncompareTo method of the
- * examined object.
- *
- * For example:
- * assertThat(1, comparesEqualTo(1))
- *
- * @param value
- * the value which, when passed to the compareTo method of the examined object, should return zero
- *
- */
- @Factory
- public static compareTo method of the
- * examined object.
- *
- * For example:
- * assertThat(2, greaterThan(1))
- *
- * @param value
- * the value which, when passed to the compareTo method of the examined object, should return greater
- * than zero
- *
- */
- @Factory
- public static compareTo method
- * of the examined object.
- *
- * For example:
- * assertThat(1, greaterThanOrEqualTo(1))
- *
- * @param value
- * the value which, when passed to the compareTo method of the examined object, should return greater
- * than or equal to zero
- *
- */
- @Factory
- public static compareTo method of the
- * examined object.
- *
- * For example:
- * assertThat(1, lessThan(2))
- *
- * @param value
- * the value which, when passed to the compareTo method of the examined object, should return less
- * than zero
- *
- */
- @Factory
- public static compareTo method
- * of the examined object.
- *
- * For example:
- * assertThat(1, lessThanOrEqualTo(1))
- *
- * @param value
- * the value which, when passed to the compareTo method of the examined object, should return less
- * than or equal to zero
- *
- */
- @Factory
- public static