| Modifier and Type | Method and Description |
|---|---|
static org.hamcrest.Matcher<Element> |
anElement(org.hamcrest.Matcher<? super Element>... elementMatchers)
Combines a group of matchers for matching an
Element. |
static org.hamcrest.Matcher<Element> |
hasAttribute(String name)
Checks for the presence of the specified attribute on an
Element. |
static org.hamcrest.Matcher<Element> |
hasAttribute(String name,
org.hamcrest.Matcher<? super String> valueMatcher)
Checks that an
Element has an attribute whose value matches the specified matcher. |
static org.hamcrest.Matcher<Element> |
hasAttribute(String name,
String value)
Checks that an
Element has an attribute with the specified value. |
static org.hamcrest.Matcher<Element> |
hasBlankText()
Checks that an
Element content contains only blank characters. |
static org.hamcrest.Matcher<Element> |
hasChild(org.hamcrest.Matcher<? super Element> childMatcher)
Checks that at least one child of an
Element is matched against
the given matcher. |
static org.hamcrest.Matcher<Element> |
hasChildren(org.hamcrest.Matcher<? super Element>... childrenMatchers)
Checks that children of an
Element match in order the specified matchers. |
static org.hamcrest.Matcher<Element> |
hasChildren(org.hamcrest.Matcher<Iterable<Element>> childrenMatcher)
Checks that children of an
Element match in order the specified matchers. |
static org.hamcrest.Matcher<Element> |
hasClassName(String className)
Checks that an
Element has the specified CSS class. |
static org.hamcrest.Matcher<Element> |
hasId(String id)
Checks that an
Element has an id attribute with the specified value. |
static org.hamcrest.Matcher<Element> |
hasName(String name)
Checks that an
Element has the specified name attribute. |
static org.hamcrest.Matcher<Element> |
hasNoSelector(String selector)
Checks that an
Element is not matched by the specified CSS3 selector expression. |
static org.hamcrest.Matcher<Element> |
hasSelector(String selector,
org.hamcrest.Matcher<? super Element>... subjectsMatchers)
Checks that an
Element matches a CSS3 selector with the specified matchers matching the subjects of the
selector in any order. |
static org.hamcrest.Matcher<Element> |
hasSelector(String selector,
org.hamcrest.Matcher<Iterable<Element>> subjectsMatcher)
Checks that an
Element matches a CSS3 selector with the specified matchers matching the subjects of the selector. |
static org.hamcrest.Matcher<Iterable<Element>> |
hasSize(int size)
Checks that a collection of
Elementa is of a specified size. |
static org.hamcrest.Matcher<Element> |
hasTag(String tagName)
Checks that an
Element has the specified tag. |
static org.hamcrest.Matcher<Element> |
hasText(org.hamcrest.Matcher<? super String> contentMatcher)
Checks that an
Element content text matches the specified matcher. |
static org.hamcrest.Matcher<Element> |
hasText(String contentText)
Checks that an
Element content is equal to the specified text. |
static org.hamcrest.Matcher<Element> |
hasUniqueSelector(String selector)
Checks that an
Element matches a CSS3 selector and that the selector represents a single
child element. |
static org.hamcrest.Matcher<Element> |
hasUniqueSelector(String selector,
org.hamcrest.Matcher<? super Element>... subjectMatchers)
Checks that an
Element matches a CSS3 selector and that the single element represented by the selector
is matched by all specified matchers. |
static org.hamcrest.Matcher<Element> |
hasUniqueSelector(String selector,
org.hamcrest.Matcher<? super Element> subjectMatcher)
Checks that an
Element matches a CSS3 selector with the specified matcher matching the only
subject of the selector. |
static org.hamcrest.Matcher<Iterable<Element>> |
includes(org.hamcrest.Matcher<? super Element>... elementsMatchers)
Checks that a collection of
Elements contains, in any order, at least one matched element for
each specified matcher. |
static org.hamcrest.Matcher<Iterable<Element>> |
matches(List<org.hamcrest.Matcher<? super Element>> elementsMatcher)
Checks that a collection contains
Elements that are matched in order
by the specified list of matchers. |
static org.hamcrest.Matcher<Iterable<Element>> |
matches(org.hamcrest.Matcher<? super Element>... elementsMatchers)
Checks that a collection contains
Elements that are matched in order by the specified matchers. |
static org.hamcrest.Matcher<Iterable<Element>> |
matchesInAnyOrder(List<org.hamcrest.Matcher<? super Element>> elementsMatcher)
Checks that a collection contains
Elements that are matched
in any order by the specified list of matchers. |
static org.hamcrest.Matcher<Iterable<Element>> |
matchesInAnyOrder(org.hamcrest.Matcher<? super Element>... elementsMatchers)
Checks that a collection contains
Elements that are matched
in any order by the specified matchers. |
public static org.hamcrest.Matcher<Element> hasSelector(String selector, org.hamcrest.Matcher<? super Element>... subjectsMatchers)
Element matches a CSS3 selector with the specified matchers matching the subjects of the
selector in any order. This is equivalent to hasSelector(selector, hasItems(subjectsMatchers)).selector - the CSS3 selector expression to match against the elementsubjectsMatchers - matchers to match the elements represented by the selectorpublic static org.hamcrest.Matcher<Element> hasSelector(String selector, org.hamcrest.Matcher<Iterable<Element>> subjectsMatcher)
Element matches a CSS3 selector with the specified matchers matching the subjects of the selector.selector - the CSS3 selector expression to match against the elementsubjectsMatcher - matchers to match the elements represented by the selectorpublic static org.hamcrest.Matcher<Iterable<Element>> hasSize(int size)
Elementa is of a specified size.size - the expected number of elementspublic static org.hamcrest.Matcher<Element> hasUniqueSelector(String selector)
Element matches a CSS3 selector and that the selector represents a single
child element.selector - the CSS3 selector expression to match against the elementpublic static org.hamcrest.Matcher<Element> hasUniqueSelector(String selector, org.hamcrest.Matcher<? super Element> subjectMatcher)
Element matches a CSS3 selector with the specified matcher matching the only
subject of the selector.selector - the CSS3 selector expression to match against the elementsubjectMatcher - the matcher to match the single element represented by the selectorpublic static org.hamcrest.Matcher<Element> hasUniqueSelector(String selector, org.hamcrest.Matcher<? super Element>... subjectMatchers)
Element matches a CSS3 selector and that the single element represented by the selector
is matched by all specified matchers.
This is a equivalent to hasUniqueSelector(selector, anElement(subjectMatchers)).selector - the CSS3 selector expression to match against the elementsubjectMatchers - the matchers to match the single element represented by the selectorpublic static org.hamcrest.Matcher<Element> hasNoSelector(String selector)
Element is not matched by the specified CSS3 selector expression.selector - the CSS3 selector expressionpublic static org.hamcrest.Matcher<Iterable<Element>> matches(org.hamcrest.Matcher<? super Element>... elementsMatchers)
Elements that are matched in order by the specified matchers.
Each element in the collection must be matched and each specified matcher must match an element. Matching occurs in order, so the first element in the collection is matched against the first specified matcher, the second element is matched by second matcher argument, and so on.
elementsMatchers - the matchers to match the collection of Elementsmatches(java.util.List)public static org.hamcrest.Matcher<Iterable<Element>> matches(List<org.hamcrest.Matcher<? super Element>> elementsMatcher)
Checks that a collection contains Elements that are matched in order
by the specified list of matchers.
Each element in the collection must be matched and each specified matcher must match an element. Matching occurs in order, so the first element in the collection is matched against the first matcher in the list, the second element is matched by second matcher, and so on.
Note: As of hamcrest 1.3, the hasItems family of matchers return Matcher<Iterable<? extends T>>
whereas the contains family of matchers return Iterable<Matcher<T>>.
Unfortunately, this makes them impossible to combine as arguments to
hasSelector(String, org.hamcrest.Matcher) without this method.
elementsMatcher - the list fo matchers to match the collection of Elementspublic static org.hamcrest.Matcher<Iterable<Element>> matchesInAnyOrder(org.hamcrest.Matcher<? super Element>... elementsMatchers)
Elements that are matched
in any order by the specified matchers.
Each element in the collection must be matched and each specified matcher must match an element. Matching can occur in any order.
elementsMatchers - the matchers to match the collection of ElementsmatchesInAnyOrder(java.util.List)public static org.hamcrest.Matcher<Iterable<Element>> matchesInAnyOrder(List<org.hamcrest.Matcher<? super Element>> elementsMatcher)
Elements that are matched
in any order by the specified list of matchers.
Each element in the collection must be matched and each specified matcher must match an element. Matching can occur in any order.
Note: As of hamcrest 1.3, the hasItems family of matchers return Matcher<Iterable<? extends T>>
whereas the contains family of matchers return Iterable<Matcher<T>>.
Unfortunately, this makes them impossible to combine as arguments to
hasSelector(String, org.hamcrest.Matcher) without this method.
elementsMatcher - the list fo matchers to match the collection of Elementspublic static org.hamcrest.Matcher<Iterable<Element>> includes(org.hamcrest.Matcher<? super Element>... elementsMatchers)
Elements contains, in any order, at least one matched element for
each specified matcher.elementsMatchers - matchers to match Elements in the collectionpublic static org.hamcrest.Matcher<Element> hasTag(String tagName)
Element has the specified tag.public static org.hamcrest.Matcher<Element> hasText(String contentText)
Element content is equal to the specified text.public static org.hamcrest.Matcher<Element> hasText(org.hamcrest.Matcher<? super String> contentMatcher)
Element content text matches the specified matcher.public static org.hamcrest.Matcher<Element> hasBlankText()
Element content contains only blank characters.public static org.hamcrest.Matcher<Element> hasAttribute(String name)
Element.name - the name of the attributepublic static org.hamcrest.Matcher<Element> hasAttribute(String name, String value)
Element has an attribute with the specified value.name - the name of the attributevalue - the expected value of the attributepublic static org.hamcrest.Matcher<Element> hasAttribute(String name, org.hamcrest.Matcher<? super String> valueMatcher)
Element has an attribute whose value matches the specified matcher.name - the name of the attribute to matchvalueMatcher - matcher for matching the attribute's value.public static org.hamcrest.Matcher<Element> hasName(String name)
Element has the specified name attribute.name - the value of the name attributepublic static org.hamcrest.Matcher<Element> hasId(String id)
Element has an id attribute with the specified value.id - the expected value of the id attributepublic static org.hamcrest.Matcher<Element> hasClassName(String className)
Element has the specified CSS class.
Note that the element can have other classes as well.className - the expected class the elementpublic static org.hamcrest.Matcher<Element> hasChildren(org.hamcrest.Matcher<? super Element>... childrenMatchers)
Element match in order the specified matchers.
The number of matchers must be the same as the number of children.
Matching occurs in order, so the first child is matched against the first matcher, the second child against second matcher, and so on.
public static org.hamcrest.Matcher<Element> hasChildren(org.hamcrest.Matcher<Iterable<Element>> childrenMatcher)
Element match in order the specified matchers.
The number of matchers must be the same as the number of children.
Matching occurs in order, so the first child is matched against the first matcher, the second child against second matcher, and so on.
public static org.hamcrest.Matcher<Element> hasChild(org.hamcrest.Matcher<? super Element> childMatcher)
Element is matched against
the given matcher.Copyright © 2015. All Rights Reserved.