From dbebced54f4779c15d5da548e1d589d262b67170 Mon Sep 17 00:00:00 2001 From: Nat Pryce Date: Tue, 25 Nov 2014 00:41:27 +0000 Subject: [PATCH] Issue #75 - Addressed doclint errors that break the build in JDK 1.8. --- build.xml | 1 - .../src/main/java/org/hamcrest/Matcher.java | 15 ++++++++---- .../main/java/org/hamcrest/CustomMatcher.java | 2 +- .../main/java/org/hamcrest/core/AllOf.java | 7 ------ .../main/java/org/hamcrest/core/AnyOf.java | 7 ------ .../org/hamcrest/core/CombinableMatcher.java | 4 +--- .../java/org/hamcrest/core/DescribedAs.java | 1 - .../main/java/org/hamcrest/core/Every.java | 1 - .../src/main/java/org/hamcrest/core/Is.java | 3 --- .../hamcrest/core/IsCollectionContaining.java | 4 ---- .../main/java/org/hamcrest/core/IsEqual.java | 1 - .../java/org/hamcrest/core/IsInstanceOf.java | 6 ++--- .../main/java/org/hamcrest/core/IsNot.java | 2 -- .../main/java/org/hamcrest/core/IsNull.java | 4 ---- .../org/hamcrest/core/StringContains.java | 2 -- .../org/hamcrest/core/StringEndsWith.java | 2 -- .../org/hamcrest/core/StringStartsWith.java | 6 +++-- .../org/hamcrest/internal/NullSafety.java | 18 ++++++++++++++ .../org/hamcrest/generator/FactoryMethod.java | 5 ++-- .../org/hamcrest/generator/FactoryWriter.java | 5 ++-- .../hamcrest/generator/QDoxFactoryReader.java | 16 ++++++------- .../hamcrest/generator/SugarGenerator.java | 4 ++-- .../java/org/hamcrest/beans/HasProperty.java | 1 - .../hamcrest/beans/HasPropertyWithValue.java | 14 +++++------ .../java/org/hamcrest/beans/PropertyUtil.java | 1 - .../hamcrest/beans/SamePropertyValuesAs.java | 1 - .../java/org/hamcrest/collection/IsArray.java | 1 - .../collection/IsArrayContaining.java | 2 -- .../IsArrayContainingInAnyOrder.java | 20 ++++++++++++---- .../collection/IsArrayContainingInOrder.java | 18 ++++---------- .../hamcrest/collection/IsArrayWithSize.java | 3 --- .../collection/IsCollectionWithSize.java | 2 -- .../collection/IsEmptyCollection.java | 2 -- .../hamcrest/collection/IsEmptyIterable.java | 2 -- .../java/org/hamcrest/collection/IsIn.java | 6 ----- .../IsIterableContainingInAnyOrder.java | 24 +++++++++++++------ .../IsIterableContainingInOrder.java | 19 ++++----------- .../collection/IsIterableWithSize.java | 2 -- .../hamcrest/collection/IsMapContaining.java | 6 ----- .../hamcrest/collection/IsMapWithSize.java | 3 --- .../comparator/ComparatorMatcherBuilder.java | 21 ++++++---------- .../hamcrest/number/BigDecimalCloseTo.java | 1 - .../java/org/hamcrest/number/IsCloseTo.java | 1 - .../main/java/org/hamcrest/number/IsNaN.java | 1 - .../hamcrest/number/OrderingComparison.java | 5 ---- .../java/org/hamcrest/object/HasToString.java | 2 -- .../org/hamcrest/object/IsCompatibleType.java | 1 - .../java/org/hamcrest/object/IsEventFrom.java | 2 -- .../java/org/hamcrest/text/IsBlankString.java | 2 -- .../java/org/hamcrest/text/IsEmptyString.java | 4 ---- .../hamcrest/text/IsEqualIgnoringCase.java | 1 - .../text/IsEqualIgnoringWhiteSpace.java | 1 - .../org/hamcrest/text/MatchesPattern.java | 8 +++---- .../hamcrest/text/StringContainsInOrder.java | 2 -- .../main/java/org/hamcrest/xml/HasXPath.java | 4 ---- 55 files changed, 111 insertions(+), 188 deletions(-) create mode 100644 hamcrest-core/src/main/java/org/hamcrest/internal/NullSafety.java diff --git a/build.xml b/build.xml index 02b6189a..5e4a3068 100644 --- a/build.xml +++ b/build.xml @@ -255,7 +255,6 @@ destdir="build/temp/@{modulename}-${version}-javadoc.jar.contents" author="true" version="true" use="true" windowtitle="Hamcrest" source="${javaversion}" failonerror="yes" defaultexcludes="yes"> - diff --git a/hamcrest-api/src/main/java/org/hamcrest/Matcher.java b/hamcrest-api/src/main/java/org/hamcrest/Matcher.java index c9929730..de1041c3 100644 --- a/hamcrest-api/src/main/java/org/hamcrest/Matcher.java +++ b/hamcrest-api/src/main/java/org/hamcrest/Matcher.java @@ -3,19 +3,24 @@ package org.hamcrest; /** + *

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

+ *

+ *

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

+ *

+ *

* For easy access to common Matcher implementations, use the static factory * methods in {@link CoreMatchers}. - *

+ *

+ *

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

+ * * @see CoreMatchers * @see BaseMatcher */ @@ -23,7 +28,7 @@ public interface Matcher extends SelfDescribing { /** * Evaluates the matcher for argument item. - *

+ * * This method matches against Object, instead of the generic type T. This is * because the caller of the Matcher does not know at runtime what the type is * (because of type erasure with Java generics). It is down to the implementations diff --git a/hamcrest-core/src/main/java/org/hamcrest/CustomMatcher.java b/hamcrest-core/src/main/java/org/hamcrest/CustomMatcher.java index bac02d78..036a7640 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/CustomMatcher.java +++ b/hamcrest-core/src/main/java/org/hamcrest/CustomMatcher.java @@ -6,7 +6,7 @@ *

  * Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
  *   public boolean matches(Object object) {
- *     return ((object instanceof String) && !((String) object).isEmpty();
+ *     return ((object instanceof String) && !((String) object).isEmpty();
  *   }
  * };
  * 
diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java b/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java index a5daf943..55c37129 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java @@ -40,7 +40,6 @@ public void describeTo(Description description) { /** * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

* For example: *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/ @@ -51,7 +50,6 @@ public static Matcher allOf(Iterable> matchers) { /** * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

* For example: *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/ @@ -62,7 +60,6 @@ public static Matcher allOf(Matcher... matchers) { /** * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

* For example: *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/ @@ -76,7 +73,6 @@ public static Matcher allOf(Matcher first, Matcher /** * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

* For example: *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/ @@ -91,7 +87,6 @@ public static Matcher allOf(Matcher first, Matcher /** * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

* For example: *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/ @@ -107,7 +102,6 @@ public static Matcher allOf(Matcher first, Matcher /** * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

* For example: *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/ @@ -124,7 +118,6 @@ public static Matcher allOf(Matcher first, Matcher /** * Creates a matcher that matches if the examined object matches ALL of the specified matchers. - *

* For example: *

assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/ diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java index de006776..f6652290 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java @@ -30,7 +30,6 @@ public void describeTo(Description description) { /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

* For example: *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/ @@ -41,7 +40,6 @@ public static AnyOf anyOf(Iterable> matchers) { /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

* For example: *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/ @@ -52,7 +50,6 @@ public static AnyOf anyOf(Matcher... matchers) { /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

* For example: *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/ @@ -66,7 +63,6 @@ public static AnyOf anyOf(Matcher first, Matcher second) { /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

* For example: *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/ @@ -81,7 +77,6 @@ public static AnyOf anyOf(Matcher first, Matcher second, Ma /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

* For example: *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/ @@ -97,7 +92,6 @@ public static AnyOf anyOf(Matcher first, Matcher second, Ma /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

* For example: *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/ @@ -114,7 +108,6 @@ public static AnyOf anyOf(Matcher first, Matcher second, Ma /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. - *

* For example: *

assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/ diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest-core/src/main/java/org/hamcrest/core/CombinableMatcher.java index 8d4e6f30..e3bcbd8c 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/CombinableMatcher.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/CombinableMatcher.java @@ -42,7 +42,6 @@ private ArrayList> templatedListWith(Matcher other /** * Creates a matcher that matches when both of the specified matchers match the examined object. - *

* For example: *

assertThat("fab", both(containsString("a")).and(containsString("b")))
*/ @@ -63,7 +62,6 @@ public CombinableMatcher and(Matcher other) { /** * Creates a matcher that matches when either of the specified matchers match the examined object. - *

* For example: *

assertThat("fan", either(containsString("a")).or(containsString("b")))
*/ @@ -81,4 +79,4 @@ public CombinableMatcher or(Matcher other) { return new CombinableMatcher(first).or(other); } } -} \ No newline at end of file +} diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java b/hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java index 3e779b43..ebe8f999 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/DescribedAs.java @@ -56,7 +56,6 @@ public void describeMismatch(Object item, Description description) { /** * Wraps an existing matcher, overriding its description with that specified. All other functions are * delegated to the decorated matcher, including its mismatch description. - *

* For example: *

describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
* diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/Every.java b/hamcrest-core/src/main/java/org/hamcrest/core/Every.java index f6e0fbac..45503b0d 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/Every.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/Every.java @@ -33,7 +33,6 @@ public void describeTo(Description description) { * Creates a matcher for {@link Iterable}s that only matches when a single pass over the * examined {@link Iterable} yields items that are all matched by the specified * itemMatcher. - *

* For example: *

assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
* diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/Is.java b/hamcrest-core/src/main/java/org/hamcrest/core/Is.java index d0aaa966..2dfec24d 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/Is.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/Is.java @@ -40,7 +40,6 @@ public void describeMismatch(Object item, Description mismatchDescription) { /** * Decorates another Matcher, retaining its behaviour, but allowing tests * to be slightly more expressive. - *

* For example: *

assertThat(cheese, is(equalTo(smelly)))
* instead of: @@ -54,7 +53,6 @@ public static Matcher is(Matcher matcher) { /** * A shortcut to the frequently used is(equalTo(x)). - *

* For example: *

assertThat(cheese, is(smelly))
* instead of: @@ -68,7 +66,6 @@ public static Matcher is(T value) { /** * A shortcut to the frequently used is(instanceOf(SomeClass.class)). - *

* For example: *

assertThat(cheese, isA(Cheddar.class))
* instead of: diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest-core/src/main/java/org/hamcrest/core/IsCollectionContaining.java index 1f9ba4fa..e4bf6170 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsCollectionContaining.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/IsCollectionContaining.java @@ -61,7 +61,6 @@ public void describeTo(Description description) { * examined {@link Iterable} yields at least one item that is matched by the specified * itemMatcher. Whilst matching, the traversal of the examined {@link Iterable} * will stop as soon as a matching item is found. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
* @@ -78,7 +77,6 @@ public static Matcher> hasItem(Matcher itemMa * examined {@link Iterable} yields at least one item that is equal to the specified * item. Whilst matching, the traversal of the examined {@link Iterable} * will stop as soon as a matching item is found. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
* @@ -96,7 +94,6 @@ public static Matcher> hasItem(T item) { * examined {@link Iterable} yield at least one item that is matched by the corresponding * matcher from the specified itemMatchers. Whilst matching, each traversal of * the examined {@link Iterable} will stop as soon as a matching item is found. - *

* For example: *

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
* @@ -120,7 +117,6 @@ public static Matcher> hasItems(Matcher... itemMatche * examined {@link Iterable} yield at least one item that is equal to the corresponding * item from the specified items. Whilst matching, each traversal of the * examined {@link Iterable} will stop as soon as a matching item is found. - *

* For example: *

assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
* diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java b/hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java index 1ddc9a3a..84060097 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java @@ -79,7 +79,6 @@ private static boolean isArray(Object o) { * it will match if both the operand and the examined object are arrays of the same length and * contain items that are equal to each other (according to the above rules) in the same * indexes.

- *

* For example: *

      * assertThat("foo", equalTo("foo"));
diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java b/hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java
index a1fdf368..14eab599 100644
--- a/hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java
+++ b/hamcrest-core/src/main/java/org/hamcrest/core/IsInstanceOf.java
@@ -65,8 +65,7 @@ public void describeTo(Description description) {
      * the examined object.
      * 
      * 

The created matcher assumes no relationship between specified type and the examined object.

- *

- * For example: + * For example: *

assertThat(new Canoe(), instanceOf(Paddlable.class));
* */ @@ -84,8 +83,7 @@ public static Matcher instanceOf(Class type) { *

The created matcher forces a relationship between specified type and the examined object, and should be * used when it is necessary to make generics conform, for example in the JMock clause * with(any(Thing.class))

- *

- * For example: + * For example: *

assertThat(new Canoe(), instanceOf(Canoe.class));
* */ diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest-core/src/main/java/org/hamcrest/core/IsNot.java index 39d19892..a8995dab 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsNot.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/IsNot.java @@ -34,7 +34,6 @@ public void describeTo(Description description) { /** * Creates a matcher that wraps an existing matcher, but inverts the logic by which * it will match. - *

* For example: *

assertThat(cheese, is(not(equalTo(smelly))))
* @@ -48,7 +47,6 @@ public static Matcher not(Matcher matcher) { /** * A shortcut to the frequently used not(equalTo(x)). - *

* For example: *

assertThat(cheese, is(not(smelly)))
* instead of: diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/IsNull.java b/hamcrest-core/src/main/java/org/hamcrest/core/IsNull.java index 6666ef90..8c7ace8f 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/IsNull.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/IsNull.java @@ -24,7 +24,6 @@ public void describeTo(Description description) { /** * Creates a matcher that matches if examined object is null. - *

* For example: *

assertThat(cheese, is(nullValue())
* @@ -36,7 +35,6 @@ public static Matcher nullValue() { /** * A shortcut to the frequently used not(nullValue()). - *

* For example: *

assertThat(cheese, is(notNullValue()))
* instead of: @@ -51,7 +49,6 @@ public static Matcher notNullValue() { /** * Creates a matcher that matches if examined object is null. Accepts a * single dummy argument to facilitate type inference. - *

* For example: *

assertThat(cheese, is(nullValue(Cheese.class))
* @@ -66,7 +63,6 @@ public static Matcher nullValue(Class type) { /** * A shortcut to the frequently used not(nullValue(X.class)). Accepts a * single dummy argument to facilitate type inference.. - *

* For example: *

assertThat(cheese, is(notNullValue(X.class)))
* instead of: diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/StringContains.java b/hamcrest-core/src/main/java/org/hamcrest/core/StringContains.java index 70c3ba03..97a5cc36 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/StringContains.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/StringContains.java @@ -21,7 +21,6 @@ protected boolean evalSubstringOf(String s) { /** * Creates a matcher that matches if the examined {@link String} contains the specified * {@link String} anywhere. - *

* For example: *

assertThat("myStringOfNote", containsString("ring"))
* @@ -37,7 +36,6 @@ public static Matcher containsString(String substring) { /** * Creates a matcher that matches if the examined {@link String} contains the specified * {@link String} anywhere, ignoring case. - *

* For example: *

assertThat("myStringOfNote", containsString("ring"))
* diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/StringEndsWith.java b/hamcrest-core/src/main/java/org/hamcrest/core/StringEndsWith.java index a28eaae6..8c65af95 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/StringEndsWith.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/StringEndsWith.java @@ -19,7 +19,6 @@ protected boolean evalSubstringOf(String s) { /** * Creates a matcher that matches if the examined {@link String} ends with the specified * {@link String}. - *

* For example: *

assertThat("myStringOfNote", endsWith("Note"))
* @@ -34,7 +33,6 @@ public static Matcher endsWith(String suffix) { /** * Creates a matcher that matches if the examined {@link String} ends with the specified * {@link String}, ignoring case. - *

* For example: *

assertThat("myStringOfNote", endsWith("Note"))
* diff --git a/hamcrest-core/src/main/java/org/hamcrest/core/StringStartsWith.java b/hamcrest-core/src/main/java/org/hamcrest/core/StringStartsWith.java index 79c89ae9..6de07f37 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/core/StringStartsWith.java +++ b/hamcrest-core/src/main/java/org/hamcrest/core/StringStartsWith.java @@ -15,9 +15,10 @@ public class StringStartsWith extends SubstringMatcher { protected boolean evalSubstringOf(String s) { return converted(s).startsWith(converted(substring)); } /** + *

* Creates a matcher that matches if the examined {@link String} starts with the specified * {@link String}. - *

+ *

* For example: *
assertThat("myStringOfNote", startsWith("my"))
* @@ -28,9 +29,10 @@ public class StringStartsWith extends SubstringMatcher { public static Matcher startsWith(String prefix) { return new StringStartsWith(false, prefix); } /** + *

* Creates a matcher that matches if the examined {@link String} starts with the specified * {@link String}, ignoring case - *

+ *

* For example: *
assertThat("myStringOfNote", startsWith("my"))
* diff --git a/hamcrest-core/src/main/java/org/hamcrest/internal/NullSafety.java b/hamcrest-core/src/main/java/org/hamcrest/internal/NullSafety.java new file mode 100644 index 00000000..9310abfc --- /dev/null +++ b/hamcrest-core/src/main/java/org/hamcrest/internal/NullSafety.java @@ -0,0 +1,18 @@ +package org.hamcrest.internal; + +import org.hamcrest.Matcher; +import org.hamcrest.core.IsNull; + +import java.util.ArrayList; +import java.util.List; + +public class NullSafety { + @SuppressWarnings("unchecked") + public static List> nullSafe(Matcher[] itemMatchers) { + final List> matchers = new ArrayList>(itemMatchers.length); + for (final Matcher itemMatcher : itemMatchers) { + matchers.add((Matcher) (itemMatcher == null ? IsNull.nullValue() : itemMatcher)); + } + return matchers; + } +} diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryMethod.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryMethod.java index 915c66b7..d1a2c36e 100644 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryMethod.java +++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryMethod.java @@ -6,8 +6,7 @@ /** * Represents a Matcher Factory method. - *

- *

This class uses Strings to represent things instead of java.lang.reflect equivalents, + * 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. * @@ -72,7 +71,7 @@ public void addParameter(String type, String name) { /** * List of Parameters passed to factory method. - * ie. 'public Matcher<...&ht;> blah(THIS, AND, THAT)' + * ie. 'public Matcher<...> blah(THIS, AND, THAT)' */ public List getParameters() { return unmodifiableList(parameters); diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryWriter.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryWriter.java index d181288d..879abfcb 100644 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryWriter.java +++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/FactoryWriter.java @@ -6,13 +6,14 @@ /** * Writes syntactic sugar code for factories. - *

Implementations of this could include vanilla factory methods for + * Implementations of this could include vanilla factory methods for * Hamcrest matchers, wrapped factories for other libraries or factories * in other languages (jython, jruby, groovy, etc). + * *

Usage:

*
  * writer.writeHeader(...);
- * 

+ * * writer.writeMethod(...); * writer.writeMethod(...); * writer.writeMethod(...); diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java index 7c2ce322..53f99c6a 100644 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java +++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java @@ -89,14 +89,14 @@ public Iterator iterator() { } /** - * Determine whether a particular method is classified as a matcher factory method. - *

- *

The rules for determining this are: - * 1. The method must be public static. - * 2. It must have a return type of org.hamcrest.Matcher (or something that extends this). - * 3. It must be marked with the org.hamcrest.Factory annotation. - *

- *

To use another set of rules, override this method. + *

Determine whether a particular method is classified as a matcher factory method.

+ *

The rules for determining this are:

+ *
    + *
  1. The method must be public static.
  2. + *
  3. It must have a return type of org.hamcrest.Matcher (or something that extends this).
  4. + *
  5. It must be marked with the org.hamcrest.Factory annotation.
  6. + *
+ *

To use another set of rules, override this method.

*/ protected boolean isFactoryMethod(JavaMethod javaMethod) { return javaMethod.isStatic() diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarGenerator.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarGenerator.java index 01414a6c..1f9d6f79 100644 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarGenerator.java +++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/SugarGenerator.java @@ -41,7 +41,6 @@ * @author Joe Walnes * @see FactoryWriter * @see HamcrestFactoryWriter - * @see ReflectiveFactoryReader */ public class SugarGenerator implements Closeable, SugarConfiguration { @@ -59,7 +58,6 @@ public void addWriter(FactoryWriter factoryWriter) { /** * Add a FactoryMethod that will be generated in the sugar. * - * @see ReflectiveFactoryReader * @see FactoryMethod */ @Override @@ -83,6 +81,8 @@ public void addFactoryMethods(Iterable methods) { * Generate all the factory methods using all the writers. * * This should always happen AFTER adding factory methods and writers. + * + * @throws java.io.IOException from the underlying stream used to write the generated code */ public void generate() throws IOException { for (FactoryWriter factoryWriter : factoryWriters) { diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/HasProperty.java b/hamcrest-library/src/main/java/org/hamcrest/beans/HasProperty.java index 4fc3059b..e7dbac48 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/HasProperty.java +++ b/hamcrest-library/src/main/java/org/hamcrest/beans/HasProperty.java @@ -46,7 +46,6 @@ public void describeTo(Description description) { /** * Creates a matcher that matches when the examined object has a JavaBean property * with the specified name. - *

* For example: *

assertThat(myBean, hasProperty("foo"))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java b/hamcrest-library/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java index 5d1958f4..42e202cf 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java +++ b/hamcrest-library/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java @@ -16,11 +16,12 @@ import static org.hamcrest.beans.PropertyUtil.NO_ARGUMENTS; /** - * Matcher that asserts that a JavaBean property on an argument passed to the + *

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

+ *

+ * *

Example Usage

* Consider the situation where we have a class representing a person, which * follows the basic JavaBean convention of having get() and possibly set() @@ -51,16 +52,16 @@ * personGenListenerMock.expects(once()).method("personGenerated").with(and(isA(Person.class), hasProperty("Name", eq("Iain"))); * PersonGenerationListener listener = (PersonGenerationListener)personGenListenerMock.proxy();
* - * If an exception is thrown by the getter method for a property, the property + *

If an exception is thrown by the getter method for a property, the property * does not exist, is not readable, or a reflection related exception is thrown * when trying to invoke it then this is treated as an evaluation failure and * the matches method will return false. - *

- * This matcher class will also work with JavaBean objects that have explicit + *

+ *

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

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

* * @author Iain McGinniss * @author Nat Pryce @@ -136,7 +137,6 @@ public Condition apply(PropertyDescriptor property, Description mismatch /** * Creates a matcher that matches when the examined object has a JavaBean property * with the specified name whose value satisfies the specified matcher. - *

* For example: *

assertThat(myBean, hasProperty("foo", equalTo("bar"))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/PropertyUtil.java b/hamcrest-library/src/main/java/org/hamcrest/beans/PropertyUtil.java index 3dd12e8c..8029dbbb 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/PropertyUtil.java +++ b/hamcrest-library/src/main/java/org/hamcrest/beans/PropertyUtil.java @@ -8,7 +8,6 @@ /** * Utility class for accessing properties on JavaBean objects. - *

* See http://java.sun.com/products/javabeans/docs/index.html for * more information on JavaBeans. * diff --git a/hamcrest-library/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java b/hamcrest-library/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java index bade84c4..c82fd696 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java +++ b/hamcrest-library/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java @@ -124,7 +124,6 @@ private static Object readProperty(Method method, Object target) { * Creates a matcher that matches when the examined object has values for all of * its JavaBean properties that are equal to the corresponding values of the * specified bean. - *

* For example: *

assertThat(myBean, samePropertyValuesAs(myExpectedBean))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java index 0e7eeddc..e0e27ec6 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java @@ -84,7 +84,6 @@ protected String descriptionEnd() { * Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. Matches * positively only if the number of matchers specified is equal to the length of the examined array and * each matcher[i] is satisfied by array[i]. - *

* For example: *

assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContaining.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContaining.java index ee17b410..fc61d9c5 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContaining.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContaining.java @@ -44,7 +44,6 @@ public void describeTo(Description description) { * Creates a matcher for arrays that matches when the examined array contains at least one item * that is matched by the specified elementMatcher. Whilst matching, the traversal * of the examined array will stop as soon as a matching element is found. - *

* For example: *

assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
* @@ -58,7 +57,6 @@ public static Matcher hasItemInArray(Matcher elementMatcher) /** * A shortcut to the frequently used hasItemInArray(equalTo(x)). - *

* For example: *

assertThat(hasItemInArray(x))
* instead of: diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index d4e01f00..07224405 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -38,16 +38,20 @@ public void describeTo(Description description) { } /** + *

* Creates an order agnostic matcher for arrays that matches when each item in the * examined array satisfies one matcher anywhere in the specified matchers. * For a positive match, the examined array must be of the same length as the number of * specified matchers. - *

+ *

+ *

* N.B. each of the specified matchers will only be used once during a given examination, so be * careful when specifying matchers that may be satisfied by more than one entry in an examined * array. + *

*

* For example: + *

*
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
* * @param itemMatchers @@ -59,16 +63,20 @@ public static Matcher arrayContainingInAnyOrder(Matcher... i } /** + *

* Creates an order agnostic matcher for arrays that matches when each item in the * examined array satisfies one matcher anywhere in the specified collection of matchers. * For a positive match, the examined array must be of the same length as the specified collection * of matchers. - *

+ *

+ *

* N.B. each matcher in the specified collection will only be used once during a given * examination, so be careful when specifying matchers that may be satisfied by more than * one entry in an examined array. + *

*

* For example: + *

*
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
* * @param itemMatchers @@ -80,16 +88,18 @@ public static Matcher arrayContainingInAnyOrder(CollectionCreates 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 + *

+ *

N.B. each of the specified items will only be used once during a given examination, so be * careful when specifying items that may be equal to more than one entry in an examined * array. + *

*

* For example: + *

*
assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
* * @param items diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index 6611b304..73ad58f2 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -4,7 +4,7 @@ import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; -import org.hamcrest.core.IsNull; +import org.hamcrest.internal.NullSafety; import java.util.ArrayList; import java.util.Collection; @@ -41,7 +41,6 @@ public void describeTo(Description description) { * Creates a matcher for arrays that matches when each item in the examined array is * logically equal to the corresponding item in the specified items. For a positive match, * the examined array must be of the same length as the number of specified items. - *

* For example: *

assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
* @@ -61,7 +60,6 @@ public static Matcher arrayContaining(E... items) { * Creates a matcher for arrays that matches when each item in the examined array satisfies the * corresponding matcher in the specified matchers. For a positive match, the examined array * must be of the same length as the number of specified matchers. - *

* For example: *

assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
* @@ -70,7 +68,10 @@ public static Matcher arrayContaining(E... items) { */ @Factory public static Matcher arrayContaining(Matcher... itemMatchers) { - final List> nullSafeWithExplicitTypeMatchers = nullSafe(itemMatchers); + //required for JDK 1.6 + //noinspection RedundantTypeArguments + final List> nullSafeWithExplicitTypeMatchers = NullSafety.nullSafe(itemMatchers); + return arrayContaining(nullSafeWithExplicitTypeMatchers); } @@ -78,7 +79,6 @@ public static Matcher arrayContaining(Matcher... itemMatcher * Creates a matcher for arrays that matches when each item in the examined array satisfies the * corresponding matcher in the specified list of matchers. For a positive match, the examined array * must be of the same length as the specified list of matchers. - *

* For example: *

assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
* @@ -90,12 +90,4 @@ public static Matcher arrayContaining(List> itemMatc return new IsArrayContainingInOrder(itemMatchers); } - @SuppressWarnings("unchecked") - private static List> nullSafe(Matcher[] itemMatchers) { - final List> matchers = new ArrayList>(itemMatchers.length); - for (final Matcher itemMatcher : itemMatchers) { - matchers.add((Matcher) (itemMatcher == null ? IsNull.nullValue() : itemMatcher)); - } - return matchers; - } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java index 4d78983f..0fa7f50d 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java @@ -23,7 +23,6 @@ protected Integer featureValueOf(E[] actual) { /** * Creates a matcher for arrays that matches when the length of the array * satisfies the specified matcher. - *

* For example: *

assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
* @@ -38,7 +37,6 @@ public static Matcher arrayWithSize(Matcher sizeMatche /** * Creates a matcher for arrays that matches when the length of the array * equals the specified size. - *

* For example: *

assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
* @@ -53,7 +51,6 @@ public static Matcher arrayWithSize(int size) { /** * Creates a matcher for arrays that matches when the length of the array * is zero. - *

* For example: *

assertThat(new String[0], emptyArray())
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java index 7d4b508a..6682dccc 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java @@ -23,7 +23,6 @@ protected Integer featureValueOf(Collection actual) { /** * Creates a matcher for {@link java.util.Collection}s that matches when the size() method returns * a value that satisfies the specified matcher. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
* @@ -38,7 +37,6 @@ public static Matcher> hasSize(Matchersize() method returns * a value equal to the specified size. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), hasSize(2))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java index 4544d9b8..c95ef31c 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java @@ -30,7 +30,6 @@ public void describeTo(Description description) { /** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose isEmpty * method returns true. - *

* For example: *

assertThat(new ArrayList<String>(), is(empty()))
* @@ -43,7 +42,6 @@ public static Matcher> empty() { /** * Creates a matcher for {@link java.util.Collection}s matching examined collections whose isEmpty * method returns true. - *

* For example: *

assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java index 28c41299..133655bd 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java @@ -26,7 +26,6 @@ public void describeTo(Description description) { /** * Creates a matcher for {@link Iterable}s matching examined iterables that yield no items. - *

* For example: *

assertThat(new ArrayList<String>(), is(emptyIterable()))
* @@ -38,7 +37,6 @@ public static Matcher> emptyIterable() { /** * Creates a matcher for {@link Iterable}s matching examined iterables that yield no items. - *

* For example: *

assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIn.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIn.java index 6d465532..5ffda432 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIn.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIn.java @@ -34,7 +34,6 @@ public void describeTo(Description buffer) { /** * Creates a matcher that matches when the examined object is found within the * specified collection. - *

* For example: *

assertThat("foo", isIn(Arrays.asList("bar", "foo")))
* @@ -53,7 +52,6 @@ public static Matcher isIn(Collection collection) { /** * Creates a matcher that matches when the examined object is found within the * specified collection. - *

* For example: *

assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
* @@ -69,7 +67,6 @@ public static Matcher in(Collection collection) { /** * Creates a matcher that matches when the examined object is found within the * specified array. - *

* For example: *

assertThat("foo", isIn(new String[]{"bar", "foo"}))
* @@ -88,7 +85,6 @@ public static Matcher isIn(T[] elements) { /** * Creates a matcher that matches when the examined object is found within the * specified array. - *

* For example: *

assertThat("foo", is(in(new String[]{"bar", "foo"})))
* @@ -104,7 +100,6 @@ public static Matcher in(T[] elements) { /** * Creates a matcher that matches when the examined object is equal to one of the * specified elements. - *

* For example: *

assertThat("foo", isOneOf("bar", "foo"))
* @@ -123,7 +118,6 @@ public static Matcher isOneOf(T... elements) { /** * Creates a matcher that matches when the examined object is equal to one of the * specified elements. - *

* For example: *

assertThat("foo", is(oneOf("bar", "foo")))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index cb6ab78e..16f473a6 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -78,16 +78,20 @@ private boolean isMatched(S item) { } /** + *

* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over * the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere * in the specified matchers. For a positive match, the examined iterable must be of the same * length as the number of specified matchers. - *

+ *

+ *

* N.B. each of the specified matchers will only be used once during a given examination, so be * careful when specifying matchers that may be satisfied by more than one entry in an examined * iterable. - *

+ *

+ *

* For example: + *

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
* * @param itemMatchers @@ -99,16 +103,20 @@ public static Matcher> containsInAnyOrder(Matcher * Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over * the examined {@link Iterable} yields a series of items, each logically equal to one item * anywhere in the specified items. For a positive match, the examined iterable * must be of the same length as the number of specified items. - *

+ *

+ *

* N.B. each of the specified items will only be used once during a given examination, so be * careful when specifying items that may be equal to more than one entry in an examined * iterable. - *

+ *

+ *

* For example: + *

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
* * @param items @@ -125,16 +133,18 @@ public static Matcher> containsInAnyOrder(T... items) } /** + *

* Creates an order agnostic matcher for {@link Iterable}s that matches when a single pass over * the examined {@link Iterable} yields a series of items, each satisfying one matcher anywhere * in the specified collection of matchers. For a positive match, the examined iterable * must be of the same length as the specified collection of matchers. - *

+ *

+ *

* N.B. each matcher in the specified collection will only be used once during a given * examination, so be careful when specifying matchers that may be satisfied by more than * one entry in an examined iterable. - *

- * For example: + *

+ *

For example:

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
* * @param itemMatchers diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java index 164bc914..f14a5a82 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java @@ -5,12 +5,14 @@ import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; import org.hamcrest.core.IsNull; +import org.hamcrest.internal.NullSafety; import java.util.ArrayList; import java.util.List; import static java.util.Arrays.asList; import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.internal.NullSafety.nullSafe; public class IsIterableContainingInOrder extends TypeSafeDiagnosingMatcher> { private final List> matchers; @@ -87,7 +89,6 @@ private void describeMismatch(Matcher matcher, F item) { * examined {@link Iterable} yields a series of items, each logically equal to the * corresponding item in the specified items. For a positive match, the examined iterable * must be of the same length as the number of specified items. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
* @@ -108,7 +109,6 @@ public static Matcher> contains(E... items) { * Creates a matcher for {@link Iterable}s that matches when a single pass over the * examined {@link Iterable} yields a single item that satisfies the specified matcher. * For a positive match, the examined iterable must only yield one item. - *

* For example: *

assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
* @@ -127,7 +127,6 @@ public static Matcher> contains(final Matcher * For example: *
assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
* @@ -136,7 +135,9 @@ public static Matcher> contains(final Matcher Matcher> contains(Matcher... itemMatchers) { - final List> nullSafeWithExplicitTypeMatchers = nullSafe(itemMatchers); + // required for JDK 1.6 + //noinspection RedundantTypeArguments + final List> nullSafeWithExplicitTypeMatchers = NullSafety.nullSafe(itemMatchers); return contains(nullSafeWithExplicitTypeMatchers); } @@ -145,7 +146,6 @@ public static Matcher> contains(Matcher... * examined {@link Iterable} yields a series of items, each satisfying the corresponding * matcher in the specified list of matchers. For a positive match, the examined iterable * must be of the same length as the specified list of matchers. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
* @@ -157,13 +157,4 @@ public static Matcher> contains(Matcher... public static Matcher> contains(List> itemMatchers) { return new IsIterableContainingInOrder(itemMatchers); } - - @SuppressWarnings("unchecked") - private static List> nullSafe(Matcher[] itemMatchers) { - final List> matchers = new ArrayList>(itemMatchers.length); - for (final Matcher itemMatcher : itemMatchers) { - matchers.add((Matcher) (itemMatcher == null ? IsNull.nullValue() : itemMatcher)); - } - return matchers; - } } diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java index 5fbc4bdd..9d4bd717 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java @@ -28,7 +28,6 @@ protected Integer featureValueOf(Iterable actual) { * Creates a matcher for {@link Iterable}s that matches when a single pass over the * examined {@link Iterable} yields an item count that satisfies the specified * matcher. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
* @@ -44,7 +43,6 @@ public static Matcher> iterableWithSize(Matcher * Creates a matcher for {@link Iterable}s that matches when a single pass over the * examined {@link Iterable} yields an item count that is equal to the specified * size argument. - *

* For example: *

assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java index 392c554c..618d3b96 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -48,7 +48,6 @@ public void describeTo(Description description) { * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one entry whose key satisfies the specified keyMatcher and whose * value satisfies the specified valueMatcher. - *

* For example: *

assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
* @@ -66,7 +65,6 @@ public static Matcher> hasEntry(Matcherkey and whose value equals the * specified value. - *

* For example: *

assertThat(myMap, hasEntry("bar", "foo"))
* @@ -83,7 +81,6 @@ public static Matcher> hasEntry(K key, V valu /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one key that satisfies the specified matcher. - *

* For example: *

assertThat(myMap, hasKey(equalTo("bar")))
* @@ -98,7 +95,6 @@ public static Matcher> hasEntry(K key, V valu /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one key that is equal to the specified key. - *

* For example: *

assertThat(myMap, hasKey("bar"))
* @@ -113,7 +109,6 @@ public static Matcher> hasEntry(K key, V valu /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one value that satisfies the specified valueMatcher. - *

* For example: *

assertThat(myMap, hasValue(equalTo("foo")))
* @@ -128,7 +123,6 @@ public static Matcher> hasEntry(K key, V valu /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one value that is equal to the specified value. - *

* For example: *

assertThat(myMap, hasValue("foo"))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapWithSize.java b/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapWithSize.java index 476ff4b0..b4f83758 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapWithSize.java +++ b/hamcrest-library/src/main/java/org/hamcrest/collection/IsMapWithSize.java @@ -24,7 +24,6 @@ protected Integer featureValueOf(Map actual) { /** * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns * a value that satisfies the specified matcher. - *

* For example: *

assertThat(myMap, is(aMapWithSize(equalTo(2))))
* @@ -39,7 +38,6 @@ protected Integer featureValueOf(Map actual) { /** * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns * a value equal to the specified size. - *

* For example: *

assertThat(myMap, is(aMapWithSize(2)))
* @@ -55,7 +53,6 @@ protected Integer featureValueOf(Map actual) { /** * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns * zero. - *

* For example: *

assertThat(myMap, is(anEmptyMap()))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java b/hamcrest-library/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java index 4733b064..0481d50d 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java +++ b/hamcrest-library/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java @@ -16,9 +16,8 @@ public final class ComparatorMatcherBuilder { /** * Creates a matcher factory for matchers of {@code Comparable}s. - *

* For example: - *

assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThanOrEqualTo(1))
+ *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
*/ public static > ComparatorMatcherBuilder usingNaturalOrdering() { return new ComparatorMatcherBuilder(new Comparator() { @@ -31,9 +30,8 @@ public int compare(T o1, T o2) { /** * Creates a matcher factory for matchers of {@code Comparators}s of {@code T}. - *

* For example: - *

assertThat(5, comparedBy(new Comparator() {
+     * 
assertThat(5, comparedBy(new Comparator<Integer>() {
      * public int compare(Integer o1, Integer o2) {
      * return -o1.compareTo(o2);
      * }
@@ -114,9 +112,8 @@ private static String asText(int comparison) {
      * Creates a matcher of {@code T} object that matches when the examined object is
      * equal to the specified value, as reported by the {@code Comparator} used to
      * create this builder.
-     * 

* For example: - *

assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().comparesEqualTo(1))
+ *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().comparesEqualTo(1))
* * @param value the value which, when passed to the Comparator supplied to this builder, should return zero */ @@ -129,9 +126,8 @@ public Matcher comparesEqualTo(T value) { * Creates a matcher of {@code T} object that matches when the examined object is * greater than the specified value, as reported by the {@code Comparator} used to * create this builder. - *

* For example: - *

assertThat(2, ComparatorMatcherBuilder.usingNaturalOrdering().greaterThan(1))
+ *
assertThat(2, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThan(1))
* * @param value the value which, when passed to the Comparator supplied to this builder, should return greater * than zero @@ -145,9 +141,8 @@ public Matcher greaterThan(T value) { * Creates a matcher of {@code T} object that matches when the examined object is * greater than or equal to the specified value, as reported by the {@code Comparator} used to * create this builder. - *

* For example: - *

assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().greaterThanOrEqualTo(1))
+ *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().greaterThanOrEqualTo(1))
* * @param value the value which, when passed to the Comparator supplied to this builder, should return greater * than or equal to zero @@ -161,9 +156,8 @@ public Matcher greaterThanOrEqualTo(T value) { * Creates a matcher of {@code T} object that matches when the examined object is * less than the specified value, as reported by the {@code Comparator} used to * create this builder. - *

* For example: - *

assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThan(2))
+ *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThan(2))
* * @param value the value which, when passed to the Comparator supplied to this builder, should return less * than zero @@ -177,9 +171,8 @@ public Matcher lessThan(T value) { * Creates a matcher of {@code T} object that matches when the examined object is * less than or equal to the specified value, as reported by the {@code Comparator} used to * create this builder. - *

* For example: - *

assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThanOrEqualTo(1))
+ *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
* * @param value the value which, when passed to the Comparator supplied to this builder, should return less * than or equal to zero diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java b/hamcrest-library/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java index 2a7dace0..af2191c8 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java +++ b/hamcrest-library/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java @@ -48,7 +48,6 @@ private BigDecimal actualDelta(BigDecimal item) { * Creates a matcher of {@link java.math.BigDecimal}s that matches when an examined BigDecimal is equal * to the specified operand, within a range of +/- error. The comparison for equality * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method. - *

* For example: *

assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/IsCloseTo.java b/hamcrest-library/src/main/java/org/hamcrest/number/IsCloseTo.java index 62a1500e..58cfa363 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/number/IsCloseTo.java +++ b/hamcrest-library/src/main/java/org/hamcrest/number/IsCloseTo.java @@ -52,7 +52,6 @@ private double actualDelta(Double item) { /** * Creates a matcher of {@link Double}s that matches when an examined double is equal * to the specified operand, within a range of +/- error. - *

* For example: *

assertThat(1.03, is(closeTo(1.0, 0.03)))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/IsNaN.java b/hamcrest-library/src/main/java/org/hamcrest/number/IsNaN.java index 46bd466f..0ca99ed7 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/number/IsNaN.java +++ b/hamcrest-library/src/main/java/org/hamcrest/number/IsNaN.java @@ -32,7 +32,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link Double}s that matches when an examined double is not a number. - *

* For example: *

assertThat(Double.NaN, is(notANumber()))
*/ diff --git a/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java b/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java index d8f53203..a76a6654 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java +++ b/hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java @@ -15,7 +15,6 @@ private OrderingComparison() { * Creates a matcher of {@link Comparable} object that matches when the examined object is * equal to the specified value, as reported by the compareTo method of the * examined object. - *

* For example: *

assertThat(1, comparesEqualTo(1))
* @@ -30,7 +29,6 @@ public static > Matcher comparesEqualTo(T value) { * Creates a matcher of {@link Comparable} object that matches when the examined object is * greater than the specified value, as reported by the compareTo method of the * examined object. - *

* For example: *

assertThat(2, greaterThan(1))
* @@ -46,7 +44,6 @@ public static > Matcher greaterThan(T value) { * Creates a matcher of {@link Comparable} object that matches when the examined object is * greater than or equal to the specified value, as reported by the compareTo method * of the examined object. - *

* For example: *

assertThat(1, greaterThanOrEqualTo(1))
* @@ -62,7 +59,6 @@ public static > Matcher greaterThanOrEqualTo(T value) * Creates a matcher of {@link Comparable} object that matches when the examined object is * less than the specified value, as reported by the compareTo method of the * examined object. - *

* For example: *

assertThat(1, lessThan(2))
* @@ -78,7 +74,6 @@ public static > Matcher lessThan(T value) { * Creates a matcher of {@link Comparable} object that matches when the examined object is * less than or equal to the specified value, as reported by the compareTo method * of the examined object. - *

* For example: *

assertThat(1, lessThanOrEqualTo(1))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/object/HasToString.java b/hamcrest-library/src/main/java/org/hamcrest/object/HasToString.java index 7e8dd577..f25c6838 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/object/HasToString.java +++ b/hamcrest-library/src/main/java/org/hamcrest/object/HasToString.java @@ -19,7 +19,6 @@ protected String featureValueOf(T actual) { /** * Creates a matcher that matches any examined object whose toString method * returns a value that satisfies the specified matcher. - *

* For example: *

assertThat(true, hasToString(equalTo("TRUE")))
* @@ -34,7 +33,6 @@ public static Matcher hasToString(Matcher toStringMatcher /** * Creates a matcher that matches any examined object whose toString method * returns a value equalTo the specified string. - *

* For example: *

assertThat(true, hasToString("TRUE"))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/object/IsCompatibleType.java b/hamcrest-library/src/main/java/org/hamcrest/object/IsCompatibleType.java index 85620249..05f453ab 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/object/IsCompatibleType.java +++ b/hamcrest-library/src/main/java/org/hamcrest/object/IsCompatibleType.java @@ -30,7 +30,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link Class} that matches when the specified baseType is * assignable from the examined class. - *

* For example: *

assertThat(Integer.class, typeCompatibleWith(Number.class))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/object/IsEventFrom.java b/hamcrest-library/src/main/java/org/hamcrest/object/IsEventFrom.java index ea3b0000..e0e58f89 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/object/IsEventFrom.java +++ b/hamcrest-library/src/main/java/org/hamcrest/object/IsEventFrom.java @@ -52,7 +52,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link java.util.EventObject} that matches any object * derived from eventClass announced by source. - *

* For example: *
assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
* @@ -69,7 +68,6 @@ public static Matcher eventFrom(Class eventC /** * Creates a matcher of {@link java.util.EventObject} that matches any EventObject * announced by source. - *

* For example: *
assertThat(myEvent, is(eventFrom(myBean)))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/IsBlankString.java b/hamcrest-library/src/main/java/org/hamcrest/text/IsBlankString.java index 604d39b4..f8dff530 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/IsBlankString.java +++ b/hamcrest-library/src/main/java/org/hamcrest/text/IsBlankString.java @@ -36,7 +36,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link String} that matches when the examined string contains * zero or more whitespace characters and nothing else. - *

* For example: *

assertThat("  ", is(blankString()))
*/ @@ -48,7 +47,6 @@ public static Matcher blankString() { /** * Creates a matcher of {@link String} that matches when the examined string is null, or * contains zero or more whitespace characters and nothing else. - *

* For example: *

assertThat(((String)null), is(blankOrNullString()))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/IsEmptyString.java b/hamcrest-library/src/main/java/org/hamcrest/text/IsEmptyString.java index 10e48cdb..14759606 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/IsEmptyString.java +++ b/hamcrest-library/src/main/java/org/hamcrest/text/IsEmptyString.java @@ -31,7 +31,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link String} that matches when the examined string has zero length. - *

* For example: *

assertThat("", isEmptyString())
* @@ -45,7 +44,6 @@ public static Matcher isEmptyString() { /** * Creates a matcher of {@link String} that matches when the examined string has zero length. - *

* For example: *

assertThat("", is(emptyString()))
* @@ -58,7 +56,6 @@ public static Matcher emptyString() { /** * Creates a matcher of {@link String} that matches when the examined string is null, or * has zero length. - *

* For example: *

assertThat(((String)null), isEmptyOrNullString())
* @@ -74,7 +71,6 @@ public static Matcher isEmptyOrNullString() { /** * Creates a matcher of {@link String} that matches when the examined string is null, or * has zero length. - *

* For example: *

assertThat(((String)null), is(emptyOrNullString()))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java b/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java index bc45039e..ee87df61 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java +++ b/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java @@ -44,7 +44,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. - *

* For example: *

assertThat("Foo", equalToIgnoringCase("FOO"))
* diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java b/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java index 75d6c533..50abb311 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java +++ b/hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java @@ -69,7 +69,6 @@ public String stripSpace(String toBeStripped) { *
  • all leading and trailing whitespace of both the expectedString and the examined string are ignored
  • *
  • any remaining whitespace, appearing within either string, is collapsed to a single space before comparison
  • * - *

    * For example: *

    assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))
    * diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/MatchesPattern.java b/hamcrest-library/src/main/java/org/hamcrest/text/MatchesPattern.java index 960770ec..b25b6dc8 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/MatchesPattern.java +++ b/hamcrest-library/src/main/java/org/hamcrest/text/MatchesPattern.java @@ -25,8 +25,8 @@ public void describeTo(Description description) { } /** - * Creates a matcher of {@link String} that matches when the examined string - * exactly matches the given {@link Pattern}. + * Creates a matcher of {@link java.lang.String} that matches when the examined string + * exactly matches the given {@link java.util.regex.Pattern}. */ @Factory public static Matcher matchesPattern(Pattern pattern) { @@ -34,8 +34,8 @@ public static Matcher matchesPattern(Pattern pattern) { } /** - * Creates a matcher of {@link String} that matches when the examined string - * exactly matches the given regular expression, treated as a {@link Pattern}. + * Creates a matcher of {@link java.lang.String} that matches when the examined string + * exactly matches the given regular expression, treated as a {@link java.util.regex.Pattern}. */ @Factory public static Matcher matchesPattern(String regex) { diff --git a/hamcrest-library/src/main/java/org/hamcrest/text/StringContainsInOrder.java b/hamcrest-library/src/main/java/org/hamcrest/text/StringContainsInOrder.java index f4c3b6c8..7f0d850a 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/text/StringContainsInOrder.java +++ b/hamcrest-library/src/main/java/org/hamcrest/text/StringContainsInOrder.java @@ -43,7 +43,6 @@ public void describeTo(Description description) { /** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. - *

    * For example: *

    assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
    * fails as "foo" occurs before "bar" in the string "myfoobarbaz" @@ -59,7 +58,6 @@ public static Matcher stringContainsInOrder(Iterable substrings) /** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. - *

    * For example: *

    assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
    * fails as "foo" occurs before "bar" in the string "myfoobarbaz" diff --git a/hamcrest-library/src/main/java/org/hamcrest/xml/HasXPath.java b/hamcrest-library/src/main/java/org/hamcrest/xml/HasXPath.java index 54398245..75f9a76d 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/xml/HasXPath.java +++ b/hamcrest-library/src/main/java/org/hamcrest/xml/HasXPath.java @@ -106,7 +106,6 @@ private static XPathExpression compiledXPath(String xPathExpression, NamespaceCo /** * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the * specified xPath that satisfies the specified valueMatcher. - *

    * For example: *

    assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
    * @@ -124,7 +123,6 @@ public static Matcher hasXPath(String xPath, Matcher valueMatcher) * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the * specified xPath, within the specified namespaceContext, that satisfies * the specified valueMatcher. - *

    * For example: *

    assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
    * @@ -143,7 +141,6 @@ public static Matcher hasXPath(String xPath, NamespaceContext namespaceCon /** * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node * at the specified xPath, with any content. - *

    * For example: *

    assertThat(xml, hasXPath("/root/something[2]/cheese"))
    * @@ -158,7 +155,6 @@ public static Matcher hasXPath(String xPath) { /** * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node * at the specified xPath within the specified namespace context, with any content. - *

    * For example: *

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